39 lines
850 B
Rust
39 lines
850 B
Rust
use protocol::protocol::Speaker;
|
|
use tokio::sync::broadcast;
|
|
|
|
pub mod audio;
|
|
pub mod gui;
|
|
pub mod stream;
|
|
|
|
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,
|
|
server_address: String,
|
|
}
|
|
|
|
impl ClientConfig {
|
|
fn new() -> Self {
|
|
Self {
|
|
certificate_path: "./client/certificates/cert.pem".to_string(),
|
|
server_address: "127.0.0.1:4546".to_string(),
|
|
}
|
|
}
|
|
}
|