Re: RemoteIO AU callback interval can not be changed?
Re: RemoteIO AU callback interval can not be changed?
- Subject: Re: RemoteIO AU callback interval can not be changed?
- From: email@hidden
- Date: Wed, 11 Aug 2010 07:13:41 -0700 (PDT)
Aran, you are right I was only doing it on simulator. On device, setting the
buffer size does take effect. It is still not exactly on the 50 ms mark as I
hoped for but I guess I'll just have to live with that. Thanks a lot.
________________________________
From: Aran Mulholland <email@hidden>
To: email@hidden
Cc: email@hidden
Sent: Tue, August 10, 2010 11:10:10 PM
Subject: Re: RemoteIO AU callback interval can not be changed?
The callback is executed when core audio needs more data. Why do you want it
called every 50 msec?
If you wish to only analyse every 50 msec you could just count samples and
ignore the rest.
One final point, I have found that the buffer size property is ignored on the
simulator, is this where you are testing? If so try it on the device.
On Wed, Aug 11, 2010 at 3:57 PM, <email@hidden> wrote:
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