Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)
MIT License
ears is a simple library to play Sounds and Musics in Rust.
ears is build on the top of OpenAL and libsndfile.
extern crate ears;
use ears::Sound;
fn main() {
// Create a new Sound.
let snd = Sound::new("path/to/my/sound.ogg").unwrap();
// Play the Sound
snd.play();
// Wait until the end of the sound
while snd.is_playing() {}
}
ears provides two ways to play audio files.
Like previously said, ears requires OpenAL and libsndfile. You need to install these two libraries on your system.
ears compiles against the last Rust compiler, so if it doesn't work on your computer you may need to update your compiler.
ears is built using make, so just type make
at the root of the ears repository, this command
builds ears, examples and the documentation.
You can build them separately too with the dedicated commands:
> make ears
> make examples
> make doc
then import stuff from ears in your project, you can import all the stuff:
#[feature(globs)];
extern crate ears;
use ears::*;
or a specific one:
extern crate ears;
use ears::Music;