Re: Playing 2 or more audio data simultaneously
Re: Playing 2 or more audio data simultaneously
- Subject: Re: Playing 2 or more audio data simultaneously
- From: Kurt Revis <email@hidden>
- Date: Wed, 18 Sep 2002 13:36:26 -0700
On Wednesday, September 18, 2002, at 12:29 PM, Robert Goulet wrote:
Well, you'll find me very annoying, but I will need a written example
of how to proceed with that way since I'm unable to find a suitable,
detailed doc.
I really don't have the time to go into extreme detail here, especially
since I'm doing this for free, but here's the general idea. Maybe
someone else can jump in and explain things in more detail.
There is no secret information being hidden from you, by the way.
Everything I'm writing here is covered in the docs or in the header
files, or has been discussed on this mailing list. There is a lot of
sample code available; please, if you don't understand how something
works, search the header files and the sample code and see if you can
find a working example.
I would also recommend that you do some small tests of small parts of
the CoreAudio functionality, just to learn how things work. Worry about
fitting them together later. Compared to trying to figure everything
out all at once, it will be a lot easier.
If that isn't enough for you, I'm sorry, but that's all I can do.
After, how do I make my IOProc works with mixer AU instead of
writting data in the output buffer given in parameter?
In your IOProc, call AudioUnitRender() on the mixer. Look at the
parameters you're given, and the parameters to pass to
AudioUnitRender(), and match them up.
(I'm not sure if the mixer in 10.2 is a version 1 or version 2
AudioUnit. If it's a version 1, you will need to call
AudioUnitRenderSlice() instead. Anyone know?)
In order to get started, I would skip this part and come back to it
later. Just connect the mixer to the default audio output. That way
you'd don't even need to implement an IOProc. Most of the sample code
does this; search for OpenDefaultAudioOutput() and
kAudioUnitProperty_MakeConnection.
Then, when you talk about finding a mixer and an empty bus, I don't
really understand what you mean or what it involve as code.
The mixer mixes multiple input buses into one output bus. That is, a
bus is a set of channels of audio data. (Usually a bus is mono or
stereo.) The buses are numbered starting with 0 (I think). You're
the one providing the data, so you're the one managing which buses are
in use and which are not.
You set an input callback on the mixer for each bus of data that you
will provide. When the mixer needs data, it will call your callback
function, giving it the bus number. It is up to you to use that bus
number to find the data that you want to provide.
See the declaration of AURenderCallback in AUComponent.h. (Again, if
the mixer is a version 1 AU, it's slightly different: see
AudioUnitRenderCallback in AUNTComponent.h.)
Then, using AudioUnitSetProperty() to set the input callback for that
'bus' is something I won't be able to do without an example code.
And for that input callback, it totally don't get it.
Take a look at the code in
/Developer/Examples/CoreAudio/Services/DefaultOutputUnit/
UsingDefaultNoAC.cpp. This demonstrates how to implement an input
callback and how to connect it.
In that example, the bus number is always 0. When using a mixer, you
can pass in a different number for the bus.
Nobody ever did a complex, professional audio tool on MacOS/X?
I don't know. Does Logic count?
--
Kurt Revis
email@hidden
_______________________________________________
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.