Re: Confused on DefaultOutputUnit and conversions
Re: Confused on DefaultOutputUnit and conversions
- Subject: Re: Confused on DefaultOutputUnit and conversions
- From: David Duncan <email@hidden>
- Date: Thu, 1 Apr 2004 14:55:39 -0500
On Apr 1, 2004, at 02:09 PM, Wade Williams wrote:
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.
No, you are correct. You don't strictly need an Audio Convertor to do
that, the Default Output unit comes with one built in. But in addition
to that, the Default Output unit is a good client of the HAL, something
that is not trivial to be. Thus even if it require you to create an
Audio Convertor, the Default Output Unit would still be a better place
to start most of the time.
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?
All you should have to do is setup a proper AudioStreamBufferDescriptor
for that audio and tell the Default Output unit what your sending and
it should do the rest (or return an error telling you why it can't).
Your specific situation doesn't seem like one that would warrant any
trouble.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.
David Duncan
_______________________________________________
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.