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: "Robert Goulet" <email@hidden>
- Date: Wed, 18 Sep 2002 13:22:46 -0400
- Thread-topic: Playing 2 or more audio data simultaneously
Ok... so it seems that there is a lot of possibilities to implement sound on MacOS/X. What is the more flexible, fast, effective and powerful API to implement sound on a MacOS/X platform? I mean an equivalent of DirectSound, but for MacOS/X.
-----Original Message-----
From: Kurt Revis [
mailto:email@hidden]
Sent: Wednesday, September 18, 2002 1:01 PM
To: Robert Goulet
Cc: CoreAudio mailing list (E-mail)
Subject: Re: Playing 2 or more audio data simultaneously
On Wednesday, September 18, 2002, at 08:28 AM, Robert Goulet wrote:
>
It is possible to mix sound with core audio? I'm currently able to
>
play a single audio file because I don't understand how am I suppose
>
to have more than one buffer in my output audio buffer list that I
>
receive in my AudioIOProc.
This is not difficult at all; here's an overview. Use a mixer AudioUnit
to mix multiple audio streams into one stream. You set up an input
callback on the mixer, so it will ask you for data for each stream when
it needs it. On the output side, you can do two things:
1. Use one of the default audio output AudioUnits (see
AudioToolbox/DefaultAudioOutput.h). You can connect the mixer directly
to this, and your application won't need to implement an IO proc
anymore. This is definitely the easiest route.
2. Keep using the same IO proc that you're using now, but in it, ask
the mixer AU for data using AudioUnitRender() (or
AudioUnitRenderSlice() if the mixer AU is still a version-1 AU).
Despite what the other poster said, it's definitely not recommended to
set up more than one IO proc on the same output in the same
application. I think it works, but it will cost you CPU time and
increase the total load on the system, and will be confusing too.
Hope this helps.
--
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.