Skip to content
Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)
Rust Makefile
Branch: master
Clone or download
jeremyletang update to last Rust
- impl trait Copy
Latest commit 14b6c0b Dec 14, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
res update to Cargo build system Jun 24, 2014
src update to last Rust Dec 14, 2014
.gitignore moar cargofication Oct 22, 2014
.travis.yml .travis.yml: cleanup Oct 22, 2014
Cargo.toml update cargo.toml infos Nov 18, 2014
LICENSE Initial commit Oct 8, 2013
Makefile fix travis Jun 24, 2014
README.md no longer `~` in the documentation Oct 22, 2014

README.md

ears Build Status

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

ears is build on the top of OpenAL and libsndfile.

  • Provides an access to the OpenAL spatialization functionality in a simple way.
  • Accepts 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() {}
}

Functionalities

ears provides two ways to play audio files.

  • The Sound class, which represents 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

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;
You can’t perform that action at this time.