Re: Meaning of "client data format" when converting with ExtAudioFile
Re: Meaning of "client data format" when converting with ExtAudioFile
- Subject: Re: Meaning of "client data format" when converting with ExtAudioFile
- From: Jens Alfke <email@hidden>
- Date: Sun, 22 Feb 2009 17:51:51 -0800
On Feb 22, 2009, at 1:20 PM, Chris Adamson wrote:
I've found, from developing my own code and working with the
ConvertFile example from the CA SDK, that this step is necessary,
taking the ASBD of whichever side of the conversion is PCM and
setting it as the "client data format" property on both the source
and the target ExtAudioFiles.
The clientDataFormat is the data format of the end of the ExtAudioFile
that's not connected to the file. If you want to connect two audio
thingies together, they have to share a common format so they can
understand each other's data. So if you're converting a file by using
an input and an output ExtAudioFile, you need to decide on what the
uncompressed in-memory format will be, and tell both objects to use
that as the client data format. Or if you're feeding audio from a file
into an AUGraph, you need to tell the file object to output a format
that the input of the graph expects.
But why am I doing this, i.e., why is it not sufficient that we set
up the ExtAudioFiles with different ASBDs, which describe the input
and output formats?
I'm not sure I understand ...
If you're asking why you can't do the conversion with a single
ExtAudioFile, it's because ExtAudioFile (like AudioConverter) can
convert either to or from raw PCM, but not between two data formats.
So to go from MP3 to AIFF, you need both an MP3-to-PCM and a PCM-to-
AIFF converter.
If you're asking why you have to specify a specific PCM format to be
used for the buffers between the two ExtAudioFile objects; I guess it
would have been possible for CA to specify a format that gets used by
default; but there are probably enough cases where you want something
different, that having a default wouldn't help that much, and could
cause trouble in some cases.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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