fix(apu): have send_samples block main thraed
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c1430594cf
commit
3fb182b9cb
|
@ -11,7 +11,7 @@ mod types;
|
||||||
|
|
||||||
const WAVE_PATTERN_RAM_LEN: usize = 0x10;
|
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 AUDIO_BUFFER_LEN: usize = 512;
|
||||||
const CHANNEL_COUNT: usize = 2;
|
const CHANNEL_COUNT: usize = 2;
|
||||||
const SAMPLE_INCREMENT: u64 = SAMPLE_RATE as u64;
|
const SAMPLE_INCREMENT: u64 = SAMPLE_RATE as u64;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{AUDIO_BUFFER_LEN, CHANNEL_COUNT, SAMPLE_RATE};
|
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 rodio::Source;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ pub struct AudioSender<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> AudioSender<T> {
|
impl<T> AudioSender<T> {
|
||||||
pub(crate) fn send_samples(&self, left: T, right: T) -> Result<(), TrySendError<T>> {
|
pub(crate) fn send_samples(&self, left: T, right: T) -> Result<(), SendError<T>> {
|
||||||
self.inner.try_send(left).and(self.inner.try_send(right))?;
|
self.inner.send(left).and(self.inner.send(right))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue