]>
code.octet-stream.net Git - m17rt/blob - tools/m17rt-soundcards/src/main.rs
1 use ascii_table
::{Align
, AsciiTable
};
2 use m17app
::soundcard
::Soundcard
;
3 use m17codec2
::{rx
::Codec2RxAdapter
, tx
::Codec2TxAdapter
};
6 // On some platforms enumerating devices will emit junk to the terminal:
7 // https://github.com/RustAudio/cpal/issues/384
8 // To minimise the impact, enumerate first and put our output at the end.
9 let soundmodem_in
= Soundcard
::supported_input_cards();
10 let soundmodem_out
= Soundcard
::supported_output_cards();
11 let codec2_in
= Codec2TxAdapter
::supported_input_cards();
12 let codec2_out
= Codec2RxAdapter
::supported_output_cards();
14 println
!("\nDetected sound cards compatible with M17 Rust Toolkit:");
23 generate_table("CODEC2 AUDIO", "TX", "RX", &codec2_in
, &codec2_out
);
30 input_cards
: &[String
],
31 output_cards
: &[String
],
33 let mut merged
: Vec
<&str> = input_cards
35 .chain(output_cards
.iter
())
42 let data
= merged
.into
_iter
().map(|c
| {
45 if input_cards
.iter
().any(|s
| s
== c
) {
50 if output_cards
.iter
().any(|s
| s
== c
) {
58 let mut table
= AsciiTable
::default();
59 table
.column(0).set_header(heading
).set_align(Align
::Left
);
60 table
.column(1).set_header(input
).set_align(Align
::Center
);
61 table
.column(2).set_header(output
).set_align(Align
::Center
);