Re: -10863 error - Help!
Re: -10863 error - Help!
- Subject: Re: -10863 error - Help!
- From: William Stewart <email@hidden>
- Date: Mon, 14 Jun 2004 11:37:05 -0700
The idea of the CAAudioFile is that it *always* expects you as the
client of it, to be dealing with "canonical" float32 buffers - it then
does any conversions to go from that format to the disk format...
So, your clientdataformat will almost *never* be the same as the file's
format... (even with a float32 file, the data is interleaved, and
typically in the AU world, data is not-interleaved)
Bill
On 14/06/2004, at 12:13 AM, Steve Gehrman wrote:
>
I'm trying to use the core audio sample code to save an audio stream to
>
a file. It works great if the source format is the same as the file
>
format, but I get an --10863 error from AudioUnitRender in the
>
CAAudioFileRecorder::InputProc if the formats are different.
>
>
I modified the sample to call SetClientFormat() to set the input
>
format, but it still fails.
>
>
Please help!!
>
>
Here's my code that sets up the CAAudioFileRecorder.
>
>
- (void)startRecordFromDevice:(MTCoreAudioDevice*)inputDevice;
>
{
>
const int kNumberBuffers = 3;
>
const unsigned kBufferSize = 0x8000;
>
>
_recorder = (void*) new CAAudioFileRecorder(kNumberBuffers,
>
kBufferSize, [inputDevice deviceID]);
>
>
CAStreamBasicDescription fileFormat;
>
fileFormat.mSampleRate = 44100.; // later get this from the
>
hardware
>
fileFormat.mFormatID = kAudioFormatLinearPCM;
>
fileFormat.mFormatFlags = kAudioFormatFlagIsBigEndian |
>
kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
>
fileFormat.mFramesPerPacket = 1;
>
fileFormat.mChannelsPerFrame = 2;
>
fileFormat.mBitsPerChannel = 16;
>
fileFormat.mBytesPerPacket = fileFormat.mBytesPerFrame = 4;
>
>
_file = (void*) new CAAudioFile;
>
((CAAudioFile *) _file)->PrepareNew(fileFormat, 44100.);
>
>
MTCoreAudioStream* stream = [inputDevice
>
streamForDirection:kMTCoreAudioDeviceRecordDirection];
>
MTCoreAudioStreamDescription *desc = [stream
>
streamDescriptionForSide:kMTCoreAudioStreamLogicalSide];
>
>
CAStreamBasicDescription deviceFormat([desc
>
audioStreamBasicDescription]);
>
>
((CAAudioFile *) _file)->SetClientFormat(deviceFormat);
>
>
((CAAudioFile *) _file)->Create([_destPath UTF8String],
>
kAudioFileAIFFType);
>
>
((CAAudioFileRecorder*)_recorder)->SetFile(((CAAudioFile *)
>
_file)->GetAudioFileID());
>
>
((CAAudioFileRecorder*)_recorder)->Start();
>
}
>
>
>
OSStatus CAAudioFileRecorder::InputProc(
>
void * inRefCon,
>
AudioUnitRenderActionFlags *ioActionFlags,
>
const AudioTimeStamp * inTimeStamp,
>
UInt32 inBusNumber,
>
UInt32 inNumberFrames,
>
AudioBufferList * ioData)
>
{
>
CAAudioFileRecorder *This = static_cast<CAAudioFileRecorder
>
*>(inRefCon);
>
AudioUnitRenderActionFlags flags = 0;
>
AudioBufferList *abl =
>
&This->mAudioInputPtrs->GetModifiableBufferList();
>
OSStatus err = AudioUnitRender(This->mInputUnit, &flags, inTimeStamp,
>
1, inNumberFrames, abl);
>
>
if (err)
>
{
>
printf("err: %d", err);
>
return err;
>
}
>
>
This->PushBuffer(inNumberFrames, abl);
>
return noErr;
>
}
>
_______________________________________________
>
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.
>
>
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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.