#android #aaudio #audio #dlsym #dynamiclinking

aloe-oboe-audio-loader

Aloe-Oboe-Audio-Loader provides dynamic runtime linking for Android's AAudio API facilitating high-performance audio stream management and manipulation in Rust. This crate is a translation of the c++ juce module serving the same function.

1 unstable release

Uses new Rust 2024

new 0.1.1 Apr 3, 2025

#4 in #aaudio


Used in 2 crates

GPL-3.0 license

245KB
1K SLoC

Aloe-Oboe-Audio-Loader

Overview

Aloe-Oboe-Audio-Loader is a Rust crate designed to dynamically interface with the AAudio API, a robust audio engine introduced in Android, optimizing high-performance audio tasks. This crate facilitates seamless access to audio streams by dynamically linking functions at runtime, therefore maintaining compatibility across Android versions where AAudio API support varies.

Functional Capabilities

The library aggregates function signatures and dynamically resolves them to interface with the AAudio library. Core functionalities include:

  • AAudioStreamBuilder: Methods to set parameters such as sample rate, channel count, device ID, buffer size, etc.
  • AAudioStream: Accessors for stream formats, reads, writes, buffer management, state queries, and more.
  • Dynamic Linking: Employs dlsym() to dynamically resolve function addresses, ensuring backward compatibility by safely handling failures in older Android versions.
  • Singleton Pattern: Utilizes a singleton pattern to encapsulate the loader's state, maintaining a single instance of the library handle.

Key Features

  • High-level Abstraction: Provides a platform-agnostic interface for AAudio API function calls.
  • Backward Compatibility: Graceful degradation for systems lacking AAudio by failing the linkage safely.
  • Efficient Resource Management: Prevents resource leaks through singleton and appropriate loader cleanup.

Usage

Example

use aloe_oboe_audio_loader::OboeAAudioLoader;

let mut loader = OboeAAudioLoader::get_instance();
if loader.open() == 0 {
    // Successfully opened AAudio library and initialized function pointers.
    // Stream setup and management code goes here.
}

For more detailed API usage, refer to the documentation.

Repository

The crate is hosted and actively maintained on GitHub.

License

Aloe-Oboe-Audio-Loader is distributed under the GPL-3.0 license.

This README.md file was generated by an AI model and may not be 100% accurate. However, it should be pretty informative.

This crate is a translation of the JUCE module.

JUCE is a c++ software framework for developing high performance audio applications.

Usage falls under the GPLv3 as well as the JUCE commercial license.

See github.com/juce-framework/JUCE and the JUCE license page for details.

This crate is in the process of being translated from c++ to rust. For progress updates, please see the workspacer rust project. designed specifically for rust projects.

Dependencies

~39MB
~626K SLoC