Change the callback buffer length of iphone remoteIO AU?
Change the callback buffer length of iphone remoteIO AU?
- Subject: Change the callback buffer length of iphone remoteIO AU?
- From: Doug McCoy <email@hidden>
- Date: Sat, 13 Feb 2010 01:33:46 -0800
I have an adaptation of the aurioTouch example code that I have working, but I can't seem to adjust the callback buffer length.
I have this callback:
static OSStatus PerformThru(
void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
and this format:
AudioStreamBasicDescription audioFormat;
audioFormat.mSampleRate = 44100.0f; // FS
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
audioFormat.mChannelsPerFrame = 2; // stereo output
audioFormat.mFramesPerPacket = 1;
audioFormat.mBitsPerChannel = sizeof(short) * 8; // 16-bit
audioFormat.mBytesPerFrame = audioFormat.mBitsPerChannel / 8 * audioFormat.mChannelsPerFrame;
audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
And I do the following code before starting the AU
Float32 preferredBufferSize = .005;
XThrowIfError(AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(preferredBufferSize), &preferredBufferSize), "couldn't set i/o buffer duration");
XThrowIfError(AudioSessionSetActive(true), "couldn't set audio session active\n");
Float32 currentBufferSize = 0.0f;
UInt32 size = sizeof(currentBufferSize);
XThrowIfError(AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration, &size, ¤tBufferSize), "couldn't get i/o buffer duration");
I see the currentBufferSize equal to the preferredBufferSize, but this doesn't seem to affect the inNumberFrames number in the callback.
I have tried adjusting the kAudioUnitProperty_MaximumFramesPerSlice value and the kAudioSessionProperty_PreferredHardwareIOBufferDuration value, but noting seems to make a difference.
inNumberFrames is always 512 no matter what I adjust.
Is there any way to adjust the number of frames in the callback struct?
Thanks.
Doug
_______________________________________________
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