You are looking at historical revision 26752 of this page. It may differ significantly from its current revision.

sdl-mixer

Introduction

This egg provides a schemely wrapper around the libsdl-mixer library. The original library documentation can be found at the libsdl website.

Author

Christian Kellermann

Requirements

sdl and its dependencies.

API

Overview

Opening and closing the audio device

[procedure] (open-audio #!key sampling-rate sample-format channels chunk-size)

Opens the audio device and initialises libsdl-mixer. Needs to be called at least once. It will close and reopen the device if it has been opened before.

The defaults for the keyword arguments are:

sampling-rate
22050
sample-format
AUDIO_S16SYS
channels
2
chunk-size
1024

Note: The sdl-init and mix-init procedures will be called only once.

[procedure] (close-audio)

Closes the audio device and shuts down the mixer library. No procedure should access libsdl-mixer or sdl audio procedures after calling close-audio.

Playing samples in channels

[procedure] (load-sample)
[procedure] (play-sample)
[procedure] (pause-channel)
[procedure] (resume-channel)
[procedure] (halt-channel)
[procedure] (channel-finished)
[procedure] (channel-playing?)
[procedure] (channel-paused?)

Playing music

[procedure] (load-music filename)

Loads a file filename and returns a music object. A condition is raised if the format of the file is not supported by libsdl-mixer.

[procedure] (play-music music #!key repeat fadein volume)
[procedure] (halt-music)
[procedure] (pause-music)
[procedure] (resume-music)
[procedure] (rewind-music)
[procedure] (music-finished)
[procedure] (music-type)
[procedure] (music-volume)
[procedure] (music-playing?)

Errors

The procedures in this extension raise a composite condition with the properties:

((exn message msg)
 (sdl)
 (mixer))

Example

License

The wrapper is licensed as LGPL as is the original libsdl-mixer.

Version history

0.1
dev release
0.2
bugfix to appease salmonella
0.3
callbacks added