[SDL] sound latency

David Olofson david.olofson at reologica.se
Mon Jul 1 09:36:01 PDT 2002


On Sun, 30/06/2002 12:12:12 , Loren Osborn <linux_dr at yahoo.com> wrote:
[...]
>Hmm... I Just though of something that might greatly
>improve latency (if it's doable).  The program
>generally knows when it needs to add a new sound to
>the mix.  If at this time, would it be possible for
>the program to signal SDL of this, so that SDL could
>EXPIRE the REMAINDER of the current buffer (minus a
>few micro-seconds to allow time for the remix).  That
>way the sound mix callback (or possibly a new special
>purpose callback) would be re-called to mix the new
>sound into the sound buffer with practically zero
>latency.  (Sound is not my forte, so this might not be
>possible, but I it seems like a perfectly reasonable
>idea.)

This is pretty much how "shared memory zero latency mixing" works, although there are more efficient ways to do it than to entirely ditch and rerender the "future" part of the buffer. (That can become *very* expensive...)

All you need to do is mix the new audio over the data already in the buffer.


//David


.---------------------------------------
| David Olofson
| Programmer
| david.olofson at reologica.se
|---------------------------------------
| Address:
| REOLOGICA Instruments AB
| Scheelevägen 30
| 223 63 LUND
| Sweden
|---------------------------------------
| Phone: 046-12 77 60
| Fax: 046-12 50 57
| Mobil: 
| E-mail: david.olofson at reologica.se
| WWW: http://www.reologica.se
| 
`-----> We Make Rheology Real





More information about the SDL mailing list