kAudioQueueErr_InvalidCodecAccess (-66672) when using ExtAudioFile on iOS 4.2
kAudioQueueErr_InvalidCodecAccess (-66672) when using ExtAudioFile on iOS 4.2
- Subject: kAudioQueueErr_InvalidCodecAccess (-66672) when using ExtAudioFile on iOS 4.2
- From: Doug McCoy <email@hidden>
- Date: Wed, 26 Jan 2011 21:28:02 -0800
On the final line of the code below, I am getting the error kAudioQueueErr_InvalidCodecAccess. I know this code worked in previous sdks, though I am not sure which ones exactly.
I am running on an iPod Touch 3G (MC008LL), with iOS 4.2.1.
I am building with SDK 4.2 for deployment target 3.2.
The docs describe this error as "The codec could not be accessed.". Not very helpful IMO. I have seen this code fail when the hardware is in use (error: hwiu), but this is the first ive seen the current error.
Anyone have any insight into what causes this error? Any help you can give is much appreciated.
Thanks,
Doug
AudioStreamBasicDescription audioFormat;
memset(&audioFormat, 0, sizeof(audioFormat));
audioFormat.mSampleRate = 16000.f; // FS
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;// | kAudioFormatFlagIsNonInterleaved;
audioFormat.mChannelsPerFrame = kAudioNumberOfChannels;
audioFormat.mFramesPerPacket = 1;
audioFormat.mBitsPerChannel = sizeof(short) * 8; // 16-bit
audioFormat.mBytesPerFrame = audioFormat.mBitsPerChannel / 8 * audioFormat.mChannelsPerFrame;
audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
AudioStreamBasicDescription clientFormat = audioFormat;
AudioStreamBasicDescription dstFormat;
memset(&dstFormat, 0, sizeof(dstFormat));
// compressed format - need to set at least format, sample rate and channel fields for kAudioFormatProperty_FormatInfo
dstFormat.mSampleRate = audioFormat.mSampleRate; // set sample rate
dstFormat.mFormatID = kAudioFormatMPEG4AAC;
dstFormat.mChannelsPerFrame = audioFormat.mChannelsPerFrame;
// use AudioFormat API to fill out the rest of the description
UInt32 size = sizeof(dstFormat);
XThrowIfError(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &dstFormat), "couldn't create destination data format");
mCachedFileFormat = kAudioFileM4AType;
// create the destination file
XThrowIfError(ExtAudioFileCreateWithURL((CFURLRef)mScratchAudioFileURL,
mCachedFileFormat,
&dstFormat,
NULL,
kAudioFileFlags_EraseFile,
&mExtRecordingFileID), "ExtAudioFileCreateWithURL failed!");
size = sizeof(clientFormat);
error = ExtAudioFileSetProperty(mExtRecordingFileID, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat);
---
Check out my new iPhone app, FlipTalk. Once featured on the iTunes App Store "What's Hot" list!
http://fliptalkapp.comhttp://itunes.com/apps/FlipTalk/http://tinyurl.com/FlipTalkYoutube
_______________________________________________
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