diff --git a/NOTICE b/NOTICE index 384afa5f..07c2a7d8 100644 --- a/NOTICE +++ b/NOTICE @@ -117,7 +117,7 @@ its source package at the repository given. tracing-core v0.1.36 MIT https://github.com/tokio-rs/tracing unicode-ident v1.0.26 (MIT OR Apache-2.0) AND Unicode-3.0 https://github.com/dtolnay/unicode-ident uuid v1.26.1 Apache-2.0 OR MIT https://github.com/uuid-rs/uuid - wasapi v0.26.0 MIT https://github.com/HEnquist/wasapi-rs + wasapi v0.27.0 MIT https://github.com/HEnquist/wasapi-rs windowfunctions v0.1.1 MIT https://github.com/HEnquist/windowfunctions-rs windows v0.62.2 MIT OR Apache-2.0 https://github.com/microsoft/windows-rs windows-collections v0.3.2 MIT OR Apache-2.0 https://github.com/microsoft/windows-rs diff --git a/native/akou-capture/Cargo.lock b/native/akou-capture/Cargo.lock index 276974b6..eb61e4d3 100644 --- a/native/akou-capture/Cargo.lock +++ b/native/akou-capture/Cargo.lock @@ -1375,9 +1375,9 @@ dependencies = [ [[package]] name = "wasapi" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5f8804a710cf7a18b07610225abb127e562f3249a1f3ed88a6f045c5444910" +checksum = "58b35dbcb6fae6fbaba9f6f52a22686bb405978ee112ed6eb33d98bd63c97583" dependencies = [ "log", "num-integer", diff --git a/native/akou-capture/Cargo.toml b/native/akou-capture/Cargo.toml index 5a5d26d7..94244fd0 100644 --- a/native/akou-capture/Cargo.toml +++ b/native/akou-capture/Cargo.toml @@ -42,7 +42,7 @@ pulseaudio = "0.3" zbus = "5" [target.'cfg(target_os = "windows")'.dependencies] -wasapi = "0.26" +wasapi = "0.27" # The same `windows` release wasapi is built on, for the few calls it does not wrap. Dictation # (DC-N1, DC-N6 to DC-N9, DC-L2) adds the low-level key and mouse hooks and `SendInput` # (UI_WindowsAndMessaging, UI_Input_KeyboardAndMouse, and Graphics_Gdi for a window class), the clipboard's delayed rendering diff --git a/native/akou-capture/src/windows.rs b/native/akou-capture/src/windows.rs index 6cc2f90c..d280515d 100644 --- a/native/akou-capture/src/windows.rs +++ b/native/akou-capture/src/windows.rs @@ -182,7 +182,7 @@ fn device_id(d: &Device) -> Option { /// The active devices of one direction. `DeviceCollection`'s own iterator panics on an error, /// and a panic here aborts the helper, so this walks it by index. fn active(en: &DeviceEnumerator, dir: Direction) -> Vec { - let Ok(c) = en.get_device_collection(&dir) else { + let Ok(c) = en.get_device_collection(dir) else { return vec![]; }; let n = c.get_nbr_devices().unwrap_or(0); @@ -206,12 +206,12 @@ impl Stream { /// Starts `client` capturing 32-bit float at `rate` and `channels`, event-driven, with WASAPI /// converting from the device's own format when it differs (it never changes the device). fn start(mut client: AudioClient, rate: u32, channels: usize) -> Result { - let fmt = WaveFormat::new(32, 32, &SampleType::Float, rate as usize, channels, None); + let fmt = WaveFormat::new(32, 32, SampleType::Float, rate as usize, channels, None); let mode = StreamMode::EventsShared { autoconvert: true, buffer_duration_hns: BUFFER_HNS, }; - client.initialize_client(&fmt, &Direction::Capture, &mode)?; + client.initialize_client(&fmt, Direction::Capture, mode, None)?; let event = client.set_get_eventhandle()?; let capture = client.get_audiocaptureclient()?; client.start_stream()?; @@ -410,7 +410,7 @@ fn open_mic( .iter() .filter_map(|d| d.get_id().ok()) .collect(); - let default = || en.get_default_device_for_role(&Direction::Capture, &Role::Communications); + let default = || en.get_default_device_for_role(Direction::Capture, Role::Communications); let device = match mic_target(requested, &ids) { MicTarget::Pinned(id) => en.get_device(&id), MicTarget::Default => default(), @@ -460,10 +460,8 @@ struct CallOpen { /// The default render devices for the console and communications roles, in that order. They are /// one device unless the machine sets them apart. fn default_renders(en: &DeviceEnumerator) -> [Option; 2] { - [Role::Console, Role::Communications].map(|role| { - en.get_default_device_for_role(&Direction::Render, &role) - .ok() - }) + [Role::Console, Role::Communications] + .map(|role| en.get_default_device_for_role(Direction::Render, role).ok()) } /// What the call side's device watch follows (see `wasapi_rules::render_watch`). @@ -478,7 +476,7 @@ fn render_device(en: &DeviceEnumerator) -> Option { /// Loopback of the default communications output, the one call apps play to, with its name. fn open_endpoint() -> Result<(Stream, u32, String), OpenError> { let device = DeviceEnumerator::new() - .and_then(|en| en.get_default_device_for_role(&Direction::Render, &Role::Communications)) + .and_then(|en| en.get_default_device_for_role(Direction::Render, Role::Communications)) .map_err(|e| OpenError::no_device(format!("no output device: {e}")))?; let name = device .get_friendlyname() @@ -639,8 +637,8 @@ impl Control { st.default_output = render_device(en); st.default_input = en .get_default_device_for_role( - &Direction::Capture, - &Role::Communications, + Direction::Capture, + Role::Communications, ) .ok() .and_then(|d| device_id(&d)); @@ -907,7 +905,7 @@ pub fn list_devices() -> Result { let en = DeviceEnumerator::new().map_err(|e| err("the device list", e))?; let side = |dir: Direction, role: Role| { let default = en - .get_default_device_for_role(&dir, &role) + .get_default_device_for_role(dir, role) .ok() .and_then(|d| d.get_id().ok()); active(&en, dir)