Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JeremyLetang/ears
Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)
https://github.com/JeremyLetang/ears
Last synced: about 1 month ago
JSON representation
Easy Api in Rust to play Sounds (this repository is not maintained anymore, please see https://github.com/jhasse/ears)
- Host: GitHub
- URL: https://github.com/JeremyLetang/ears
- Owner: jeremyletang
- License: mit
- Created: 2013-10-08T14:16:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-10-21T17:03:29.000Z (about 6 years ago)
- Last Synced: 2024-10-31T19:41:50.963Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 1.68 MB
- Stars: 60
- Watchers: 5
- Forks: 25
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust - JeremyLetang/ears - ci.org/jeremyletang/ears.svg?branch=master">](https://travis-ci.org/JeremyLetang/ears) (代码 / 音频)
README
# ears [![Build Status](https://travis-ci.org/jeremyletang/ears.png?branch=master)](https://travis-ci.org/jeremyletang/ears)
__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
```Rust
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:
```Shell
> make ears
> make examples
> make doc
```then import stuff from __ears__ in your project, you can import all the stuff:
```Rust
#[feature(globs)];
extern crate ears;use ears::*;
```or a specific one:
```Rust
extern crate ears;use ears::Music;
```