cannot read mic input

This commit is contained in:
mii443
2024-02-14 19:36:39 +09:00
parent 11cce7ee17
commit d25b8c515b
3 changed files with 8 additions and 2 deletions

View File

@ -108,10 +108,11 @@ pub fn run(run: Run) {
let config = device.default_input_config().unwrap();
let channels = config.channels();
let virtual_devices = virtual_devices.iter().filter(|device| device.lock().unwrap().name == input_route.virtual_device).map(|d| d.clone()).collect::<Vec<_>>();
let mut stream = device.build_input_stream(
let stream = device.build_input_stream(
&config.into(),
{
move |data, _| {
println!("Reading input stream");
for (i, buffer) in data.chunks(channels as usize).enumerate() {
let buffer = buffer.to_vec();
for virtual_device in &virtual_devices {
@ -123,6 +124,7 @@ pub fn run(run: Run) {
move |err| eprintln!("An error occurred on the input stream: {}", err),
None
).unwrap();
println!("Playing input stream");
stream.play().unwrap();
}
crate::config::Device::Remote { remote } => {
@ -130,4 +132,6 @@ pub fn run(run: Run) {
}
}
}
std::thread::sleep(std::time::Duration::from_secs(10));
}