branarm / ears

Easy Api in Rust to play Sounds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ears Build Status

ears is a simple library for play Sounds and Musics in Rust.

ears is build on the top of OpenAL and libsndfile.

  • Provide anaccess to the OpenAL spatialization functionality in a simple way.
  • Accept a lot of audio formats thanks to libsndfile.

A simple example

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() {}
}

Functionnality

ears provide two way for play audio files.

  • The Sound class, which represent light sounds who can share a buffer of samples with another Sound.
  • The Music class, which is a bigger sound and who can't share sample buffer.

Use ears

As said before, ears require OpenAL and libsndfile, you need to install these two librarieson 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 build ears, the 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;

About

Easy Api in Rust to play Sounds

License:MIT License


Languages

Language:Rust 100.0%