Re: CoreAudio, Mixing and Panning, and the Audio Toolbox
Re: CoreAudio, Mixing and Panning, and the Audio Toolbox
- Subject: Re: CoreAudio, Mixing and Panning, and the Audio Toolbox
- From: Bill Stewart <email@hidden>
- Date: Wed, 06 Mar 2002 19:28:16 -0800
I think the best way to wire this up is to construct an AUGraph with your
mixer and output units then just instantiate callbacks on the input busses
of the mixer for the input. That way the graph manages the connections, etc
for you.
The MIDIGraph and SMFPlayer apps in the Java dir show you how to use the
graph API (its pretty easy), then you can take the example of using the
OutputUnit to learn how to do the input callbacks for the mixer.
Bill
on 6/3/02 12:20 PM, Chris Rogers wrote:
>
The stereo mixer AudioUnit ('smxr') takes N mono or stereo inputs and
>
mixes them to a single stereo-interleaved output with volume and pan
>
for each channel (currently pan is not supported for stereo channels).
>
It's not very complicated to use. Simply connect up the inputs (either
>
to outputs of other AudioUnits with the kAudioUnitProperty_MakeConnection
>
property, or by a user callback with the kAudioUnitProperty_SetInputCallback)
>
in the standard way. You may also be interested in using the
>
interleaver and deinterleaver AudioUnits.
>
>
Chris
>
>
>
>
> I have written a small program that streams any number of audio
>
> files to the default output device. I mix the audio data into the
>
> device's buffer "manually", by looping through my ring buffers and
>
> scaling and adding them into the device's buffer. It works well,
>
> and I'm excited to have finally started getting something done in
>
> CoreAudio.
>
>
>
> Ultimately, I'd like to stream arbitrary audio data into arbitrary
>
> audio outputs, and I'd like to do so in a way that's internally
>
> clean and efficient. I already know how I'd do that using the
>
> technique I'm already using. However, I wonder whether I'd be
>
> better off using the Audio Toolbox. I see that there's a stereo
>
> mixer Unit ('smxr'). This implies that you can associate a mixer
>
> unit with a physical device, and feed your data to the Unit, letting
>
> it do the math for panning and mixing. Is this indeed what it's
>
> for? If so, does there exist any sample code that shows such a
>
> setup in use? Is there any advantage to using the Audio Toolbox
>
> relative to rolling my own scheme?
>
>
>
> I have struggled through the "Audio Toolbox" chapter of the
>
> CoreAudio pdf, and I see that there is a Java example which writes
>
> audio data to a device via the default output unit, but I don't know
>
> how to put those things together in such a way that you can combine
>
> the HAL and Toolbox worlds.
>
>
>
> To restate what I ultimately want: any number of independent
>
> channels, each routed to a chosen physical device stream; when more
>
> than one channel is associated with a stream, I wish to mix them.
>
>
>
> Thanks, in advance, for whatever help and guidance you can provide.
>
> --
>
> Jonathan Feinberg email@hidden Inwood, NY, NY
>
> http://MrFeinberg.com/
>
> _______________________________________________
>
> coreaudio-api mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
> Do not post admin requests to the list. They will be ignored.
>
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"Thousands of years ago, cats were worshipped as gods. We have never
forgotten this."
__________________________________________________________________________
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.