Re: Why get Error kAudioUnitErr_CannotDoInCurrentContext when call AudioUnitRender in InputCallback
Re: Why get Error kAudioUnitErr_CannotDoInCurrentContext when call AudioUnitRender in InputCallback
- Subject: Re: Why get Error kAudioUnitErr_CannotDoInCurrentContext when call AudioUnitRender in InputCallback
- From: Doug Wyatt <email@hidden>
- Date: Fri, 17 Jul 2009 08:42:34 -0700
It looks like there's an expectation that the output unit will do a
sample rate conversion. It will fail as described if the output
scope's stream format's sample rate does not match the hardware sample
rate.
On Jul 16, 2009, at 19:54 , William Stewart wrote:
how do you set up your input callback?
On Jul 15, 2009, at 4:30 PM, zheng ying wrote:
Hi. all
Why get Error kAudioUnitErr_CannotDoInCurrentContext when
call AudioUnitRender in InputCallback, who can give me some
Help , THANKS.
here is my parameter setting list:
fOutputFormat.mSampleRate = 8000;
fOutputFormat.mFormatID = kAudioFormatLinearPCM;
fOutputFormat.mFormatFlags =
kLinearPCMFormatFlagIsNonInterleaved|
kLinearPCMFormatFlagIsSignedInteger;
fOutputFormat.mBytesPerFrame = 2;
fOutputFormat.mBytesPerPacket = 2;
fOutputFormat.mFramesPerPacket = 1;
fOutputFormat.mChannelsPerFrame = 1;
fOutputFormat.mBitsPerChannel = 16;
// Set the AudioOutputUnit output data format
err = AudioUnitSetProperty(fAudioUnit,
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1,
&fOutputFormat, sizeof(AudioStreamBasicDescription));
if(err != noErr)
{
fprintf(stderr, "failed to set input device ASBD\n");
return err;
}
param = sizeof(UInt32);
fAudioSamples = 160;
err = AudioUnitSetProperty(fAudioUnit,
kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0,
&fAudioSamples, param);
...
---------
in my inputcallback we render the data to buffer , got error...
code here
DCAudioFileRecorder *afr = (DCAudioFileRecorder*)inRefCon;
OSStatus err = noErr;
// Render into audio buffer
err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp,
inBusNumber, inNumberFrames, afr->fAudioBuffer);
//ERROR HERE kAudioUnitErr_CannotDoInCurrentContext
...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
This email sent to email@hidden
_______________________________________________
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