#sound #pcm

miniaudio

Bindings to the miniaudio C library

11 releases (7 breaking)

0.10.0 Jul 23, 2020
0.8.1 Jul 21, 2020

#23 in #pcm

Download history 8/week @ 2024-08-31 7/week @ 2024-09-07 7/week @ 2024-09-14 24/week @ 2024-09-21 14/week @ 2024-09-28 3/week @ 2024-10-05 6/week @ 2024-10-12 7/week @ 2024-10-19 7/week @ 2024-10-26 9/week @ 2024-11-02 2/week @ 2024-11-09 2/week @ 2024-11-16 9/week @ 2024-11-23 9/week @ 2024-11-30 21/week @ 2024-12-07 21/week @ 2024-12-14

61 downloads per month
Used in 2 crates

MIT license

3MB
58K SLoC

C 52K SLoC // 0.1% comments Rust 5.5K SLoC // 0.0% 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

If the bindgen feature is turned off:
Then you shouldn't need to do anything special, the bindings should just work. If they don't please open an issue.

If the bindgen feature is turned on:
LLVM must be installed in order to generate the bindings, but aside from that everything should just work. Feel free to open an issue here if that is not the case.

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

~0–2.3MB
~46K SLoC