Skip to content

Commit da923a2

Browse files
authored
chore: prepare asio-sys v0.2.3 release (#1071)
* docs: add README, CHANGELOG, and metadata for asio-sys * refactor: replace SampleRate newtype with type alias
1 parent ac8f022 commit da923a2

File tree

5 files changed

+188
-4
lines changed

5 files changed

+188
-4
lines changed

asio-sys/CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.3] - 2025-12-11
9+
10+
### Added
11+
- Added `edition = "2021"` and `rust-version = "1.70"` to Cargo.toml
12+
- Added README.md with usage documentation
13+
- Added CHANGELOG.md following Keep a Changelog format
14+
- Added rustfmt.toml for consistent formatting
15+
16+
### Changed
17+
- Update `bindgen` to 0.72
18+
- Update `cc` to 1.2
19+
- Update `parse_cfg` to 4.1
20+
- Update enumerate example to use `pub type SampleRate = u32` instead of `pub struct SampleRate(pub u32)` for consistency with cpal
21+
22+
### Fixed
23+
- Fix linker flags for MinGW cross-compilation
24+
- Add `packed(4)` to representation of ASIO time structs in bindings
25+
- Fix handling for `kAsioResetRequest` message to prevent driver UI becoming unresponsive
26+
- Fix timeinfo flags type
27+
28+
## [0.2.2] - 2024-03-04
29+
30+
### Added
31+
- Automate ASIO SDK download during build (no longer requires manual download)
32+
- Add support for `CPAL_ASIO_DIR` environment variable to use local SDK
33+
34+
### Changed
35+
- Update `bindgen` to 0.59
36+
- Switch to `once_cell` from `lazy_static`
37+
- Improve build script error messages and SDK detection
38+
- Clean up build script structure
39+
- Re-run build script when `CPAL_ASIO_DIR` changes
40+
41+
### Fixed
42+
- Fix segmentation fault during build on some systems
43+
- Fix various compiler warnings
44+
- Fix typos in code and comments
45+
46+
## [0.2.1] - 2021-11-26
47+
48+
### Changed
49+
- Update `bindgen` to 0.56
50+
51+
### Fixed
52+
- Fix some typos and warnings
53+
54+
## [0.2.0] - 2020-07-22
55+
56+
### Changed
57+
- Update repository URL to https://github.com/RustAudio/cpal/
58+
59+
## [0.1.0] - 2020-07-22
60+
61+
Initial release.
62+
63+
### Added
64+
- FFI bindings to Steinberg ASIO SDK
65+
- Automatic binding generation using bindgen
66+
- Support for MSVC toolchain on Windows
67+
- Basic error types: `AsioError`, `LoadDriverError`
68+
69+
[0.2.3]: https://github.com/RustAudio/cpal/compare/asio-sys-v0.2.2...asio-sys-v0.2.3
70+
[0.2.2]: https://github.com/RustAudio/cpal/compare/asio-sys-v0.2.1...asio-sys-v0.2.2
71+
[0.2.1]: https://github.com/RustAudio/cpal/compare/asio-sys-v0.2.0...asio-sys-v0.2.1
72+
[0.2.0]: https://github.com/RustAudio/cpal/compare/asio-sys-v0.1.0...asio-sys-v0.2.0
73+
[0.1.0]: https://github.com/RustAudio/cpal/releases/tag/asio-sys-v0.1.0

asio-sys/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ repository = "https://github.com/RustAudio/cpal/"
77
documentation = "https://docs.rs/asio-sys"
88
license = "Apache-2.0"
99
keywords = ["audio", "sound", "asio", "steinberg"]
10+
edition = "2021"
11+
rust-version = "1.70"
1012
build = "build.rs"
1113

1214
[build-dependencies]

