back to clock cycles for now

This commit is contained in:
Alex Janka 2023-02-19 09:23:28 +11:00
parent 433c9bae6c
commit 184e4c3341
3 changed files with 5 additions and 6 deletions

View file

@ -108,8 +108,8 @@ impl Default for Apu {
let config = config.config(); let config = config.config();
let converter = Samplerate::new( let converter = Samplerate::new(
ConverterType::Linear, ConverterType::SincBestQuality,
CLOCK_SPEED as u32 / 4, CLOCK_SPEED as u32,
config.sample_rate.0, config.sample_rate.0,
2, 2,
) )
@ -133,7 +133,7 @@ impl Default for Apu {
} }
} }
const CYCLES_PER_FRAME: usize = 70224 / 4; const CYCLES_PER_FRAME: usize = 70224;
impl Apu { impl Apu {
pub fn init(&mut self) { pub fn init(&mut self) {

View file

@ -266,8 +266,7 @@ impl PwmChannel {
} }
fn set_wave_timer(wavelength: u16) -> u16 { fn set_wave_timer(wavelength: u16) -> u16 {
2048 - wavelength (2048 - wavelength) * 4
// (2048 - wavelength) * 4
} }
pub(super) struct WaveChannel { pub(super) struct WaveChannel {

View file

@ -28,7 +28,7 @@ impl Cpu {
let clock_cycles = (machine_cycles as usize) * 4; let clock_cycles = (machine_cycles as usize) * 4;
self.advance_gpu_clock(clock_cycles); self.advance_gpu_clock(clock_cycles);
self.advance_apu_clock(machine_cycles as usize); self.advance_apu_clock(clock_cycles);
self.timers.div_counter += clock_cycles; self.timers.div_counter += clock_cycles;
let mut div_diff = (self.timers.div_counter / 256) as u8; let mut div_diff = (self.timers.div_counter / 256) as u8;