Continuous integration / Check (push) Successful in 37s
Continuous integration / Test Suite (push) Successful in 33s
Continuous integration / Rustfmt (push) Successful in 25s
Continuous integration / Clippy (push) Failing after 33s
Continuous integration / build (push) Successful in 33s
59 lines
1.4 KiB
Rust
59 lines
1.4 KiB
Rust
use clap::Parser;
|
|
use ringbuf::{HeapRb, wrap::caching::Caching};
|
|
use ropus::Decoder;
|
|
use rubato::Fft;
|
|
use shared::AudioStreamInfo;
|
|
use std::{
|
|
collections::HashMap,
|
|
sync::{Arc, Mutex, RwLock},
|
|
};
|
|
use tokio::net::UdpSocket;
|
|
|
|
#[derive(Parser)]
|
|
#[command(version, about)]
|
|
pub struct CliArgs {
|
|
#[arg(short, long, required(false))]
|
|
pub connect_with_defaults: Option<String>,
|
|
|
|
#[arg(short, long, required(false))]
|
|
pub server_ip: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum TuiScreen {
|
|
DeviceSelect,
|
|
Blank,
|
|
Exit,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Clone)]
|
|
pub enum ClientEvent {
|
|
NewConnection,
|
|
NewAudioStreamRequest(AudioStreamInfo),
|
|
NewAudioStreamAccepted(u8),
|
|
}
|
|
|
|
pub struct ClientInfo {
|
|
pub client_id: u32,
|
|
pub server_address: String,
|
|
pub connected: bool,
|
|
}
|
|
|
|
pub type AudioStreamKey = (u32, u8);
|
|
|
|
pub type InputAudioStreamsProducers =
|
|
HashMap<AudioStreamKey, Caching<Arc<HeapRb<f32>>, true, false>>;
|
|
pub type InputAudioStreamsConsumers =
|
|
Arc<Mutex<HashMap<AudioStreamKey, Caching<Arc<HeapRb<f32>>, false, true>>>>;
|
|
|
|
pub type InputAudioStreamsDecoders = HashMap<AudioStreamKey, Decoder>;
|
|
pub type InputAudioStreamsResamplers = HashMap<AudioStreamKey, Fft<f32>>;
|
|
|
|
pub type InputAudioStreamsInfo = Arc<RwLock<HashMap<AudioStreamKey, AudioStreamInfo>>>;
|
|
|
|
pub struct AudioControl {
|
|
pub active_input_audio_streams_info: InputAudioStreamsInfo,
|
|
pub udp_socket: Arc<UdpSocket>,
|
|
}
|