fix(apu): don't spin if ringbuf is full

This commit is contained in:
2021-07-28 16:23:31 -05:00
parent 8724da824e
commit e43cac8041
4 changed files with 31 additions and 31 deletions

View File

@@ -117,16 +117,9 @@ impl Cpu {
}
};
// TODO: With how we currently handle audio
// this --while being correct-- incurs a performance penalty
// as our emu is audio-bound.
let mut elapsed = 0x00;
let pending: u32 = cycles.into();
while elapsed < pending {
if !self.bus.apu().is_full() {
self.bus.clock();
elapsed += 1;
}
for _ in 0..pending {
self.bus.clock();
}
self.handle_interrupts();