• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: RemoteIO AU callback interval can not be changed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RemoteIO AU callback interval can not be changed?


  • Subject: Re: RemoteIO AU callback interval can not be changed?
  • From: Aran Mulholland <email@hidden>
  • Date: Wed, 11 Aug 2010 16:10:10 +1000

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

 _______________________________________________
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

References: 
 >Re: RemoteIO AU callback interval can not be changed? (From: email@hidden)

  • Prev by Date: Re: RemoteIO AU callback interval can not be changed?
  • Next by Date: Re: AudioQueueOfflineRender on the iPad
  • Previous by thread: Re: RemoteIO AU callback interval can not be changed?
  • Next by thread: Re: RemoteIO AU callback interval can not be changed?
  • Index(es):
    • Date
    • Thread