Crates.io | om-fork-miniaudio |
lib.rs | om-fork-miniaudio |
version | 0.12.1 |
source | src |
created_at | 2022-04-16 17:01:55.507847 |
updated_at | 2024-03-16 18:25:42.188497 |
description | Bindings to the miniaudio C library. Fork until upstream is updated! |
homepage | https://github.com/andreasOM/miniaudio-rs |
repository | https://github.com/andreasOM/miniaudio-rs |
max_upload_size | |
id | 569056 |
size | 210,528 |
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.
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. **
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
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");
}