#sound #steinberg

sys asio-sys

Low-level interface and binding generation for the steinberg ASIO SDK

6 releases

new 0.2.4 Dec 20, 2025
0.2.3 Dec 12, 2025
0.2.2 Mar 5, 2024
0.2.1 Nov 13, 2022
0.1.0 Jul 5, 2019

#662 in Audio

Download history 5915/week @ 2025-08-27 8022/week @ 2025-09-03 5651/week @ 2025-09-10 7212/week @ 2025-09-17 8818/week @ 2025-09-24 4961/week @ 2025-10-01 5839/week @ 2025-10-08 6095/week @ 2025-10-15 8657/week @ 2025-10-22 6094/week @ 2025-10-29 6024/week @ 2025-11-05 5914/week @ 2025-11-12 10153/week @ 2025-11-19 11500/week @ 2025-11-26 5448/week @ 2025-12-03 5048/week @ 2025-12-10

33,264 downloads per month
Used in 13 crates (2 directly)

Apache-2.0

82KB
1.5K SLoC

asio-sys

Crates.io Documentation License

Low-level Rust bindings for the Steinberg ASIO SDK.

ASIO (Audio Stream Input/Output) is a low-latency audio API for Windows that provides direct hardware access, bypassing the Windows audio stack for minimal latency.

Overview

asio-sys provides raw FFI bindings to the ASIO SDK, automatically generated using bindgen. This crate is used by cpal's ASIO backend to provide low-latency audio on Windows.

Note: Most users should use cpal's safe, cross-platform API rather than using asio-sys directly.

Features

  • Automatic binding generation from ASIO SDK headers
  • Low-level access to ASIO driver functionality
  • Support for both MSVC and MinGW toolchains
  • Automated ASIO SDK download and setup during build

Requirements

Windows

  • LLVM/Clang: Required for bindgen to generate bindings
  • ASIO SDK: Automatically downloaded during build from Steinberg
    • Or set CPAL_ASIO_DIR environment variable to point to a local SDK

Build Dependencies

  • bindgen - Generates Rust bindings from C/C++ headers
  • cc - Compiles the ASIO SDK C++ files
  • walkdir - Finds SDK files

Usage

Add to your Cargo.toml:

[dependencies]
asio-sys = "0.2"

Example

use asio_sys as sys;

fn main() {
    // Load ASIO driver
    let driver_name = "ASIO4ALL v2"; // Your ASIO driver name

    unsafe {
        // Initialize ASIO
        let drivers = sys::get_driver_names();
        println!("Available drivers: {drivers:?}");

        // Load a driver
        match sys::load_asio_driver(driver_name) {
            Ok(driver) => println!("Loaded driver: {driver_name}"),
            Err(e) => eprintln!("Failed to load driver: {e:?}"),
        }
    }
}

Environment Variables

  • CPAL_ASIO_DIR: Path to ASIO SDK directory (optional)
    • If not set, the SDK is automatically downloaded during build
    • Example: set CPAL_ASIO_DIR=C:\path\to\asiosdk

Platform Support

  • Windows (MSVC and MinGW)
    • x86_64 (64-bit)
    • i686 (32-bit)

ASIO is Windows-only. This crate will not build on other platforms.

Safety

This crate provides raw FFI bindings to C++ code. Almost all functions are unsafe and require careful handling:

  • Memory management is manual
  • Callbacks must be properly synchronized
  • Driver state must be carefully managed
  • See ASIO SDK documentation for details

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

The ASIO SDK is owned by Steinberg Media Technologies GmbH. Users must comply with Steinberg's licensing terms.

Contributing

Contributions are welcome! Please submit issues and pull requests to the cpal repository.

Resources

Dependencies

~0.2–3MB
~59K SLoC