Struct ears::Music [] [src]

pub struct Music {
    // some fields omitted
}

Play Music easily.

Simple class to play music easily in 2 lines.

Music is played in their own task and the samples are loaded progressively using circular buffers. They aren't associated to a SoundData like Sounds.

Examples

extern crate ears;
use ears::{Music, AudioController};

fn main() -> () {
  let mut msc = Music::new("path/to/music.flac").unwrap();
  msc.play();
}

Methods

impl Music

fn new(path: &str) -> Option<Music>

Create a new Music

Argument

  • path - The path of the file to load the music

Return

An Option containing Some(Music) on success, None otherwise

Trait Implementations

impl AudioTags for Music

fn get_tags(&self) -> Tags

impl AudioController for Music

fn play(&mut self)

fn pause(&mut self)

fn stop(&mut self)

fn is_playing(&self) -> bool

fn get_state(&self) -> State

fn set_volume(&mut self, volume: f32)

fn get_volume(&self) -> f32

fn set_min_volume(&mut self, min_volume: f32)

fn get_min_volume(&self) -> f32

fn set_max_volume(&mut self, max_volume: f32)

fn get_max_volume(&self) -> f32

fn set_looping(&mut self, looping: bool)

fn is_looping(&self) -> bool

fn set_pitch(&mut self, pitch: f32)

fn get_pitch(&self) -> f32

fn set_relative(&mut self, relative: bool)

fn is_relative(&mut self) -> bool

fn set_position(&mut self, position: [f32; 3])

fn get_position(&self) -> [f32; 3]

fn set_direction(&mut self, direction: [f32; 3])

fn get_direction(&self) -> [f32; 3]

fn set_max_distance(&mut self, max_distance: f32)

fn get_max_distance(&self) -> f32

fn set_reference_distance(&mut self, ref_distance: f32)

fn get_reference_distance(&self) -> f32

fn set_attenuation(&mut self, attenuation: f32)

fn get_attenuation(&self) -> f32

impl Drop for Music

fn drop(&mut self)