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 11:53:13 -0700
On Wednesday, September 18, 2002, at 11:21 AM, Robert Goulet wrote:
[I currently have an implementation of CoreAudio. When the application
starts, I query the system to get how many AudioDevice are present,
and I keep them for future references.] Our application work like > this:
You can add an audio file to the scene (this is a multimedia
application that works with 3D animations, videos, etc.), and then,
you can specify a destination to that audio clip. The destination
defines on which sound card the sound will output. Then the user can
add more audio clips and set the same destination for all of them.
What would be the easiest modification of that program so I could play
multiple file simultaneously?
I've already explained some of this, but very roughly:
* In your setup code, create a mixer AudioUnit for each possible output.
* You already have one IOProc for each output. Change this IOProc to
take data from the mixer, instead of from a file.
* When you start playing a sound, find the mixer to use, and find an
empty bus. (It's up to you to remember which buses are in use.)
* Using AudioUnitSetProperty(), set an input callback on the mixer for
that bus.
* Implement the input callback to get the data from the file and return
it.
There may be other ways to do this (for instance, you might be able to
create the mixers on the fly instead of all at once), but this will
work.
--
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.