7 releases
0.1.6 | Jun 6, 2021 |
---|---|
0.1.5 | May 5, 2021 |
0.1.4 | Apr 7, 2021 |
#988 in Audio
32 downloads per month
Used in harmony-rs
655KB
4.5K
SLoC
ez-audio
ez-audio is a easy to use audio playback library that uses the C library miniaudio as a backend.
Currently only compiles on nightly and a C++ compiler is required as it depends on the cc crate.
Supported Codecs
- MP3
- WAV
- Vorbis
- Flac
Examples
Minimal
let context = Context::new().unwrap();
let mut clip = AudioLoader::new("audio.mp3", context.clone())
.load()
.unwrap();
clip.play();
// loop forever to stop handle from being dropped
loop {}
lib.rs
:
ez-audio is a easy to use audio playback library that uses the C library miniaudio as a backend.
Examples
Minimal
let context = Context::new().unwrap();
let mut clip = AudioLoader::new("audio.mp3", context.clone())
.load()
.unwrap();
clip.play();
loop {}
With on end
let context = Context::new().unwrap();
let mut clip = AudioLoader::new("audio.mp3", context.clone())
.user_data(10)
.on_end(|data| {
assert!(data == 10)
})
.load()
.unwrap();
clip.play();
loop {}