correct for machine cycles

This commit is contained in:
Alex Janka 2023-02-17 11:07:03 +11:00
parent 7a28655604
commit e150005eda

View file

@ -76,7 +76,7 @@ impl Default for Apu {
.config();
let converter = Samplerate::new(
ConverterType::ZeroOrderHold,
ConverterType::SincFastest,
CLOCK_SPEED as u32,
config.sample_rate.0,
2,
@ -100,7 +100,7 @@ impl Default for Apu {
}
}
const CYCLES_PER_FRAME: usize = 70224;
const CYCLES_PER_FRAME: usize = 70224 / 4;
impl Apu {
pub fn init(&mut self) {
@ -118,8 +118,9 @@ impl Apu {
&self.config,
move |data: &mut [f32], _info: &cpal::OutputCallbackInfo| {
for v in data {
if let Some(a) = executor::block_on(rx.pop()) {
*v = a;
match executor::block_on(rx.pop()) {
Some(a) => *v = a,
None => panic!("Audio queue disconnected!"),
}
}
},