#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

#806 in Audio

Download history 36/week @ 2023-11-30 39/week @ 2023-12-07 59/week @ 2023-12-14 49/week @ 2023-12-21 21/week @ 2023-12-28 45/week @ 2024-01-04 87/week @ 2024-01-11 55/week @ 2024-01-18 44/week @ 2024-01-25 39/week @ 2024-02-01 50/week @ 2024-02-08 85/week @ 2024-02-15 109/week @ 2024-02-22 80/week @ 2024-02-29 103/week @ 2024-03-07 88/week @ 2024-03-14

394 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