From c2adfc88f8aeb4bbdb417897b0cbf44b5b9f7b2c Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Fri, 12 Feb 2021 00:00:34 +0100 Subject: fix audio buffer overflowing --- mumd/src/audio.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mumd/src/audio.rs') 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) -> Self { let sample_rate = SampleRate(SAMPLE_RATE); let host = cpal::default_host(); @@ -181,6 +181,7 @@ impl Audio { input::callback::( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), @@ -189,6 +190,7 @@ impl Audio { input::callback::( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), @@ -197,6 +199,7 @@ impl Audio { input::callback::( sample_sender, input_volume_receiver, + phase_watcher, ), err_fn, ), -- cgit v1.2.1