From d630494d65129393645a414cf0ea1adbe9c401c4 Mon Sep 17 00:00:00 2001 From: Astatin Date: Tue, 22 Jul 2025 13:18:50 +0200 Subject: Make audio time accurate using audio buffers --- src/io.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/io.rs') diff --git a/src/io.rs b/src/io.rs index 92e5984..06775a2 100644 --- a/src/io.rs +++ b/src/io.rs @@ -1,6 +1,7 @@ use std::time::SystemTime; use std::{thread, time}; +use crate::audio::MutableWave; use crate::consts; use crate::state::GBState; @@ -65,7 +66,8 @@ pub trait Wave { } pub trait Audio { - fn new(wave: S) -> Self; + fn new(wave: MutableWave) -> Self; + fn next(&mut self); } pub trait LoadSave @@ -147,6 +149,7 @@ impl Gameboy Gameboy= 32 { + audio_counter -= 32; + state.mem.audio.next(); + } state.div_timer(c); state.tima_timer(c); -- cgit v1.2.3-70-g09d2