From 3afd5872514945bbec6c0e4656b491b2b21e7651 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 2 Jan 2018 12:09:24 +0800 Subject: add first-order filters and quick-fixes to APU --- src/bin.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/bin.rs') diff --git a/src/bin.rs b/src/bin.rs index 6e781a2..88c17d9 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -288,11 +288,11 @@ impl<'a> sdl2::audio::AudioCallback for SDLAudioPlayback<'a> { } impl<'a> apu::Speaker for SDLAudio<'a> { - fn queue(&mut self, sample: u16) { + fn queue(&mut self, sample: i16) { let mut m = self.0.buffer.lock().unwrap(); { let b = &mut m.0; - b.enque(sample.wrapping_sub(1 << 15) as i16); + b.enque(sample); } m.1 += 1; while m.1 >= AUDIO_ALL_SAMPLES { @@ -331,7 +331,7 @@ fn print_cpu_trace(cpu: &CPU) { fn main() { let matches = App::new("RuNES") - .version("0.1.2") + .version("0.1.4") .author("Ted Yin ") .about("A Rust NES emulator") .arg(Arg::with_name("scale") @@ -426,7 +426,7 @@ fn main() { loop { /* consume the leftover cycles from the last instruction */ while cpu.cycle > 0 { - cpu.mem.bus.tick() + cpu.mem.bus.tick(); } //print_cpu_trace(&cpu); cpu.step(); -- cgit v1.2.3