mirror of
https://github.com/csd4ni3l/soundboard.git
synced 2026-04-17 16:07:22 +02:00
Compare commits
4 Commits
dcf121c045
...
8d036bca08
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d036bca08 | ||
|
|
9d3d027e45 | ||
|
|
4a21f60ee6 | ||
|
|
b241117813 |
@@ -2,8 +2,9 @@ use rodio::{
|
|||||||
OutputStream, OutputStreamBuilder,
|
OutputStream, OutputStreamBuilder,
|
||||||
cpal::{self, traits::{DeviceTrait, StreamTrait, HostTrait}, StreamConfig, SampleRate},
|
cpal::{self, traits::{DeviceTrait, StreamTrait, HostTrait}, StreamConfig, SampleRate},
|
||||||
};
|
};
|
||||||
|
use rfd::{MessageButtons, MessageDialog, MessageDialogResult};
|
||||||
use ringbuf::{traits::*, HeapRb};
|
use ringbuf::{traits::*, HeapRb};
|
||||||
|
use std::process;
|
||||||
|
|
||||||
fn route_standard_to_virtual(host: &cpal::Host, virtual_mic: &cpal::Device) {
|
fn route_standard_to_virtual(host: &cpal::Host, virtual_mic: &cpal::Device) {
|
||||||
let standard_mic = host.default_input_device().expect("Could not get default input device.");
|
let standard_mic = host.default_input_device().expect("Could not get default input device.");
|
||||||
@@ -56,9 +57,9 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) {
|
|||||||
.ok()
|
.ok()
|
||||||
.map(|name| name.contains("CABLE Input") || name.contains("VB-Audio"))
|
.map(|name| name.contains("CABLE Input") || name.contains("VB-Audio"))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
})
|
});
|
||||||
.expect("Could not get VB Cable output device. Is VB Cable Driver installed?");
|
|
||||||
|
|
||||||
|
if let Some(virtual_mic) = virtual_mic {
|
||||||
route_standard_to_virtual(&host, &virtual_mic);
|
route_standard_to_virtual(&host, &virtual_mic);
|
||||||
|
|
||||||
let normal_output = host
|
let normal_output = host
|
||||||
@@ -76,3 +77,13 @@ pub fn create_virtual_mic_windows() -> (OutputStream, OutputStream) {
|
|||||||
.expect("Failed to open stream"),
|
.expect("Failed to open stream"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
MessageDialog::new()
|
||||||
|
.set_title("VB Cable Driver not installed.")
|
||||||
|
.set_description("Could not access VB Cable output device. Is VB Cable Driver installed?")
|
||||||
|
.set_buttons(MessageButtons::Ok)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user