13 stable releases
Uses old Rust 2015
3.0.4 | May 21, 2019 |
---|---|
3.0.3 | Aug 18, 2018 |
3.0.1 | Dec 21, 2017 |
3.0.0 | Jul 30, 2017 |
0.1.1 |
|
#843 in Audio
368 downloads per month
Used in 5 crates
(3 directly)
340KB
6.5K
SLoC
alto
alto
provides idiomatic Rust bindings for OpenAL 1.1
and extensions (including EFX).
WARNING
Because Alto interacts with global C state via dynamic linking, having multiple versions of Alto in one project could lead to unsafety. Please make sure only one version of Alto is in your dependency tree at any given time.
API Usage
let alto = Alto::load_default()?;
for s in alto.enumerate_outputs() {
println!("Found device: {}", s.to_str()?);
}
let device = alto.open(None)?; // Opens the default audio device
let context = device.new_context(None)?; // Creates a default context
// Configure listener
context.set_position([1.0, 4.0, 5.0]);
context.set_velocity([2.5, 0.0, 0.0]);
context.set_orientation(([0.0, 0.0, 1.0], [0.0, 1.0, 0.0]));
let source = context.new_static_source()?;
// Now you can load your samples and store them in a buffer with
// `context.new_buffer(samples, frequency)`;
lib.rs
:
Overview
Alto is an idiomatic wrapper for the OpenAL 3D audio API and associated extensions (including EFX). This documentation does not describe how to use the OpenAL API itself, but rather explains how it has been adapted for rust and provides the native symbols associated with each function so they can be cross-referenced with the official OpenAL documentation for full details.
The core of the API is the Alto
struct. It has no analog in raw OpenAL and
represents an implementation of the API itself. From there, instances of familiar OpenAL objects
can be instantiated.
WARNING
Because Alto interacts with global C state via dynamic linking, having multiple versions of Alto in one project could lead to unsafety. Please make sure only one version of Alto is in your dependency tree at any given time.
Dependencies
~0.8–1.5MB
~26K SLoC