MiSTer-devel / NeoGeo_MiSTer

NeoGeo for MiSTer
GNU General Public License v2.0
148 stars 78 forks source link

Postpone disabling JT12 until next sample is needed #136

Closed greyrogue closed 3 years ago

greyrogue commented 3 years ago

This change should reduce/eliminate audio warbling caused by waiting for DDR audio samples. Currently, the audio Z80 is disabled on the next 8MHz clock after a ROM sample is requested if the data hasn't been received by then from DDR. This change waits until the sample is about to be read before disabling the Z80, giving 10-100 times more time before disabling it. If this is insufficient, it should be possible to add code to pre-cache the data, as this is highly predictable (for each of the six ADPCM-A and one ADPCM-B channels, it will be one of the start address, the last read address or the last read address + 1).

jotego commented 3 years ago

Although the title says "disabling audio Z80", what this really does is letting JT12 operate until data is needed. This is much better than the previous solution and I think this PR should be accepted.

Still, this system requires a re-design to be able to get data always in time. Even with the proposed solution, when a sample is not achieved in time, it will hold all JT12 output -FM, PSG and ADPCM. This holding will create sound artefacts. Whether this is audible or not will depend on how often it occurs. Let's see what users think -or hear.

greyrogue commented 3 years ago

Whoops. I titled it wrong. I meant disabled JT12. jotego comment is correct. I had Z80 on the brain. I'll try to fix it.