Re: buffering madlib samples
Rob Leslie <[email protected]> Mon, 5 Sep 2005 13:03:47 -0700
| Newsgroups | gmane.comp.audio.mad.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sep 5, 2005, at 12:18 AM, Swapnil Wagle wrote: > I am trying to play the converted PCM samples from Madlib on > PalmOS..But the speed at which Madlib decodes the samples is too > high.I am not able to buffer all the samples at one time whicih > results in buffer overlapping.I wanted to know whether it is > possible to make the Madlib libarary wait for a while till all the > current samples have been played. This is up to you. If you don't want libmad to process more samples, then don't call a low-level API routine or return from a high-level callback until you're ready. There are examples of this in madplay for Mac and Windows systems in audio_carbon.c and audio_win32.c, respectively: they each make use of a synchronization object (a semaphore) to wait for an available output PCM buffer. When the system finishes playing a buffer, it runs a callback in separate thread which releases the semaphore. -- Rob Leslie [email protected]