[cffi-devel] (no subject)

Luke Crook luke at balooga.com
Tue Dec 22 16:34:16 UTC 2009


If the glue library is available then *lispbuilder-sdl-audio* is added
to *features*. If *lispbuilder-sdl-audio* is not available then you
have to use lispbuilder-sdl-mixer for sound. Right now the sdl-glue
library has been built for Windows only. I still have to create a
makefile for linux.

The glue library wraps the SDL audio callback thread. The main SDL
process creates a helper thread to handle audio which performs a
callback when the audio buffer needs to be filled. This new audio
thread is 'unknown' to the Lisp environment (Lisp knows about the SDL
process, but not any threads SDL creates). Thus when this 'unknown'
audio thread performs the callback into the Lisp process, the Lisp
process will most likely crash.

The sdl-glue library wraps the audio part of SDL so that the audio
thread calls back into the glue library and not the Lisp process.
During each iteration of the game loop the Lisp process asks sdl-glue
if the audio buffer is empty, writing audio data into an internal
sdl-glue bufffer if necessary. sdl-glue copies audio data from its
internal buffer into the SDL audio buffer during the audio callback.

It seems that Lispworks and Corman Lisp are OK handling 'unknown'
threads. But SBCL and CLISP will crash, hence the need for this glue
library.

- Luke

On Tue, Dec 22, 2009 at 7:27 AM, Stelian Ionescu <sionescu at cddr.org> wrote:
> I have
>
> (cffi:define-foreign-library sdl-glue
>  (:windows "lispbuilder-sdl-glue.dll"))
>
> (use-foreign-library sdl-glue)
>
> On Linux, this returns fine, although it doesn't load any library.
> I see code in lispbuilder-sdl that relies on it signaling an error.
> Is it a regression ?
>
> --
> Stelian Ionescu a.k.a. fe[nl]ix
> Quidquid latine dictum sit, altum videtur.
> http://common-lisp.net/project/iolib
>
>
> _______________________________________________
> cffi-devel mailing list
> cffi-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
>




More information about the cffi-devel mailing list