• 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
RemoteIO callback buffer length wonky on iphone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RemoteIO callback buffer length wonky on iphone


  • Subject: RemoteIO callback buffer length wonky on iphone
  • From: Doug McCoy <email@hidden>
  • Date: Mon, 12 Apr 2010 17:28:47 -0700

I am using the RemoteIO AudioUnit on iphone for live IO.

I have been setting this up with various sample rates and buffer sizes to tune my algorithm. For 44.1K and 22K, I get expected results for the number of frames in the callback IO buffer.

For 16K, I get strangeness.

My setup goes like this:

set kAudioSessionProperty_PreferredHardwareSampleRate  = 16K
set kAudioSessionProperty_PreferredHardwareIOBufferDuration  =  0.032 seconds (512 frames)
AudioSessionSetActive(true)
get kAudioSessionProperty_CurrentHardwareSampleRate  = 16K
get kAudioSessionProperty_CurrentHardwareIOBufferDuration  =  0.02322 seconds (371.52 frames, i round up to 372)

I then setup the remoteIO with:

            AudioStreamBasicDescription audioFormat;
            memset(&audioFormat, 0, sizeof(audioFormat));
            audioFormat.mSampleRate = 16000;    // FS
            audioFormat.mFormatID = kAudioFormatLinearPCM;
            audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
            audioFormat.mChannelsPerFrame = 1;           
            audioFormat.mFramesPerPacket = 1;
            audioFormat.mBitsPerChannel = sizeof(short) * 8;            // 16-bit
            audioFormat.mBytesPerFrame = audioFormat.mBitsPerChannel / 8  * audioFormat.mChannelsPerFrame;
            audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;

I enable input and the input output formats are identical.

My callback is declared as such:

static OSStatus    PerformThru(
                            void                        *inRefCon,
                            AudioUnitRenderActionFlags     *ioActionFlags,
                            const AudioTimeStamp         *inTimeStamp,
                            UInt32                         inBusNumber,
                            UInt32                         inNumberFrames,
                            AudioBufferList             *ioData)


For the first callback,

inNumberFrames == 372
 and
ioData->mBuffers[0].mDataByteSize == 372 * 2 (16bit samples, mono)

This is to be expected.

But subsequent callbacks have

inNumberFrames == 1 or 2
 and
ioData->mBuffers[0].mDataByteSize == 2 or 4 respectively



This discrepancy is causing havoc in my processing.

I notice the first case above will occur if the audio session changes and the remoteIO AU is re-created and started anew, but it quickly reverts to the latter bad case.

For 44.1k and 22K the callback buffers are all at the expected size. For 16K the buffer length is not consistent.

Is there a know issue with this?



---
Check out my new iPhone app, FlipTalk. Once featured on the iTunes App Store "What's Hot" list!
http://fliptalkapp.com
http://itunes.com/apps/FlipTalk/
http://tinyurl.com/FlipTalkYoutube



 _______________________________________________
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

  • Follow-Ups:
    • Re: RemoteIO callback buffer length wonky on iphone
      • From: Chris Adamson <email@hidden>
    • Re: RemoteIO callback buffer length wonky on iphone
      • From: William Stewart <email@hidden>
  • Prev by Date: Re: iPad no Analog/Audio input, What are the options?
  • Next by Date: Re: iPad no Analog/Audio input, What are the options?
  • Previous by thread: Re: AudioUnit kAudioUnitProperty_ClassInfo and UI update
  • Next by thread: Re: RemoteIO callback buffer length wonky on iphone
  • Index(es):
    • Date
    • Thread