Skip to content

Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)

License

Notifications You must be signed in to change notification settings

jeremyletang/ears

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published