My conversion routine is heavily based on the UseExtAF class in the ConvertFile example in the CoreAudio SDK, and I'm trying to convert to Apple Lossless, which I thought would work because I can use 44.1 KHz Lossless as an ASBD for recording, and it works great.
convertedStreamDesc.mSampleRate = 44100.0;
convertedStreamDesc.mFormatID = kAudioFormatAppleLossless;
convertedStreamDesc.mChannelsPerFrame = 1;
// try to fill out this asbd
UInt32 convertedStreamDescSize = sizeof (convertedStreamDesc);
conversionErr =
AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, // inProperrtyId
0, // inSpecifierSize
NULL, // inSpecifier
&convertedStreamDescSize, // ioPropertyDataSize
&convertedStreamDesc); // outPropertyData
if (conversionErr != noErr) {
[self failTo: @"AudioFormatGetProperty" withOSStatus: conversionErr];
return;
}
I fail at to get the property, with kAudioDeviceUnsupportedFormatError:
Error in AudioFormatGetProperty: Error Domain=NSOSStatusErrorDomain Code=560226676 "Operation could not be completed. (OSStatus error 560226676.)"
Is there something else I need to do to set up the ASBD? When I used lossless for recording, I only set these three parameters (formatter, channels, sample rate) and it was fine. Or am I just doing it wrong?
Thanks in advance for any suggestions.
--Chris