1#![warn(clippy::all, clippy::pedantic, rust_2018_idioms)]
5#![warn(missing_debug_implementations, clippy::unwrap_used)]
6#![allow(
7 clippy::module_name_repetitions,
8 clippy::missing_errors_doc,
9 clippy::missing_panics_doc
10)]
11#![doc = include_str!("../README.md")]
12
13pub mod client;
14pub mod error;
15pub mod handlers;
16pub mod message;
17pub mod protocol;
18pub mod utilities;
19
20use audiopus::{Channels, SampleRate};
22pub use client::*;
23pub use error::{Result, ZelloError};
24pub use handlers::{handle_message, process_audio_output};
25pub use message::{CodecHeader, Error, Event, IncomingMessage, Message, Response};
26pub use protocol::Protocol;
27pub use utilities::{
28 connect_to_zello, create_decoder, initialize_logging, load_credentials, load_dotenv,
29 setup_audio_output,
30};
31
32pub const VERSION: &str = env!("CARGO_PKG_VERSION");
34
35pub const GIT_VERSION: &str = env!("GIT_VERSION");
37
38pub const OPUS_CHANNELS: Channels = Channels::Mono;
40
41pub const OPUS_SAMPLE_RATE: SampleRate = SampleRate::Hz16000;
43
44pub const PCM_CHANNEL_CAPACITY: usize = 20;
46
47pub const PCM_BUFFER_SIZE: usize = 1920;
49
50pub const CPAL_SAMPLE_RATE: cpal::SampleRate = cpal::SampleRate(16000);
52
53pub const CPAL_CHANNELS: u16 = 1;
55
56pub const CPAL_VECTOR_QUEUE_CAPACITY: usize = 8192;
58
59pub const PCM_I16_TO_F32: f32 = 1.0 / 32768.0;
61
62#[allow(clippy::cast_possible_truncation)]
64pub const CPAL_BUFFER_SIZE: cpal::BufferSize =
65 cpal::BufferSize::Fixed(PCM_BUFFER_SIZE as cpal::FrameCount);
66
67pub const ZELLO_DEFAULT_URL: &str = "wss://zello.io/ws";
69
70#[cfg(test)]
71mod tests {
72 use super::*;
73
74 #[test]
75 fn test_version() {
76 assert!(!VERSION.is_empty());
77 }
78
79 #[test]
80 fn test_git_version() {
81 assert!(!GIT_VERSION.is_empty());
82 }
83}