Skip to content

Commit dbc2ad8

Browse files
committed
feat: Add ASIO backend
1 parent eaa1a3b commit dbc2ad8

11 files changed

Lines changed: 844 additions & 710 deletions

File tree

Cargo.lock

Lines changed: 185 additions & 706 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 = "2.0.0"
1014
fixed-resample = "0.8.0"
@@ -51,6 +55,8 @@ windows = { version = "0.61.1", features = [
5155
"Win32_Media_Multimedia",
5256
"Win32_UI_Shell_PropertiesSystem"
5357
]}
58+
asio-sys ={ version = "0.2.2", optional = true }
59+
num-traits = {version = "0.2.19", optional = true }
5460

5561
[[example]]
5662
name = "enumerate_alsa"
@@ -68,3 +74,8 @@ required-features = ["pipewire"]
6874
[[example]]
6975
name = "enumerate_pipewire"
7076
path = "examples/enumerate_pipewire.rs"
77+
78+
[[example]]
79+
name = "enumerate_asio"
80+
path = "examples/enumerate_asio.rs"
81+
features = ["asio"]

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ fn main() {
77
os_alsa: { any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd",
88
target_os = "netbsd") },
99
os_coreaudio: { any (target_os = "macos", target_os = "ios") },
10-
os_pipewire: { any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd") },
1110
os_wasapi: { target_os = "windows" },
12-
unsupported: { not(any(os_alsa, os_coreaudio, os_wasapi)) }
11+
os_asio: { all(target_os = "windows", feature = "asio") },
12+
unsupported: { not(any(os_alsa, os_coreaudio, os_wasapi))}
1313
}
1414
}

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)