From 8d036bca08351fc3f681254fd780b9cddf1c3623 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Tue, 17 Feb 2026 19:30:02 +0100 Subject: [PATCH] Fix Windows build crashing because virtual_mic is Option Device not just Device (not inside let Some) --- src/windows_lib.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/windows_lib.rs b/src/windows_lib.rs index eefa580..0d10a8d 100644 --- a/src/windows_lib.rs +++ b/src/windows_lib.rs @@ -59,8 +59,23 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) { .unwrap_or(false) }); - if let Some(virtual_mic) = virtual_mic { - // nothing, let Some doesnt support ! + if let Some(virtual_mic) = virtual_mic { + route_standard_to_virtual(&host, &virtual_mic); + + let normal_output = host + .default_output_device() + .expect("Could not get default output device"); + + return ( + OutputStreamBuilder::from_device(normal_output) + .expect("Unable to open default audio device") + .open_stream() + .expect("Failed to open stream"), + OutputStreamBuilder::from_device(virtual_mic) + .expect("Unable to open default audio device") + .open_stream() + .expect("Failed to open stream"), + ); } else { MessageDialog::new() @@ -71,21 +86,4 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) { std::process::exit(1); } - - route_standard_to_virtual(&host, &virtual_mic); - - let normal_output = host - .default_output_device() - .expect("Could not get default output device"); - - return ( - OutputStreamBuilder::from_device(normal_output) - .expect("Unable to open default audio device") - .open_stream() - .expect("Failed to open stream"), - OutputStreamBuilder::from_device(virtual_mic) - .expect("Unable to open default audio device") - .open_stream() - .expect("Failed to open stream"), - ); } \ No newline at end of file