diff options
| author | Eskil Queseth <eskilq@kth.se> | 2021-02-12 00:00:34 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2021-02-12 00:00:34 +0100 |
| commit | c2adfc88f8aeb4bbdb417897b0cbf44b5b9f7b2c (patch) | |
| tree | 39ad331fc870d8994383640bf206138077943c32 /mumd/src/audio.rs | |
| parent | 154a2930b3bbe5ede06648c3a10b8fa4904277f4 (diff) | |
| download | mum-c2adfc88f8aeb4bbdb417897b0cbf44b5b9f7b2c.tar.gz | |
fix audio buffer overflowing
Diffstat (limited to 'mumd/src/audio.rs')
| -rw-r--r-- | mumd/src/audio.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index 598dde6..94b1abd 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -1,7 +1,7 @@ pub mod input; pub mod output; -use crate::audio::output::SaturatingAdd; +use crate::{audio::output::SaturatingAdd, state::StatePhase}; use crate::network::VoiceStreamType; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; @@ -90,7 +90,7 @@ pub struct Audio { } impl Audio { - pub fn new(input_volume: f32, output_volume: f32) -> Self { + pub fn new(input_volume: f32, output_volume: f32, phase_watcher: watch::Receiver<StatePhase>) -> Self { let sample_rate = SampleRate(SAMPLE_RATE); let host = cpal::default_host(); @@ -181,6 +181,7 @@ impl Audio { input::callback::<f32>( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), @@ -189,6 +190,7 @@ impl Audio { input::callback::<i16>( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), @@ -197,6 +199,7 @@ impl Audio { input::callback::<u16>( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), |
