feat: schedule audio sampling on scheduler

DMA sound in games like Pokemon Emerald, Chobits, Love Hina, and Kirby:
Nightmare in Dream Land sound great save for conerns about resampling
This commit is contained in:
2022-04-14 05:58:32 -03:00
parent 92cabd248b
commit 172a59aefb
6 changed files with 67 additions and 69 deletions

View File

@@ -51,6 +51,7 @@ pub const Scheduler = struct {
3 => cpu.bus.tim._3.handleOverflow(cpu, late),
}
},
.SampleAudio => cpu.bus.apu.sampleAudio(late),
.HBlank => cpu.bus.ppu.handleHBlankEnd(cpu, late), // The end of a HBlank
.VBlank => cpu.bus.ppu.handleHDrawEnd(cpu, late), // The end of a VBlank
}
@@ -102,4 +103,5 @@ pub const EventKind = union(enum) {
VBlank,
Draw,
TimerOverflow: u2,
SampleAudio,
};