#al #sound #open-al #extension #api-bindings

alto

Idiomatic interface for OpenAL 1.1 and extensions (including EFX)

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 Nov 3, 2016

#843 in Audio

Download history 92/week @ 2024-03-11 108/week @ 2024-03-18 113/week @ 2024-03-25 140/week @ 2024-04-01 79/week @ 2024-04-08 101/week @ 2024-04-15 96/week @ 2024-04-22 83/week @ 2024-04-29 102/week @ 2024-05-06 82/week @ 2024-05-13 73/week @ 2024-05-20 91/week @ 2024-05-27 82/week @ 2024-06-03 81/week @ 2024-06-10 90/week @ 2024-06-17 105/week @ 2024-06-24

368 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

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