Re: Stopping a Audio Unit From Callback PROPERLY
Re: Stopping a Audio Unit From Callback PROPERLY
- Subject: Re: Stopping a Audio Unit From Callback PROPERLY
- From: Brian Barnes <email@hidden>
- Date: Tue, 2 Oct 2001 01:35:44 -0400
Chris Rogers wrote:
Ordinary AudioUnits do NOT have any concept of being started or stopped.
Only output AudioUnits (kAudioUnitSubType_Output) understand
AudioOutputUnitStart() and
AudioOutputUnitStop(). AudioOutputUnitStart() starts the hardware
device
associated with the AudioUnit. AudioOutputUnitStop() stops the hardware
device from calling back through the HAL. Our stereo mixer AudioUnit
(kAudioUnitSubType_Mixer, kAudioUnitID_StereoMixer) allows for
connections
to be made and broken to the input busses. You can dynamically allocate
one-shot sounds to mixer inputs, and when the sound is finished, simply
disconnect the input, and you'll get no more callbacks for that input.
Other connected inputs to the mixer will continue to callback, however.
OK, I get this. So what would be the recommendation for something like
a game? Multiple audio units or a single stereo mixer audio unit with
multiple inputs?
Multiple audio units (which I'm doing now) seem to work fast enough, and
take very little processor time. I do this because it seems very close
to the idea of multiple channels in the sound manager, which is where I
came from.
Also, a side question: Can the subtype_effect units take multiple
inputs? Or would I have to mix all my audio units in a mixer audio
unit, send that to the effect, and then send that to an output unit? If
so, that would be a good reason to go with a single mixer unit!
[>] Brian