diff options
| author | Eskil Queseth <eskilq@kth.se> | 2021-06-13 20:48:54 +0200 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2021-06-13 20:48:54 +0200 |
| commit | 465f21da46a7194e25894043ca2cca9ba958e11c (patch) | |
| tree | 0a1dd5381263e8e8d6d09f1c0940aeb11f497e49 /mumd/src/audio | |
| parent | 9bc2bdc5dca1399fa75d20a18f1a2dfb8ab4e325 (diff) | |
| download | mum-465f21da46a7194e25894043ca2cca9ba958e11c.tar.gz | |
add unreachable_pub lint and fix debug impl
Diffstat (limited to 'mumd/src/audio')
| -rw-r--r-- | mumd/src/audio/input.rs | 12 | ||||
| -rw-r--r-- | mumd/src/audio/output.rs | 13 | ||||
| -rw-r--r-- | mumd/src/audio/transformers.rs | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/mumd/src/audio/input.rs b/mumd/src/audio/input.rs index a1227e3..2a904d9 100644 --- a/mumd/src/audio/input.rs +++ b/mumd/src/audio/input.rs @@ -1,6 +1,7 @@ use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use cpal::{InputCallbackInfo, Sample, SampleFormat, SampleRate, StreamConfig}; use log::*; +use std::fmt::Debug; use tokio::sync::watch; use crate::audio::SAMPLE_RATE; @@ -177,3 +178,14 @@ impl AudioInputDevice for DefaultAudioInputDevice { self.channels as usize } } + +impl Debug for DefaultAudioInputDevice { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DefaultAudioInputDevice") + .field("sample_receiver", &self.sample_receiver) + .field("channels", &self.channels) + .field("volume_sender", &self.volume_sender) + .field("stream", &"cpal::Stream") + .finish() + } +} diff --git a/mumd/src/audio/output.rs b/mumd/src/audio/output.rs index a2f6bcc..cdbe336 100644 --- a/mumd/src/audio/output.rs +++ b/mumd/src/audio/output.rs @@ -7,12 +7,14 @@ use cpal::{OutputCallbackInfo, Sample, SampleFormat, SampleRate, StreamConfig}; use log::*; use mumble_protocol::voice::VoicePacketPayload; use std::collections::{HashMap, VecDeque}; +use std::fmt::Debug; use std::ops::AddAssign; use std::sync::{Arc, Mutex}; use tokio::sync::watch; type ClientStreamKey = (VoiceStreamType, u32); +#[derive(Debug)] pub struct ClientStream { buffer_clients: HashMap<ClientStreamKey, (VecDeque<f32>, opus::Decoder)>, //TODO ring buffer? buffer_effects: VecDeque<f32>, @@ -242,3 +244,14 @@ pub fn curry_callback<T: Sample + AddAssign + SaturatingAdd + std::fmt::Display> } } } + +impl Debug for DefaultAudioOutputDevice { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DefaultAudioInputDevice") + .field("client_streams", &self.client_streams) + .field("config", &self.config) + .field("volume_sender", &self.volume_sender) + .field("stream", &"cpal::Stream") + .finish() + } +} diff --git a/mumd/src/audio/transformers.rs b/mumd/src/audio/transformers.rs index 25e28b8..74d751a 100644 --- a/mumd/src/audio/transformers.rs +++ b/mumd/src/audio/transformers.rs @@ -6,6 +6,7 @@ pub trait Transformer { } /// A struct representing a noise gate transform. +#[derive(Debug)] pub struct NoiseGate { alltime_high: f32, open: usize, |
