From 3fb182b9cb1b5946e88045c51b94b985dc99251e Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sun, 18 Jul 2021 21:18:04 -0500 Subject: [PATCH] fix(apu): have send_samples block main thraed --- src/apu.rs | 2 +- src/apu/gen.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apu.rs b/src/apu.rs index 8851570..093f204 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -11,7 +11,7 @@ mod types; const WAVE_PATTERN_RAM_LEN: usize = 0x10; -const SAMPLE_RATE: u32 = 48000; // Hz +const SAMPLE_RATE: u32 = 44100; // Hz const AUDIO_BUFFER_LEN: usize = 512; const CHANNEL_COUNT: usize = 2; const SAMPLE_INCREMENT: u64 = SAMPLE_RATE as u64; diff --git a/src/apu/gen.rs b/src/apu/gen.rs index 4db82b1..315a8fb 100644 --- a/src/apu/gen.rs +++ b/src/apu/gen.rs @@ -1,5 +1,5 @@ use super::{AUDIO_BUFFER_LEN, CHANNEL_COUNT, SAMPLE_RATE}; -use crossbeam_channel::{Receiver, Sender, TrySendError}; +use crossbeam_channel::{Receiver, SendError, Sender}; use rodio::Source; use std::collections::VecDeque; @@ -22,8 +22,8 @@ pub struct AudioSender { } impl AudioSender { - pub(crate) fn send_samples(&self, left: T, right: T) -> Result<(), TrySendError> { - self.inner.try_send(left).and(self.inner.try_send(right))?; + pub(crate) fn send_samples(&self, left: T, right: T) -> Result<(), SendError> { + self.inner.send(left).and(self.inner.send(right))?; Ok(()) } }