#audio-playback #back-end

nightly ez_audio

🔊 A easy to use audio playback library

7 releases

0.1.6 Jun 6, 2021
0.1.5 May 5, 2021
0.1.4 Apr 7, 2021

#343 in Multimedia

32 downloads per month
Used in harmony-rs

MIT license

655KB
4.5K SLoC

C 4K SLoC // 0.2% comments Rust 416 SLoC C++ 174 SLoC // 0.1% comments

ez-audio

Crates.io Docs.rs License: MIT
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 {}

No runtime deps