2025-06-14 06:04:48 +03:00
|
|
|
use protocol::protocol::Speaker;
|
|
|
|
use tokio::sync::broadcast;
|
|
|
|
|
2025-06-16 02:11:29 +03:00
|
|
|
pub mod audio;
|
2025-05-14 23:43:35 +03:00
|
|
|
pub mod gui;
|
|
|
|
pub mod stream;
|
|
|
|
|
2025-05-22 16:50:44 +03:00
|
|
|
const MICROPHONE_BUFFER_LENGHT: usize = 1024 * 4;
|
2025-06-11 17:48:15 +03:00
|
|
|
const SPEAKER_BUFFER_LENGHT: usize = 1024 * 16 * 16;
|
2025-05-20 05:44:00 +03:00
|
|
|
|
2025-06-14 06:04:48 +03:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct SpeakerWithData {
|
|
|
|
speaker: Speaker,
|
|
|
|
audio_sender: broadcast::Sender<f32>,
|
|
|
|
}
|
|
|
|
impl SpeakerWithData {
|
|
|
|
pub fn get_speaker_id(&self) -> u8 {
|
|
|
|
self.speaker.get_id()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn subscribe(&self) -> broadcast::Receiver<f32> {
|
|
|
|
self.audio_sender.subscribe()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-05-14 23:43:35 +03:00
|
|
|
#[derive(Debug)]
|
2025-05-15 23:19:39 +03:00
|
|
|
pub struct ClientConfig {
|
|
|
|
certificate_path: String,
|
2025-05-14 23:43:35 +03:00
|
|
|
server_address: String,
|
|
|
|
}
|
2025-05-15 23:19:39 +03:00
|
|
|
|
|
|
|
impl ClientConfig {
|
|
|
|
fn new() -> Self {
|
|
|
|
Self {
|
|
|
|
certificate_path: "./client/certificates/cert.pem".to_string(),
|
2025-05-16 05:16:52 +03:00
|
|
|
server_address: "127.0.0.1:4546".to_string(),
|
2025-05-15 23:19:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|