Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

ExPixel/miniaudio-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
miniaudio-rs-bindgen
Dec 28, 2020
e001baa · Dec 28, 2020
Oct 11, 2020
Dec 28, 2020
Dec 28, 2020
Jul 5, 2020
Feb 25, 2020
Jul 23, 2020
Feb 26, 2020
Sep 1, 2020
Oct 11, 2020

Repository files navigation

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");
}