stdlib/audioView source ↗
audio
36 items · generated by scribe fromstdlib/audio.fd· synced 2026-11-15
Contents
- AUDIO_NO_CHANNEL: (const)
- audio_init (function)
- audio_shutdown (function)
- audio_load (function)
- audio_play (function)
- audio_play_full (function)
- audio_stop (function)
- audio_stop_all (function)
- audio_pause (function)
- audio_resume (function)
- audio_set_volume (function)
- audio_set_loop (function)
- audio_set_pan (function)
- audio_is_playing (function)
- audio_master_volume (function)
- AudioState (struct)
- audio_state_create (function)
- audio_state_set_volume (function)
- audio_state_toggle_mute (function)
- audio_state_play_music (function)
- audio_state_stop_music (function)
- audio_state_play_sfx (function)
- audio_state_cleanup_sfx (function)
AUDIO_NO_CHANNEL:
pub const AUDIO_NO_CHANNEL: i64 = - 1; pub const AUDIO_MAX_CHANNELS: i64 = 32;Defined at line 24
audio_init
Initialize the audio system. Returns 0 on success, -1 on failure.
pub fn audio_init() -> i64 {Returns: i64
Defined at line 51
audio_shutdown
Shut down the audio system and free all resources.
pub fn audio_shutdown() -> void {Returns: void
Defined at line 56
audio_load
Load a sound file. Returns a sound handle (>0) on success, -1 on failure.
pub fn audio_load(path: str) -> i64 {Parameters:
path:str
Returns: i64
Defined at line 63
audio_play
Play a sound at the given volume (0.0 to 1.0). Returns a channel handle.
pub fn audio_play(sound: i64, volume: f64) -> i64 {Parameters:
sound:i64volume:f64
Returns: i64
Defined at line 70
audio_play_full
Play a sound at full volume. Returns a channel handle.
pub fn audio_play_full(sound: i64) -> i64 {Parameters:
sound:i64
Returns: i64
Defined at line 75
audio_stop
Stop a playing sound channel.
pub fn audio_stop(channel: i64) -> void {Parameters:
channel:i64
Returns: void
Defined at line 80
audio_stop_all
Stop all playing sounds.
pub fn audio_stop_all() -> void {Returns: void
Defined at line 85
audio_pause
Pause a channel (can be resumed with audio_resume).
pub fn audio_pause(channel: i64) -> void {Parameters:
channel:i64
Returns: void
Defined at line 90
audio_resume
Resume a paused channel.
pub fn audio_resume(channel: i64) -> void {Parameters:
channel:i64
Returns: void
Defined at line 95
audio_set_volume
Set the volume of a channel (0.0 to 1.0).
pub fn audio_set_volume(channel: i64, volume: f64) -> void {Parameters:
channel:i64volume:f64
Returns: void
Defined at line 102
audio_set_loop
Set whether a channel loops (restarts when finished).
pub fn audio_set_loop(channel: i64, looping: bool) -> void {Parameters:
channel:i64looping:bool
Returns: void
Defined at line 107
audio_set_pan
Set the stereo pan of a channel (-1.0 = left, 0.0 = center, 1.0 = right).
pub fn audio_set_pan(channel: i64, pan: f64) -> void {Parameters:
channel:i64pan:f64
Returns: void
Defined at line 116
audio_is_playing
Check if a channel is still playing. Returns true if playing.
pub fn audio_is_playing(channel: i64) -> bool {Parameters:
channel:i64
Returns: bool
Defined at line 121
audio_master_volume
Set the master volume (affects all channels). 0.0 to 1.0.
pub fn audio_master_volume(volume: f64) -> void {Parameters:
volume:f64
Returns: void
Defined at line 128
AudioState
pub struct AudioState {Fields:
| Name | Type |
|---|---|
master_vol | f64 |
muted | bool |
music_channel | i64 |
sfx_channels | Vec<i64> |
Defined at line 138
audio_state_create
Create an audio state tracker.
pub fn audio_state_create() -> AudioState {Returns: AudioState
Defined at line 147
audio_state_set_volume
Set master volume through the state tracker (respects mute).
pub fn audio_state_set_volume(state: & mut AudioState, vol: f64) -> void {Parameters:
state:& mut AudioStatevol:f64
Returns: void
Defined at line 154
audio_state_toggle_mute
Toggle mute. Returns the new mute state.
pub fn audio_state_toggle_mute(state: & mut AudioState) -> bool {Parameters:
state:& mut AudioState
Returns: bool
Defined at line 162
audio_state_play_music
Play music (loops). Stops any previous music.
pub fn audio_state_play_music(state: & mut AudioState, sound: i64) -> void {Parameters:
state:& mut AudioStatesound:i64
Returns: void
Defined at line 173
audio_state_stop_music
Stop music.
pub fn audio_state_stop_music(state: & mut AudioState) -> void {Parameters:
state:& mut AudioState
Returns: void
Defined at line 182
audio_state_play_sfx
Play a sound effect and track the channel.
pub fn audio_state_play_sfx(state: & mut AudioState, sound: i64, volume: f64) -> i64 {Parameters:
state:& mut AudioStatesound:i64volume:f64
Returns: i64
Defined at line 190
audio_state_cleanup_sfx
Clean up finished SFX channels from the tracking list.
pub fn audio_state_cleanup_sfx(state: & mut AudioState) -> void {Parameters:
state:& mut AudioState
Returns: void
Defined at line 199
Generated by scribe, the Fides documentation generator