ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
673 stars 193 forks source link

Genesis Plus GX - MD+ Sometimes Looping Before Tracks End #471

Closed sorceresslucienne closed 1 year ago

sorceresslucienne commented 1 year ago

Issue: Audio tracks (wav files) sometimes restart/loop back to the start of the track before the track is over. Possible culprit: pausing the game with MD+ audio enabled doesn't pause the "timer" for the audio track. So if a track is 5 minutes long and you pause for 30 seconds, it will loop at 4 minutes and 30 seconds instead of the full 5 minutes.

Tested: In latest version of RetroArch. Genesis Plus GX core version v1.7.4 6431634

Example game: Streets of Rage 2

MD+ patch used: https://www.zeldix.net/t1992-streets-of-rage-2-md (see link for "MD+ Patch v2 (by infinest)") (I will be reaching out to them as well to see if there could be a bug with the patch itself)

MD+ audio files used: https://www.zeldix.net/t1992-streets-of-rage-2-md (see "MD+ Maestro Draven Expanded & Enhanced OST (by lucienne)")

A DM conversation with a Zeldix community member for additional context:

"...replaying SoR2 tonight and on the hardest difficulty, and so I'm on the stages much longer than usual. I'm noticing subsequently - and only sometimes mind you - that the tracks will suddenly restart earlier than they should? As in, they won't have finished and it'll loop back to the beginning anyway.

These wav files are quite long, but this isn't happening consistently and so I doubt the length has anything to do with it. There also may be some correlation with pausing during the stages and that messing up the timing of where it is in the track/where to restart? Only anecdotal conjecture there though.

I finished the game and made note of a couple tracks that looped prematurely vs. one that didn't:

Stage 6: "05-JungleBase.wav" restarted early and it's 43mb & 4m 3s in length. I paused during the stage.

Stage 7: "24-BackToTheIndustry.wav" restarted early and it's 41mb & 3m 52s in length. I paused during the stage.

Stage 8: "10-SORSuperMix(Introduction).wav" ran all the way through without issue and it's 47.5mb & 4m 29s in length. I didn't pause during the stage.

Not sure what conclusions I can come to from this, other than that it's not some absolute track length or file size limitation in any case. Pausing seemed to correlate but isn't necessarily causal as I said. Hope this helps!"

ekeeke commented 1 year ago

Possible culprit: pausing the game with MD+ audio enabled doesn't pause the "timer" for the audio track. So if a track is 5 minutes long and you pause for 30 seconds, it will loop at 4 minutes and 30 seconds instead of the full 5 minutes.

This was actually a correct assumption: remaining audio sample counter was still getting decremented while audio playback was paused, which would result in audio track loop (or end of track if no loop) occuring sooner than it should if paused in between. This should now be fixed by referenced commit.

sorceresslucienne commented 1 year ago

Glad it was a simple fix - thank you so much! :-)