Hi,
I have following call sequences. I've omitted some code just to keep the email
short. Basically, what I do is to setup the RemoteIO AU to capture 8KHz PCM
audio data. I want the microphone callback to be called at a certain interval,
such as 50 ms. I try to use
kAudioSessionProperty_PreferredHardwareIOBufferDuration property on the audio
session. But no matter what value I set it to, my microphone callback always
gets called every 11.5 ms. Any one experiences the same? Any idea why?
Thanks.
Jeff
// set IO buffer to be 50 ms
Float32 aBufferLength = 0.050; // In seconds
UInt32 size = sizeof(aBufferLength);
AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration,
size,&aBufferLength);
// activate audio session
status = AudioSessionSetActive(active);
UInt32 flag = 1;
status = AudioUnitSetProperty(audioUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
1, //kInputBus,
&flag,
sizeof(flag));
// Init format to 8KHz PCM
audioFormat.mSampleRate = 8000;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags= kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 2;
audioFormat.mBytesPerFrame = 2;
audioFormat.mReserved = 0;
// Apply format
status = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&pastream->audioFormat,
sizeof(pastream->audioFormat));
// Set input callback
AURenderCallbackStruct callbackStruct;
callbackStruct.inputProc = micCallback;
callbackStruct.inputProcRefCon = pastream;
status = AudioUnitSetProperty(audioUnit,
kAudioOutputUnitProperty_SetInputCallback,
kAudioUnitScope_Global,
kInputBus,
&callbackStruct,
sizeof(callbackStruct));
// Init Audio Unit
....
_______________________________________________
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