- let the ANM player wait until the sound has finished if it has reached the last frame before the sound ends.

In Shadow Warrior there's a few where the sound plays a bit longer than the video.
Fixes #341
This commit is contained in:
Christoph Oelckers 2020-09-05 18:14:50 +02:00
parent 607d30ef8e
commit 443ddf670b
2 changed files with 11 additions and 0 deletions

View file

@ -1071,6 +1071,16 @@ int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int so
} }
} }
} }
else
{
for (FSoundChan* chan = Channels; chan != NULL; chan = chan->NextChan)
{
if ((sourcetype == SOURCE_Any || (chan->SourceType == sourcetype && chan->Source == source)))
{
count++;
}
}
}
return count; return count;
} }

View file

@ -175,6 +175,7 @@ public:
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE);
} }
} }
if (!skiprequest && !nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return 1;
curframe++; curframe++;
if (skiprequest && !nostopsound) soundEngine->StopAllChannels(); if (skiprequest && !nostopsound) soundEngine->StopAllChannels();
return skiprequest ? -1 : curframe < numframes? 1 : 0; return skiprequest ? -1 : curframe < numframes? 1 : 0;