Skip to content

Commit 6e4e417

Browse files
committed
feat: Add ASIO backend
1 parent 5cbf00c commit 6e4e417

11 files changed

Lines changed: 808 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 160 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ edition = "2021"
55
rust-version = "1.80"
66
license = "MIT"
77

8+
[features]
9+
default = ["asio"]
10+
asio = ["asio-sys", "num-traits"]
11+
812
[dependencies]
913
duplicate = "1.0.0"
1014
log = { version = "0.4.22", features = ["kv"] }
@@ -43,6 +47,8 @@ windows = { version = "0.58.0", features = [
4347
"Win32_Media_Multimedia",
4448
"Win32_UI_Shell_PropertiesSystem"
4549
]}
50+
asio-sys ={ version = "0.2.2", optional = true }
51+
num-traits = {version = "0.2.19", optional = true }
4652

4753
[[example]]
4854
name = "enumerate_alsa"
@@ -55,3 +61,8 @@ path = "examples/enumerate_coreaudio.rs"
5561
[[example]]
5662
name = "enumerate_wasapi"
5763
path = "examples/enumerate_wasapi.rs"
64+
65+
[[example]]
66+
name = "enumerate_asio"
67+
path = "examples/enumerate_asio.rs"
68+
features = ["asio"]

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn main() {
88
target_os = "netbsd") },
99
os_coreaudio: { any (target_os = "macos", target_os = "ios") },
1010
os_wasapi: { target_os = "windows" },
11+
os_asio: { all(target_os = "windows", feature = "asio") },
1112
unsupported: { not(any(os_alsa, os_coreaudio, os_wasapi))}
1213
}
1314
}

examples/enumerate_asio.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mod util;
2+
3+
#[cfg(os_asio)]
4+
fn main() -> Result<(), Box<dyn std::error::Error>> {
5+
use crate::util::enumerate::enumerate_devices;
6+
use interflow::backends::asio::AsioDriver;
7+
enumerate_devices(AsioDriver::new()?)?;
8+
Ok(())
9+
}
10+
11+
#[cfg(not(os_asio))]
12+
fn main() {
13+
println!("ASIO driver is not available on this platform");
14+
}

0 commit comments

Comments
 (0)