• 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: Audio glitches during playback thru Remote IO unit (iPhone)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio glitches during playback thru Remote IO unit (iPhone)


  • Subject: Re: Audio glitches during playback thru Remote IO unit (iPhone)
  • From: Steven Winston <email@hidden>
  • Date: Wed, 12 Aug 2009 10:36:05 -0700

The trick with RemoteIO's render function is to remember that timing
is everything.  You MUST keep the buffer full and read ahead of when
you need it.  You can change the rate at which the render function is
called, but in general plan for every 40ms having enough data to fill
the buffer.  To avoid glitches, the render function should do nothing
more than memcpy out the buffer you want.  Avoid doing any processing
in the render function like the plague.  I saw an example RemoteIO
implementation that reads and plays a wav file.  I think it's here:
http://sites.google.com/site/iphonecoreaudiodevelopment/home

best of luck!

Steve

On Wed, Aug 12, 2009 at 7:59 AM, Zhiye (Sterling)
Li<email@hidden> wrote:
> Hi Tahome,
>
> Thanks for your reply. I made a NSThread method where I use the
> AudioFileReadPackets() to read data to a double buffered queue, and now in
> the playback callback function it only calls the thread method when the
> buffer needs to be updated.
>
> It's my thread method:
>
> // File Reader thread
> -(void)readData  {
>
>     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>
>    // Double buffer stuff.
>
>    // Read file.
>     AudioFileReadPackets ( )
>
>     [pool release];
> }
>
> However, it didn't sound much better. I've also changed the thread priority
> number for both the render thread and the file reader thread that I made, it
> happened that the results were a little bit different, but it's just the
> matter of more glitches or less. So maybe there is a better way to do the
> file reader thread? Do you or anyone have any reader thread example that I
> can learn from?
>
> Thanks!
>
> Zhiye
>
>
>
>
>
>
>
> On Wed, Aug 12, 2009 at 2:02 AM, tahome izwah <email@hidden> wrote:
>>
>> I think it is discouraged to do synchronous reads within a render
>> callback. You should have a separate reader thread and queue up your
>> audio buffers in memory until they are needed for playback.
>>
>> --th
>>  _______________________________________________
>> 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
>
 _______________________________________________
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: 
 >Audio glitches during playback thru Remote IO unit (iPhone) (From: "Zhiye (Sterling) Li" <email@hidden>)
 >Re: Audio glitches during playback thru Remote IO unit (iPhone) (From: tahome izwah <email@hidden>)
 >Re: Audio glitches during playback thru Remote IO unit (iPhone) (From: "Zhiye (Sterling) Li" <email@hidden>)

  • Prev by Date: Re: audio processing iphone
  • Next by Date: AU View with Trolltech/Nokias Qt?
  • Previous by thread: Re: Audio glitches during playback thru Remote IO unit (iPhone)
  • Next by thread: Re: Audio glitches during playback thru Remote IO unit (iPhone)
  • Index(es):
    • Date
    • Thread