pub fn create_decoder() -> Result<Arc<Mutex<Decoder>>>Expand description
Examples found in repository?
examples/complete.rs (line 67)
60async fn main() -> Result<()> {
61 let args = Args::parse();
62
63 load_dotenv_from_file("examples/.env.example")?;
64 initialize_logging()?;
65
66 let credentials = load_credentials()?;
67 let decoder = create_decoder()?;
68
69 let (pcm_tx, pcm_rx) = bounded::<Vec<i16>>(PCM_CHANNEL_CAPACITY);
70 let pcm_rx = Arc::new(Mutex::new(pcm_rx));
71 let _stream = setup_audio_output(pcm_rx)?;
72
73 let mut client = connect_to_zello(&credentials).await?;
74
75 match (args.message, args.callsign) {
76 (Some(msg), Some(callsign)) => {
77 client
78 .send_text_message_to_callsign(&msg, &callsign)
79 .await?;
80 }
81 (Some(msg), None) => {
82 client.send_text_message(&msg).await?;
83 }
84 (None, _) => {
85 client.run_message_loop(decoder, &pcm_tx).await?;
86 }
87 }
88
89 client.close().await?;
90
91 Ok(())
92}