X-Git-Url: https://code.octet-stream.net/m17rt/blobdiff_plain/608ca7e33ab51d812607ddcc3429bfa9aa3c34b0..3903e719137aba15d30dd58b8d917965ec602400:/m17codec2/src/lib.rs diff --git a/m17codec2/src/lib.rs b/m17codec2/src/lib.rs index 1d05f27..e4bfbac 100755 --- a/m17codec2/src/lib.rs +++ b/m17codec2/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + use codec2::{Codec2, Codec2Mode}; use cpal::traits::DeviceTrait; use cpal::traits::HostTrait; @@ -40,6 +42,7 @@ pub fn decode_codec2>(data: &[u8], out_path: P) -> Vec { all_samples } +/// Subscribes to M17 streams and attempts to play the decoded Codec2 pub struct Codec2Adapter { state: Arc>, // TODO: make this configurable @@ -162,9 +165,17 @@ fn stream_thread(end: Receiver<()>, state: Arc>, output_card // it seems concrete impls of Stream have a Drop implementation that will handle termination } +/// Transmits a wave file as an M17 stream pub struct WavePlayer; impl WavePlayer { + /// Plays a wave file (blocking). + /// + /// * `path`: wave file to transmit, must be 8 kHz mono and 16-bit LE + /// * `tx`: a `TxHandle` obtained from an `M17App` + /// * `source`: address of transmission source + /// * `destination`: address of transmission destination + /// * `channel_access_number`: from 0 to 15, usually 0 pub fn play( path: PathBuf, tx: TxHandle,