gen_tone_raw! : { freq : F32, ms : I32 } => U64
Raw hosted effects: the host deals only in scalar handles. Public helpers wrap successful handles in Box values.
:= []
Audio module - sound and music playback for the Roc raylib platform.
Sound and Music are refcounted Box handles to host-owned audio
resources. Load or generate them once (e.g. in init!), keep the handles in
your model, then play them on game events. Box memory is released by Roc's
refcounting when the last copy is dropped. The underlying raylib resources
are freed by the host at shutdown.
gen_tone_raw! : { freq : F32, ms : I32 } => U64
Raw hosted effects: the host deals only in scalar handles. Public helpers wrap successful handles in Box values.
gen_sound_raw! : GenSoundRaw => U64
load_sound_raw! : Str => U64
load_music_raw! : Str => U64
set_volume_raw! : U64, F32 => { }
set_pitch_raw! : U64, F32 => { }
set_pan_raw! : U64, F32 => { }
play_music_raw! : U64 => { }
stop_music_raw! : U64 => { }
pause_music_raw! : U64 => { }
resume_music_raw! : U64 => { }
set_music_volume_raw! : U64, F32 => { }
set_music_pitch_raw! : U64, F32 => { }
set_music_pan_raw! : U64, F32 => { }
set_music_looping_raw! : U64, Bool => { }
waveform_code : Waveform -> U8
raw_config : GenSound -> GenSoundRaw
sound_from_handle : U64 -> Try(Sound, [SoundLoadFailed, ..])
music_from_handle : U64 -> Try(Music, [MusicLoadFailed, ..])
load_sound! : Str => Try(Sound, [SoundLoadFailed, ..])
Load a short sound effect from disk.
load_music! : Str => Try(Music, [MusicLoadFailed, ..])
Load a streaming music file from disk. The host updates loaded streams automatically each frame.
gen_sound! : GenSound => Sound
Generate a short procedural sound and return a handle to it. Call this sparingly - e.g. once at startup - and reuse the handle.
Generate a short sine tone and return a handle to it.
freq is the pitch in Hz; ms is the duration in milliseconds
(clamped by the host to a small maximum). Call this sparingly - e.g.
once at startup - and reuse the handle, rather than per frame.
play! : Sound => { }
Play a previously generated sound.
set_volume! : Sound, F32 => { }
Set playback volume for a sound. The host clamps volume to [0, 1].
set_pitch! : Sound, F32 => { }
Set playback pitch for a sound. The host clamps pitch to a positive range.
Set playback pan for a sound. The host clamps pan to [-1, 1].
play_music! : Music => { }
stop_music! : Music => { }
pause_music! : Music => { }
resume_music! : Music => { }
set_music_volume! : Music, F32 => { }
set_music_pitch! : Music, F32 => { }
set_music_pan! : Music, F32 => { }
set_music_looping! : Music, Bool => { }
A handle to a host-owned sound.
A handle to a host-owned streaming music resource.
:= [Sine, Square, Triangle, Saw, Noise]