However, it turns out there's a really simple fix for both issues: call an IRQ2 17 times per frame instead of just once! This approximates an IRQ2 frequency of 1000 Hz (17 x 60 = 1020; close enough).
Change this (DSB.cpp, line 1021):
- Code: Select all
// Per-frame interrupt
M68KSetIRQ(2);
M68KRun(4000000/60);
to this:
- Code: Select all
// 1000 Hz timer(?) interrupt
for (int i = 0; i < 17; i++)
{
M68KSetIRQ(2);
M68KRun(4000);
}
I've tested on Daytona USA 2 and Sega Rally 2 and they work great; I'm not sure about other games.
I figured this out by noticing that tracks do eventually fade out; it just takes much longer than it's supposed to. I had starting digging into Daytona 2's MPEG program code before I got a flash of inspiration and tried increasing the IRQ2 frequency with immediate results. After a bit of testing I found that using 1000 Hz fades out music at the same speed as real hardware (I used this video as a reference). I'm guessing that IRQ2 is a timer interrupt and it helps the 68000 on the DSB2 keep track of how many milliseconds have elapsed.