diff --git a/src/main.rs b/src/main.rs index 39d90a9..b60d448 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,6 +81,12 @@ fn create_virtual_mic() -> SoundSystem { .expect("Unable to open device") .open_stream() .expect("Failed to open stream"), + // this is actually not needed here, since windows would exit by far. But, cargo doesnt like SoundSystem not getting the normal_output stream so... + #[cfg(target_os = "windows")] + normal_output_stream: OutputStreamBuilder::from_device(device) + .expect("Unable to open device") + .open_stream() + .expect("Failed to open stream"), paused: false, } } @@ -234,7 +240,7 @@ fn play_sound(file_path: String, app_state: &mut AppState) { let file2 = File::open(&file_path).unwrap(); let src2 = Decoder::new(BufReader::new(file2)).unwrap(); let normal_sink = Sink::connect_new(&app_state.sound_system.normal_output_stream.mixer()); - sink2.append(src2); + normal_sink.append(src2); } sink.play(); @@ -264,6 +270,7 @@ fn ui_system(mut contexts: EguiContexts, mut app_state: ResMut) -> Res let available_height = ui.available_height(); let outputs = app_state.virt_outputs.clone(); + #[allow(unused_mut)] let mut mic_name = "Select inside apps".to_string(); #[cfg(target_os = "linux")] diff --git a/src/windows_lib.rs b/src/windows_lib.rs index 8778388..3087870 100644 --- a/src/windows_lib.rs +++ b/src/windows_lib.rs @@ -8,7 +8,7 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) { }).unwrap_or(false) }).expect("Could not get default output device"); - normal_output = host.default_output_device().expect("Could not get default output device"); + 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