+7
-7
src/main.rs
+7
-7
src/main.rs
···
40
40
async fn main() {
41
41
let asio_host = cpal::host_from_id(cpal::HostId::Asio).expect("failed to initialise ASIO host");
42
42
43
-
let output_devices: Vec<cpal::Device> = asio_host
44
-
.output_devices()
45
-
.expect("No ASIO output devices available in this host")
46
-
.collect();
47
-
48
43
println!("Use arrow keys to select an item below");
49
44
println!();
50
45
let asio_out_idx = dialoguer::Select::new()
51
46
.with_prompt("1. Select an ASIO output device to use")
52
-
.items(output_devices.iter().map(|d| d.name().unwrap()))
47
+
.items(asio_host.devices().unwrap().map(|d| d.name().unwrap()))
53
48
.default(0)
54
49
.interact()
55
50
.unwrap();
56
51
57
-
let asio_out = output_devices.get(asio_out_idx).unwrap().to_owned();
52
+
let asio_out = asio_host
53
+
.devices()
54
+
.unwrap()
55
+
.nth(asio_out_idx)
56
+
.unwrap()
57
+
.to_owned();
58
58
let out_name = asio_out.name().unwrap();
59
59
let supported_config: Vec<cpal::SupportedStreamConfigRange> = asio_out
60
60
.supported_output_configs()