Re: How to make Audio Unit chain in iPhone?
Re: How to make Audio Unit chain in iPhone?
- Subject: Re: How to make Audio Unit chain in iPhone?
- From: Jens Alfke <email@hidden>
- Date: Thu, 19 Feb 2009 08:25:27 -0800
On Feb 18, 2009, at 8:45 PM, Gabriele Palmas wrote:
1) I have create a AUGraph with mixer unit (I would like to add
another track in the future) and Output Unit.
2) I have a piece of code that put the aif file in a queue (there is
not input unit in iPhone)
Do you mean an AudioQueue? You can't connect that to AudioUnits,
unfortunately; its output goes directly to the speakers.
(there is not input unit in iPhone)
Do you mean the AUFilePlay [sp?] AudioUnit? That's a shame; I haven't
used this, but it looks like it would make plugging audio files into a
graph much easier.
Without that, to feed samples into an AUGraph you need to install a
render callback onto one of the input channels of an AU. This will get
called when the AU needs more samples, and should copy them into its
buffer. This callback happens on a real-time thread and it has to
return very quickly to avoid glitching the audio.
The way it's usually done is to run a separate thread that reads from
the file and decodes the audio into buffers, then use a thread-safe
fixed-capacity queue to mediate between the file thread and the AU
render callback. There are classes in the "PublicUtility" subfolder of
the CA SDK that do this: look at CAAudioFileStreamer and CABufferQueue
in particular. And some of the example apps use those classes to play
files.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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