Fixed: S_PrecacheLevel() could create orphan channels
- S_PrecacheLevel() must also mark currently playing sounds as used. If we don't, the sound could be unloaded and the underlying channel stopped without triggering a channel callback. That would leave the code in s_sound.cpp thinking the sound is still playing even though it isn't. - Added an invalid channel check to FMODSoundRenderer::StopChannel() so that orphan channels passed to it will be returned at least when S_StopAllChannels() is called.
This commit is contained in:
parent
7ee1853403
commit
a7ff9478a7
2 changed files with 11 additions and 9 deletions
|
|
@ -383,7 +383,7 @@ void S_Start ()
|
|||
{
|
||||
// kill all playing sounds at start of level (trust me - a good idea)
|
||||
S_StopAllChannels();
|
||||
|
||||
|
||||
// Check for local sound definitions. Only reload if they differ
|
||||
// from the previous ones.
|
||||
FString LocalSndInfo;
|
||||
|
|
@ -487,6 +487,11 @@ void S_PrecacheLevel ()
|
|||
{
|
||||
level.info->PrecacheSounds[i].MarkUsed();
|
||||
}
|
||||
// Don't unload sounds that are playing right now.
|
||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
{
|
||||
chan->SoundID.MarkUsed();
|
||||
}
|
||||
|
||||
for (i = 1; i < S_sfx.Size(); ++i)
|
||||
{
|
||||
|
|
@ -2083,12 +2088,6 @@ void S_ChannelEnded(FISoundChannel *ichan)
|
|||
evicted = (pos < len);
|
||||
}
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
evicted = false;
|
||||
}
|
||||
*/
|
||||
if (!evicted)
|
||||
{
|
||||
S_ReturnChannel(schan);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue