The SDL library creates a new thread to process audio data. It is this  
thread that performs callbacks into the Lisp process to request audio  
data. Because the audio thead is unknown to the Lisp process, a hang or a  
crash results. Lispworks supports callbacks from foreign unknown threads  
so this is not an issue, but SBCL, ECL & CLISP do not. I'm not sure what  
the situation is under Linux & OS X.

One alternative is a wrapper that handles the callback, then copies the  
audio data to a global variable and sleeps until the buffer is filled by  
lispbuilder-sdl. lispbuilder-sdl reads a variable each game loop to  
determine if the audio buffer is empty, fills the buffer if necessary and  
then wakes up the glue library which then copies audio data from the  
global variable into the callback. A disadvantage is that audio will break  
up if the frame rate is too low and the audio buffer too small. 15 fps and  
above seems to work fine, but 10 fps is too slow.

I have written a glue library to do this (glue-lispbuilder-sdl.dll). It is  
Windows only at the momemnt. If someone can run MIXER-TEST & SQUASHED in  
OS X & Linux and let me know if these crash then I'll create the necessary  
makefile for the glue library.

This is now in SVN. The glue DLL is available from  
code.google.com/p/lispbuilder/downloads/list in the windows binary  
archive, win32-lispbuilder-sdl-binaries-1.2.12.tgz.

- Luke
_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to