lispgames / cl-sdl2-mixer

Bindings for SDL2_mixer
MIT License
12 stars 11 forks source link

cl-sdl2-mixer

This is a brief but usuable wrapper for SDL2_Mixer.

Usage

The following functions are currently available to the users

Examples

A simple example program has been provided. Ogg support is required to run it however. Press the space bar to play the sound effect/song, the up directional key to increase the volume by 20 and the down directional key to decrease the volume by 20. The current volume is displayed in standard-output.

Regenerating CFFI Bindings

This library uses cl-autowrap to generate CFFI bindings. If you need to regenerate the bindings, follow these steps:

  1. Delete the existing bindings:
$ rm -f src/spec/SDL_mixer.*.spec
  1. Reload the system in a REPL. This action will automatically regenerate the bindings:
${LISP-sbcl} \
    --load "sdl2-mixer.asd" \
    --eval "(ql:quickload '(:sdl2-mixer))" \
    --eval "(uiop:quit)"

In most cases, this process should work without issues. However, if you encounter problems (usually due to environment-specific factors like missing include headers), you can use the C_INCLUDE_PATH environment variable to specify additional include paths:

C_INCLUDE_PATH=/data1/include:/data1/lib/include \
    ${LISP-sbcl} \
        --load "sdl2-mixer.asd" \
        --eval "(ql:quickload '(:sdl2-mixer))" \
        --eval "(uiop:quit)"

This approach allows you to provide the necessary include paths without modifying the source code.

Issues

If you cannot load libSDL2_mixer, please ensure that you have SDL_mixer 2.0, installed and not just 1.2. If you receive errors concerning unknown file types, please ensure that libSDL2_mixer is linked against the appropriate sound library, e.g. libVorbis for ogg support. As of writing (05-31-2015) the SDL_mixer 2.0 provided by brew on OSX does not link libVorbis correctly, please build it from source.

If you are sure all of this is correct, and it still will not load, please file an issue and specify: