I answered most of this off-line, but...
Be aware that the Simple SDK solution "synchronizes" by running your generator code inside the Core Audio thread. When you're generating a sine wave, that's OK; if you're going to be streaming off a network or reading from the filesystem or doing heavy computation, you're back to the synchronization question.
Anyway, I suggested either an asymmetric mutex (trylock in the Core Audio thread, lock in the generating thread), an array-based ring buffer, or a lock-free FIFO. One other possibility that I didn't mention is to treat the threads as if they were separate processes and use some explicit message-passing API (which is just an abstraction over a FIFO, but it's sometimes a useful one).
Does anyone know, off the top of their head, some sample code or open-source apps that do some of those, so he can look at some actual code rather than my dense prose?
On 7 May 2007, at 01:39, B. Mitchell Loebel wrote: Thank you Stephen.
Several other guys on this list made a number of suggestions including the one you offered below. I think I'm on the right track now. I'll know in a few days. 'Til then, thanks again.
At 12:24 AM 5/7/2007 -0700, Stephen Davis wrote: On May 6, 2007, at 5:58 PM, B. Mitchell Loebel wrote:
Cutting to the chase ...
The solution I'm seeking doesn't have a user interface ... my host app does that. So I'm looking for a code snippet to hard wire into my app. I'm not even looking for a plug-in because that implies dynamic loading by my app at launch time.
I did some looking in the Apple refs and came up with TN2097, DefaultOutputUnit, and the notion of an
AudioStreamBasicDescription struct. I can assign all the parameters
that are important to me into that struct ... good. I also saw a way to
set up a renderCallback method ...
- "that will be used as the input procedure when rendering data
to
- the AudioUnit. The input procedure will be called only when the
Audio
- Converter needs more data to process" (quoting TN2097)
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
|