raylib/audio
src/raylib/audio.tur
defn
init-audio-device
(init-audio-device :void)
initialize the audio device and context.
Example
(init-audio-device)
Since: P3
defn
close-audio-device
(close-audio-device :void)
close the audio device and release resources.
Example
(close-audio-device)
Since: P3
defn
load-sound
(load-sound [path :cstr] :int)
load a sound effect from file into memory.
Parameters
| path | filesystem path to an audio file (WAV, OGG, MP3, FLAC, ...) |
Returns
Opaque :int handle to a heap-allocated Sound struct.
Example
(let [s (load-sound "explosion.wav")] ...)
Since: P3
defn
unload-sound
(unload-sound [sound :int] :void)
free a sound from memory.
Parameters
| sound | Sound handle from load-sound |
Example
(unload-sound s)
Since: P3
defn
play-sound
(play-sound [sound :int] :void)
play a sound effect from the beginning.
Parameters
| sound | Sound handle |
Example
(play-sound explosion)
Since: P3
defn
load-music-stream
(load-music-stream [path :cstr] :int)
load a music file for streaming playback.
Parameters
| path | filesystem path to an audio file |
Returns
Opaque :int handle to a heap-allocated Music struct.
Example
(let [bgm (load-music-stream "theme.ogg")] ...)
Since: P3
defn
unload-music-stream
(unload-music-stream [music :int] :void)
free a music stream from memory.
Parameters
| music | Music handle from load-music-stream |
Example
(unload-music-stream bgm)
Since: P3
defn
play-music-stream
(play-music-stream [music :int] :void)
start or resume streaming playback of a music file.
Parameters
| music | Music handle |
Example
(play-music-stream bgm)
Since: P3
defn
update-music-stream
(update-music-stream [music :int] :void)
refill the audio stream buffer; call once per frame.
Parameters
| music | Music handle |
Example
(update-music-stream bgm) ; inside the game loop
Since: P3