Re: Confused on DefaultOutputUnit and conversions
Re: Confused on DefaultOutputUnit and conversions
- Subject: Re: Confused on DefaultOutputUnit and conversions
- From: William Stewart <email@hidden>
- Date: Thu, 1 Apr 2004 12:32:28 -0800
We covered this a bit at WWDC last year (see, its that time again where
I start to put in plugs to attend WWDC this year)...
Basically, the difference is this:
Audio Units deal with formats that contain 1 frame per packet - in the
normal case this is PCM. So a default output unit's converter when its
republished through the AU is limited to this... This is not an
arbitrary restriction, but deliberate.. An AU could deal with other
formats that are also defined by this, but PCM at this stage is the
best way to think about this.
An AudioConverter presents a much richer semantic for data formats. It
can deal with basically any combination/relation between bytes per
packet (variable or constant), frames per packet (variable or
constant)... So, it has the ability to transform between formats like
MP3 and AAC (variable bytes per packet, constant frames per packet)
to/from PCM (constant bytes and frames per packet) - as well as even
more complex formats where there can be variable bytes AND frames per
packet.. Ogg Vorbis' streams are like this (AAC actually shields the
user from this complexity which is one of the nice things about AAC).
So, when reading from a file, we generalised this to use a converter
feeding PCM data to the AU so that we could deal with files that
contained MP3 or AAC.
I'd also recommend taking a look through the new Audio File handling
code in the SDK (in particular the CAAudioFile class is an extremely
flexible and powerful and easy to use class).. There's examples there
to easily play and record audio from a device to a file of *any*
supported format, read a file and process its contents with an AU...
This code is much cleaner than the previous versions...
Bill
On 01/04/2004, at 11:09 AM, Wade Williams wrote:
>
I'm a little confused on what conversions the default output unit will
>
do for you. Please note I'm still a newbie with CoreAudio. :)
>
>
In looking at the PlayAudioFileLite sample code, it uses the default
>
output unit, yet uses an AudioConverter to make the supplied data
>
format match the input format of the AudioUnit.
>
>
Is that required? If so, what's the point of using the default output
>
unit than just using the HAL for output? It would seem to me the only
>
difference would be that you provide data in a render callback instead
>
of the IOProc. According to the documentation, using the default
>
output unit is supposed to make life easier, but if both methods
>
require an AudioConverter, I don't see a big difference.
>
>
I certainly could see a difference where you wanted to link in other
>
audio units and do some fancier effects. But for just straight
>
playback, am I missing something?
>
>
My audio data is just 16-bit, mono, PCM samples, which will have a
>
sample rate of 8K. Can I just hand those to the default output unit
>
without explicitly setting up all of its output/input parameters and
>
setting up an AudioConverter to make sure the data matches? Under
>
what conditions will the default output unit do conversions for me?
>
>
Any thoughts or instruction appreciated.
>
>
Wade
>
_______________________________________________
>
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
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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.