feat(snd): synchronize audio with rest of system

In it's current form I think this is actually rather inefficient. It's
also not very accurate since I throw away a lot of samples for no real
good reason. More improvements to thiss will be coming henceforth
This commit is contained in:
2021-07-11 23:22:17 -05:00
parent 45dc27301c
commit 3b772c7c49
3 changed files with 123 additions and 18 deletions

View File

@@ -125,9 +125,14 @@ impl Cpu {
}
};
let pending: u32 = cycles.into();
let mut pending: u32 = cycles.into();
for _ in 0..pending {
self.bus.clock();
if !self.bus.is_audio_full() {
self.bus.clock();
} else {
self.bus.flush_audio();
pending += 1;
}
}
self.handle_interrupts();