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