Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This arrangement will fundamentally never work. </p> <p>GCD is a thread-pool designed to facilitate task-level parallelism. It is usually asynchronous and non real-time. These are almost precisely the opposite characteristics to those required in an audio application.</p> <p>Each thread servicing a GCD queue is contending with other threads in the system for an opportunity to execute. Furthermore, the queue may be busy at requested time processing something else. If that <em>something else</em> is long-running - and long-running tasks are precisely the kind of thing that GCD is made for - the scheduler may pre-empt the thread before the operation has completed and penalise the queue; it may wait a long time for service. </p> <p>The <a href="http://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man3/dispatch_source_set_timer.3.html" rel="noreferrer">Manpage</a> for GCD states the following about timers on GCD queues: </p> <p><em>A best effort attempt is made to submit the event handler block to the target queue at the specified time; however, actual invocation may occur at a later time.</em></p> <p><code>NSTimer</code> will not be any better. Its documentation states <em>A timer is not a real-time mechanism</em>. Since you'll probably run this on the application's main run-loop, it will also be very unpredictable. </p> <p>The solution to this problem is to use lower-level audio APIs - specifically <em>Audio Units</em>. The advantage of doing so is that soft-syth units have an event queue which is serviced by the unit's render handler. This runs on a real-time thread, and offers extremely robust and predictable service. Since you can queue a considerable number of events with timestamps in the future, your timing requirements are now quite loose. You could safely use either GCD or a <code>NSTimer</code> for this. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload