msu1: revert to start for invalid loop positions (#778)

This commit is contained in:
OV2 2022-11-06 02:11:37 +01:00
parent 5c889d9488
commit 4b8d3c6c6b
1 changed files with 8 additions and 1 deletions

View File

@ -253,7 +253,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