Re: IOAudioMixerEngine.cpp
Re: IOAudioMixerEngine.cpp
- Subject: Re: IOAudioMixerEngine.cpp
- From: Bill Stewart <email@hidden>
- Date: Wed, 07 Aug 2002 17:01:51 -0700
And, new for Jaguar we have Native Format support... The driver will still
publish the float buffer, and that is still what the HAL will by default,
publish to clients, but the native format buffer(s) are an alternative that
an application can choose.
This allows an application to grab sole ownership of a device and then place
the device into a Native Format mode. This will then have the device publish
its native format as the buffers that the HAL publishes to its clients.
A couple of things to be aware of.
(1) This means that the user loses the ability for any other application to
access that device while an application has ownership of it in this mode
(this is known as HogMode in CoreAudio/AudioHardware.h)
(2) The client application has to understand the format of the device and be
able to format its audio samples appropriately. USB has some rather arcane
formats (and incredible though it seems, there are devices that implement
those:).
So, for the general case this can be a lot of work, and any app that does
this is *STRONGLY ADVISED* to support the fallback condition of dealing with
the float format - both for formats and for cases where more than one
process may want to have access to the same device.
As Jeff said, unless you really know what you're doing here and you have a
real need to scrape every single cycle of CPU, it is doubtful that you'll
gain that much from all this extra work anyway - and by you I mean the
application developer talking to a driver in this mode, not the driver
itself.
There are certainly some situations where this is a desirable feature, and
thus, it is available. I'm not sure where the docs are for this, but I
believe there's a slight tweak that has to be done to the drivers to allow
this to occur over and above what was needed in the drivers for 10.1 -
others on this list can answer that.
We also substantially improved the mix/clip behaviour of IOAudioFamily in
Jaguar, (which inlcuded some bug fixes in the family and some very tightly
optimised float->int conversions).
Bill
on 8/7/02 4:36 PM, Matthew Xavier Mora wrote:
>
At 4:07 PM -0700 8/7/02, Jeff Moore wrote:
>
> On Wednesday, August 7, 2002, at 02:38 PM, Nathan Aschbacher wrote:
>
>
>
>> Okay so I'm trying to clarify something.
>
>>
>
>> It looks as though that IOAudioMixerEngine.cpp implements the
>
>> IOAudioFamily's main mixing function called "mixOutputSamples".
>
>
>
> Yup. This is true. This function does the floating point mix from
>
> the HAL client's buffer into the main mix bus at the time indicated
>
> by the HAL in the call to performClentIO.
>
>
>
>> Am I to understand that this is where the CPU spends it's time mixing audio
>
>> buffers for use by the rest of the audio pipeline. If so it seems very
>
>> minimalist doing primarily 4 sequential additions and some clean-up work. I
>
>> don't understand why this function has such a high CPU burden given that it
>
>> doesn't do much and what it does do is almost the fastest operation that the
>
>> FPU can do. Which I guess is what makes me skeptical out whether or not
>
>> this is the right place to be looking to override a function to prevent the
>
>> main CPU from having to continually mix the audio buffers itself.
>
>
>
> Doubtful. I have measured the performance of this routine and it is
>
> very fast. It takes on the order of 20-30 microseconds to mix a 128
>
> stereo sample frames on my 500 MHz TiPB.
>
>
>
> That said, I'm sure that there is room for improvement in the code
>
> by hand coding the assembly like we did with the float to int
>
> conversions.
>
>
If I understand his intentions correctly he wishes to do hardware
>
mixing and output (ie the samples stay on the card once grabbed from
>
the IOProc). So he would save mixing (not much to gain there unless
>
there are dozens of clients) and clipping/conversion. So he may gain
>
a few percent if he can program the DSP on his card to do mixing and
>
float to int conversion and clipping. In a game environment every
>
little bit helps. :-)
>
>
>
Matt
>
_______________________________________________
>
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
__________________________________________________________________________
"...Been havin' some trouble lately in the sausage business," C.M.O.T.
Dibbler replied.
"What, having trouble making both ends meat?"
__________________________________________________________________________
_______________________________________________
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.