mirror of
https://github.com/csd4ni3l/soundboard.git
synced 2026-03-10 09:09:24 +01:00
Fix some windows compilation issues
This commit is contained in:
@@ -81,6 +81,12 @@ fn create_virtual_mic() -> SoundSystem {
|
|||||||
.expect("Unable to open device")
|
.expect("Unable to open device")
|
||||||
.open_stream()
|
.open_stream()
|
||||||
.expect("Failed to 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,
|
paused: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,7 +240,7 @@ fn play_sound(file_path: String, app_state: &mut AppState) {
|
|||||||
let file2 = File::open(&file_path).unwrap();
|
let file2 = File::open(&file_path).unwrap();
|
||||||
let src2 = Decoder::new(BufReader::new(file2)).unwrap();
|
let src2 = Decoder::new(BufReader::new(file2)).unwrap();
|
||||||
let normal_sink = Sink::connect_new(&app_state.sound_system.normal_output_stream.mixer());
|
let normal_sink = Sink::connect_new(&app_state.sound_system.normal_output_stream.mixer());
|
||||||
sink2.append(src2);
|
normal_sink.append(src2);
|
||||||
}
|
}
|
||||||
|
|
||||||
sink.play();
|
sink.play();
|
||||||
@@ -264,6 +270,7 @@ fn ui_system(mut contexts: EguiContexts, mut app_state: ResMut<AppState>) -> Res
|
|||||||
let available_height = ui.available_height();
|
let available_height = ui.available_height();
|
||||||
let outputs = app_state.virt_outputs.clone();
|
let outputs = app_state.virt_outputs.clone();
|
||||||
|
|
||||||
|
#[allow(unused_mut)]
|
||||||
let mut mic_name = "Select inside apps".to_string();
|
let mut mic_name = "Select inside apps".to_string();
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) {
|
|||||||
}).unwrap_or(false)
|
}).unwrap_or(false)
|
||||||
}).expect("Could not get default output device");
|
}).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"));
|
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"));
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user