Re: Audio glitches during playback thru Remote IO unit (iPhone)
Re: Audio glitches during playback thru Remote IO unit (iPhone)
- Subject: Re: Audio glitches during playback thru Remote IO unit (iPhone)
- From: William Stewart <email@hidden>
- Date: Wed, 12 Aug 2009 14:55:38 -0700
Reading from the file system can take locks, and it does so
unconditionally, so you can block and you will miss your deadline, and
you hear gaps. So, you don't do this.
The render callback from an audio unit that is attached to an audio
device (AURIO or AUHAL on the desktop) is running within the context
of a deadline driven thread. The deadline is the time represented by a
particular request to produce some amount of audio data - say 512
frames at 44.1KHz, means that you have to provide that full amount of
data (no more, no less) within that time period (which is approx 11msec)
Things that take locks, so you don't do it in the render thread:
- reading or writing to the file system
- malloc or free (also operator new / delete that would to a "normal"
memory allocation pool)
- unconditional lock aquisition (in this case you can do a try, and
be prepared to NOT obtain the lock - CAMutex has some examples of the
difference between Lock and Try using p-thread constructs)
Then of course, there's the general problem of just taking too much
time (ie, running computations that take more time than you have
available)
Welcome to core audio :)
Bill
On Aug 12, 2009, at 12:02 AM, tahome izwah wrote:
I think it is discouraged to do synchronous reads within a render
callback. You should have a separate reader thread and queue up your
audio buffers in memory until they are needed for playback.
--th
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden