#miniaudio #sound #pcm

om-fork-miniaudio

Bindings to the miniaudio C library. Fork until upstream is updated!

2 unstable releases

0.12.0 Dec 6, 2022
0.11.0 Apr 16, 2022

#403 in Audio

Download history 4/week @ 2023-06-11 32/week @ 2023-06-18 21/week @ 2023-06-25 15/week @ 2023-07-02 12/week @ 2023-07-09 14/week @ 2023-07-16 15/week @ 2023-07-23 10/week @ 2023-07-30 17/week @ 2023-08-06 25/week @ 2023-08-13 7/week @ 2023-08-20 12/week @ 2023-08-27 19/week @ 2023-09-03 18/week @ 2023-09-10 12/week @ 2023-09-17 6/week @ 2023-09-24

55 downloads per month

MIT license

5.5MB
148K SLoC

Rust 87K SLoC // 0.0% comments C 61K SLoC // 0.0% comments

Mini Audio Rust Bindings

Note: The upstream version is currently broken due to an outdated cbindgen dependency. This is a workaround until upstream is fixed. A pull request has been made.

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