#audio #sound #pcm #miniaudio

sys ep-miniaudio-sys

Raw bindings to the miniaudio C library

11 stable releases

2.4.0 Jul 23, 2020
2.3.1 Jul 21, 2020
1.2.0 Jun 29, 2020
1.1.3 Apr 20, 2020
0.1.0 Apr 4, 2020

#15 in #pcm

Download history 7/week @ 2021-10-06 19/week @ 2021-10-13 10/week @ 2021-10-20 6/week @ 2021-10-27 22/week @ 2021-11-03 2/week @ 2021-11-10 5/week @ 2021-11-17 7/week @ 2021-11-24 22/week @ 2021-12-01 27/week @ 2021-12-08 9/week @ 2021-12-15 6/week @ 2021-12-22 10/week @ 2021-12-29 9/week @ 2022-01-05 33/week @ 2022-01-12 21/week @ 2022-01-19

74 downloads per month
Used in 3 crates (via miniaudio)

MIT license

2.5MB
59K SLoC

C 59K SLoC // 0.0% comments Rust 344 SLoC // 0.1% comments

Mini Audio Rust Bindings

Build Status crates.io docs.rs

Bindings to https://github.com/dr-soft/miniaudio

** The crate currently lacks documentation, but for the most part the API is very close the the API of the miniaudio C library. That can be found in the C library's main header file. **

Building

LLVM and clang must be installed in order to generate the bindings. Installation instructions can be found here: https://rust-lang.github.io/rust-bindgen/requirements.html

Example Usage

For more examples, check out the examples directory.

//! Enumerating Devices

use miniaudio::Context;

pub fn main() {
    let context = Context::new(&[], None).expect("failed to create context");

    context
        .with_devices(|playback_devices, capture_devices| {
            println!("Playback Devices:");
            for (idx, device) in playback_devices.iter().enumerate() {
                println!("\t{}: {}", idx, device.name());
            }

            println!("Capture Devices:");
            for (idx, device) in capture_devices.iter().enumerate() {
                println!("\t{}: {}", idx, device.name());
            }
        })
        .expect("failed to get devices");
}

Dependencies