Skip to content

Commit 8d036bc

Browse files
committed
Fix Windows build crashing because virtual_mic is Option Device not just Device (not inside let Some)
1 parent 9d3d027 commit 8d036bc

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

src/windows_lib.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,23 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) {
5959
.unwrap_or(false)
6060
});
6161

62-
if let Some(virtual_mic) = virtual_mic {
63-
// nothing, let Some doesnt support !
62+
if let Some(virtual_mic) = virtual_mic {
63+
route_standard_to_virtual(&host, &virtual_mic);
64+
65+
let normal_output = host
66+
.default_output_device()
67+
.expect("Could not get default output device");
68+
69+
return (
70+
OutputStreamBuilder::from_device(normal_output)
71+
.expect("Unable to open default audio device")
72+
.open_stream()
73+
.expect("Failed to open stream"),
74+
OutputStreamBuilder::from_device(virtual_mic)
75+
.expect("Unable to open default audio device")
76+
.open_stream()
77+
.expect("Failed to open stream"),
78+
);
6479
}
6580
else {
6681
MessageDialog::new()
@@ -71,21 +86,4 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) {
7186

7287
std::process::exit(1);
7388
}
74-
75-
route_standard_to_virtual(&host, &virtual_mic);
76-
77-
let normal_output = host
78-
.default_output_device()
79-
.expect("Could not get default output device");
80-
81-
return (
82-
OutputStreamBuilder::from_device(normal_output)
83-
.expect("Unable to open default audio device")
84-
.open_stream()
85-
.expect("Failed to open stream"),
86-
OutputStreamBuilder::from_device(virtual_mic)
87-
.expect("Unable to open default audio device")
88-
.open_stream()
89-
.expect("Failed to open stream"),
90-
);
9189
}

0 commit comments

Comments
 (0)