Struct nitro::audio::Audio
[−]
[src]
pub struct Audio { pub playlist: Playlist, // some fields omitted }
Responsible for controlling audio playback in the game.
This structure makes 128 sound channels available to the user of this library. When member methods request a channel id that id must be between 0 and 127.
Fields
playlist: Playlist
Methods
impl Audio
[src]
fn play_sound(&mut self, path: &str, volume: f32) -> Result<(), String>
[src]
Plays a sound at a volume between 1.0 and 0.0
path is a filename relative to assets/sounds (assets\sounds on Windows)
fn play_sound_on_channel(
&mut self,
channel_id: i32,
path: &str
) -> Result<(), String>
[src]
&mut self,
channel_id: i32,
path: &str
) -> Result<(), String>
Play a sound on a user sound channel.
fn set_channel_volume(
&mut self,
channel_id: i32,
volume: f32
) -> Result<(), String>
[src]
&mut self,
channel_id: i32,
volume: f32
) -> Result<(), String>
Set the volume for a user sound channel. Volume is between 0.0 and 1.0
fn get_channel_volume(&self, channel_id: i32) -> Result<f32, String>
[src]
Get the volume for a user sound channel. Volume is between 0.0 and 1.0
fn pause_channel(&mut self, channel_id: i32) -> Result<(), String>
[src]
Pause audio output on a user sound channel.
fn resume_channel(&mut self, channel_id: i32) -> Result<(), String>
[src]
Resume paused audio output on a user sound channel.
fn channel_idle(&mut self, channel_id: i32) -> Option<bool>
[src]
Returns true if a channel is not playing anything. This will still return false if the channel has a sound to play but is paused.