use audio::play_audio; use fsk::afsk_modulate; use text_io::scan; use std::io; mod fsk; mod audio; fn main() -> Result<(), io::Error> { println!("Press 1 to send test tone"); println!("Press 0 to exit"); let a: i32; scan!("{}", a); match a { 1 => { println!("1 has been pressed! No test tone implemented yet"); let tone: Vec; tone = afsk_modulate(&[ 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b1000101,0b11111111,0b1000101,0b11111111,0b11111111,0b1000101,0b11111111,0b11111111,0b1000101,0b11111111,0b11111111, ], 1700.0); let repeated_tone: Vec = tone.iter().cloned().cycle().take(tone.len() * 10).collect(); play_audio(&repeated_tone); return main(); }, 0 => { return Ok(()); } _ => { eprintln!("Invalid command."); return Ok(()); } } //Ok(()) }