Re: Playing multiple sounds
Re: Playing multiple sounds
- Subject: Re: Playing multiple sounds
- From: William Stewart <email@hidden>
- Date: Mon, 27 Aug 2007 11:05:08 -0700
Another point...
All audio units have scopes, and typically an audio unit will have 2
I/O scopes active (1 for input and 1 for output). The device units
(AUHAL and its derivative Default or SystemOutputUnit) talk directly
to an audio device. When you are doing output (playing audio) the
output scope of an AUHAL unit is the device, the input scope is the
data you are providing it to play out.
As Mark says, when you set the format here, what you are setting is
the format of the data that you are going to provide the AUHAL unit.
The AUHAL unit has various conversion operations that it can perform
to match the format that you give it and the format that the device
requires. In the DefaultOutputUnit example in /Developer/Examples/
CoreAudio this is most simply demonstrated.
You cannot change the format of the output side of AUHAL (the device
it will output too). If you wanted/needed to change the format of the
device, you would need to go through the configuration properties of
the device as expressed in <CoreAudio/AudioHardware.h>
Bill
On 25/08/2007, at 12:19 PM, Mark Pauley wrote:
Don't worry about changing the output unit's settings, in this case
the cannonical format will be converted into the actual format
before core audio renders to the hardware. I think that in this
case you can also effectively ignore the original stream format of
the default output unit as long as the call to change stream format
succeeded.
It may be the case however that your job will be easier by simply
dealing with non-interleaved streams because you can do simple
channel duplication when going from mono to stereo by duplicating
the audio buffer pointer in the bufferlist.
_Mark
On Aug 25, 2007, at 4:26 AM, Andreas Falkenhahn
<email@hidden> wrote:
Ok, thanks. I've now successfully installed a render callback on
the mixer.
But now there's a new problem: When the render proc is called,
ioData->mNumberBuffers
is 2 now, which makes AudioConverterFillComplexBuffer() exit with a
paramErr
because it obviously expects only one buffer.
What am I doing wrong here?
The format is mismatched - the version 1 AUs (that you were using)
were using interleaved floats. The format for v2 units use
deinterleaved floats. Have a look at the SetCanonical call in
CAStreamBasicDescription.cpp (in PublicUtility in /Developer/
Examples/
CoreAudio)
Ok, thanks. Now it's playing correctly. But: Am I not somewhat
overriding
the user's default settings by applying SetCanonical() on the
default output
format gotten through AudioUnitGetProperty()? I'm just wondering
because
SetCanonical() sets mBitsPerChannel to 32, mChannelsPerFrame to 2,
BytesPerFrame to sizeof(Float32), etc.
Why do I need to get the default stream format at all then if I'm
overriding it
with my own settings (using SetCanonical) right after I got it?
Andreas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden