Re: AudioConverter format not supported error
Re: AudioConverter format not supported error
- Subject: Re: AudioConverter format not supported error
- From: Brad Ford <email@hidden>
- Date: Wed, 13 Aug 2003 14:44:22 -0700
On 13. august 2003, at 20:05PM, Robert Grant wrote:
<SNIP>
Here are the two ASBDs:
sampleRate = 44100; // I want to support various sample rates
bitDepth = 16; // I want to support 24 bits too.
So this is your out:
The AIFF format:
AudioStreamBasicDescription inFormat;
inFormat.mSampleRate = sampleRate;
inFormat.mFormatID = kAudioFormatLinearPCM;
inFormat.mFormatFlags = kLinearPCMFormatFlagIsBigEndian;
Above is your problem. You've stated you want BigEndian, unsigned
integer (because of the absence of the signed bit), aligned low
(because of the absence of the packed bit or aligned high bit--doesn't
make sense for 16 bit). Last I checked, Core Audio had no blitters for
unsigned integer at bit depth != 8. So only mark unsigned if you're
going to 8-bit integer (and you want unsigned). Instead, use:
inFormat.mFormatFlags = kAudioFormatFlagIsBigEndian |
kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
inFormat.mBytesPerPacket = 2 * (bitDepth / 8);
inFormat.mFramesPerPacket = 1;
inFormat.mBytesPerFrame = 2 * (bitDepth / 8);
inFormat.mChannelsPerFrame = 2;
inFormat.mBitsPerChannel = bitDepth;
And this is your in (which looks fine):
The Float format:
AudioStreamBasicDescription rwFormat;
rwFormat.mSampleRate = sampleRate;
rwFormat.mFormatID = kAudioFormatLinearPCM;
rwFormat.mFormatFlags = kLinearPCMFormatFlagIsNonInterleaved |
kLinearPCMFormatFlagIsFloat;
rwFormat.mBytesPerPacket = 4;
rwFormat.mFramesPerPacket = 1;
rwFormat.mBytesPerFrame = 4;
rwFormat.mChannelsPerFrame = 2;
rwFormat.mBitsPerChannel = 32;
Create a new audio converter with these formats gets me a 'fmt?'
error.
AudioConverterNew(&rwFormat, &inFormat, &ac); // should now produce no
errors.
-Brad Ford
QuickTime Engineering
_______________________________________________
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.