Re: Buffer overrun management with TPCircularBuffer.. best way to do so?
Re: Buffer overrun management with TPCircularBuffer.. best way to do so?
- Subject: Re: Buffer overrun management with TPCircularBuffer.. best way to do so?
- From: Douglas Carmichael <email@hidden>
- Date: Thu, 01 May 2014 10:55:58 -0500
Kevin:
Thanks for the advice!
Currently, I’m not using two threads, but have the buffer reading in my rendering callback.
If I uncomment the second xmp_play_frame/TPCircularBufferProduceBytes bit after the usleep in the playback loop, I do get coherently-sounding audio. But, it plays faster than usual and it has crackle/pop sounds as well.
If I comment it out, I get one frame of ‘good’ audio, but then smaller fragments get sent to the callback: 2014-05-01 10:54:48.189 xmpAUTest-badLoop[38221:12c0b] Outputting zeroes. 2004 bytes available, 2048 bytes expected. 2014-05-01 10:55:26.590 xmpAUTest-badLoop[38234:12c0b] Outputting zeroes. 1720 bytes available, 2048 bytes expected.
Would there be any way to tell the callback to ‘sleep’, so to speak? Any ideas on how I can improve what I have?
Thanks in advance!
—Douglas On Apr 30, 2014, at 7:07 PM, Kevin Dixon < email@hidden> wrote: Do "length" - "fillCount" to see how much space is available. If this is less than your threshold, cause the producer thread to sleep until the buffer is sufficiently drained.
-Kevin
|
_______________________________________________
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