feat: new protocol client implementation

This commit is contained in:
Ahmet Kaan Gümüş 2025-06-14 06:04:48 +03:00
parent 51c29f7921
commit 5ad6184f13
9 changed files with 497 additions and 267 deletions

View file

@ -1,3 +1,6 @@
use protocol::protocol::Speaker;
use tokio::sync::broadcast;
pub mod gui;
pub mod stream;
pub mod voice;
@ -5,6 +8,21 @@ pub mod voice;
const MICROPHONE_BUFFER_LENGHT: usize = 1024 * 4;
const SPEAKER_BUFFER_LENGHT: usize = 1024 * 16 * 16;
#[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()
}
}
#[derive(Debug)]
pub struct ClientConfig {
certificate_path: String,