Snes9x - msu1: revert to start for invalid loop positions (#1039)

This commit is contained in:
bladeoner 2022-11-11 18:15:36 +01:00 committed by GitHub
parent 67af82ad0c
commit 3940616617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,7 +262,14 @@ void S9xMSU1Generate(size_t sample_count)
{
if (MSU1.MSU1_STATUS & AudioRepeating)
{
MSU1.MSU1_AUDIO_POS = audioLoopPos;
if (audioLoopPos < MSU1.MSU1_AUDIO_POS)
{
MSU1.MSU1_AUDIO_POS = audioLoopPos;
}
else // if the loop point is invalid, revert to start
{
MSU1.MSU1_AUDIO_POS = 8;
}
REVERT_STREAM(audioStream, MSU1.MSU1_AUDIO_POS, 0);
}
else