asio-sys/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# asio-sys
2+
3+
[![Crates.io](https://img.shields.io/crates/v/asio-sys.svg)](https://crates.io/crates/asio-sys)
4+
[![Documentation](https://docs.rs/asio-sys/badge.svg)](https://docs.rs/asio-sys)
5+
[![License](https://img.shields.io/crates/l/asio-sys.svg)](https://github.com/RustAudio/cpal/blob/master/LICENSE)
6+
7+
Low-level Rust bindings for the [Steinberg ASIO SDK](https://www.steinberg.net/developers/).
8+
9+
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.
10+
11+
## Overview
12+
13+
`asio-sys` provides raw FFI bindings to the ASIO SDK, automatically generated using [bindgen](https://rust-lang.github.io/rust-bindgen/). This crate is used by [cpal](https://crates.io/crates/cpal)'s ASIO backend to provide low-latency audio on Windows.
14+
15+
**Note:** Most users should use [cpal](https://crates.io/crates/cpal)'s safe, cross-platform API rather than using `asio-sys` directly.
16+
17+
## Features
18+
19+
- Automatic binding generation from ASIO SDK headers
20+
- Low-level access to ASIO driver functionality
21+
- Support for both MSVC and MinGW toolchains
22+
- Automated ASIO SDK download and setup during build
23+
24+
## Requirements
25+
26+
### Windows
27+
28+
- **LLVM/Clang**: Required for bindgen to generate bindings
29+
- Install via [LLVM downloads](https://releases.llvm.org/) or `choco install llvm`
30+
- **ASIO SDK**: Automatically downloaded during build from Steinberg
31+
- Or set `CPAL_ASIO_DIR` environment variable to point to a local SDK
32+
33+
### Build Dependencies
34+
35+
- `bindgen` - Generates Rust bindings from C/C++ headers
36+
- `cc` - Compiles the ASIO SDK C++ files
37+
- `walkdir` - Finds SDK files
38+
39+
## Usage
40+
41+
Add to your `Cargo.toml`:
42+
43+
```toml
44+
[dependencies]
45+
asio-sys = "0.2"
46+
```
47+
48+
### Example
49+
50+
```rust
51+
use asio_sys as sys;
52+
53+
fn main() {
54+
// Load ASIO driver
55+
let driver_name = "ASIO4ALL v2"; // Your ASIO driver name
56+
57+
unsafe {
58+
// Initialize ASIO
59+
let drivers = sys::get_driver_names();
60+
println!("Available drivers: {drivers:?}");
61+
62+
// Load a driver
63+
match sys::load_asio_driver(driver_name) {
64+
Ok(driver) => println!("Loaded driver: {driver_name}"),
65+
Err(e) => eprintln!("Failed to load driver: {e:?}"),
66+
}
67+
}
68+
}
69+
```
70+
71+
## Environment Variables
72+
73+
- `CPAL_ASIO_DIR`: Path to ASIO SDK directory (optional)
74+
- If not set, the SDK is automatically downloaded during build
75+
- Example: `set CPAL_ASIO_DIR=C:\path\to\asiosdk`
76+
77+
## Platform Support
78+
79+
- **Windows** (MSVC and MinGW)
80+
- x86_64 (64-bit)
81+
- i686 (32-bit)
82+
83+
ASIO is Windows-only. This crate will not build on other platforms.
84+
85+
## Safety
86+
87+
This crate provides raw FFI bindings to C++ code. Almost all functions are `unsafe` and require careful handling:
88+
89+
- Memory management is manual
90+
- Callbacks must be properly synchronized
91+
- Driver state must be carefully managed
92+
- See [ASIO SDK documentation](https://www.steinberg.net/developers/) for details
93+
94+
## License
95+
96+
Licensed under the Apache License, Version 2.0. See [LICENSE](../LICENSE) for details.
97+
98+
The ASIO SDK is owned by Steinberg Media Technologies GmbH. Users must comply with Steinberg's licensing terms.
99+
100+
## Contributing
101+
102+
Contributions are welcome! Please submit issues and pull requests to the [cpal repository](https://github.com/RustAudio/cpal).
103+
104+
## Resources
105+
106+
- [ASIO SDK Documentation](https://www.steinberg.net/developers/)
107+
- [cpal Documentation](https://docs.rs/cpal)
108+
- [RustAudio Community](https://github.com/RustAudio)
109+
- [Discord: #cpal Channel](https://discordapp.com/channels/590254806208217089/672897096826748948)

asio-sys/examples/enumerate.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ pub enum SampleFormat {
2323
pub type ChannelCount = u16;
2424

2525
// The number of samples processed per second for a single channel of audio.
26-
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
27-
pub struct SampleRate(pub u32);
26+
pub type SampleRate = u32;
2827

2928
#[derive(Debug, Clone, PartialEq, Eq)]
3029
pub struct Format {
@@ -46,12 +45,12 @@ fn main() {
4645
.expect("failed to retrieve sample rate");
4746
let in_fmt = Format {
4847
channels: channels.ins as _,
49-
sample_rate: SampleRate(sample_rate as _),
48+
sample_rate: sample_rate as _,
5049
data_type: SampleFormat::F32,
5150
};
5251
let out_fmt = Format {
5352
channels: channels.outs as _,
54-
sample_rate: SampleRate(sample_rate as _),
53+
sample_rate: sample_rate as _,
5554
data_type: SampleFormat::F32,
5655
};
5756
println!(" Input {:?}", in_fmt);

asio-sys/rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
edition = "2021"

0 commit comments

Comments
 (0)