- Fixed: S_EvictAllChannels() must replace the channel's start time with its

position when evicting sounds, because restarting the sound system causes
  the DSP clock to restart at 0, so start times that were recorded before
  the reset are no longer applicable after the reset.
- Fixed: S_StopChannel() always set the channel's actor to NULL, eliminating
  origin information when resetting the sound system.


SVN r1949 (trunk)
This commit is contained in:
Randy Heit 2009-10-30 02:18:07 +00:00
parent 0e5f48adb4
commit 50b0340a56
4 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,11 @@
October 29, 2009
- Fixed: S_EvictAllChannels() must replace the channel's start time with its
position when evicting sounds, because restarting the sound system causes
the DSP clock to restart at 0, so start times that were recorded before
the reset are no longer applicable after the reset.
- Fixed: S_StopChannel() always set the channel's actor to NULL, eliminating
origin information when resetting the sound system.
October 28, 2009 October 28, 2009
- Added Gez's patch for IWAD detection of Blasphemer and Action Doom 2. - Added Gez's patch for IWAD detection of Blasphemer and Action Doom 2.
- Fixed: 0 damage projectiles did not call P_DamageMobj. - Fixed: 0 damage projectiles did not call P_DamageMobj.

View File

@ -1741,6 +1741,11 @@ void S_EvictAllChannels()
chan->ChanFlags |= CHAN_EVICTED; chan->ChanFlags |= CHAN_EVICTED;
if (chan->SysChannel != NULL) if (chan->SysChannel != NULL)
{ {
if (!(chan->ChanFlags & CHAN_ABSTIME))
{
chan->StartTime.AsOne = GSnd ? GSnd->GetPosition(chan) : 0;
chan->ChanFlags |= CHAN_ABSTIME;
}
S_StopChannel(chan); S_StopChannel(chan);
} }
// assert(chan->NextChan == next); // assert(chan->NextChan == next);
@ -2016,13 +2021,11 @@ void S_StopChannel(FSoundChan *chan)
if (!(chan->ChanFlags & CHAN_EVICTED)) if (!(chan->ChanFlags & CHAN_EVICTED))
{ {
chan->ChanFlags |= CHAN_FORGETTABLE; chan->ChanFlags |= CHAN_FORGETTABLE;
}
if (chan->SourceType == SOURCE_Actor) if (chan->SourceType == SOURCE_Actor)
{ {
chan->Actor = NULL; chan->Actor = NULL;
} }
}
GSnd->StopChannel(chan); GSnd->StopChannel(chan);
} }
else else

View File

@ -1541,7 +1541,7 @@ FISoundChannel *FMODSoundRenderer::StartSound(SoundHandle sfx, float vol, int pi
chan->setFrequency(freq); chan->setFrequency(freq);
} }
chan->setVolume(vol); chan->setVolume(vol);
if (!HandleChannelDelay(chan, reuse_chan, !!(flags & SNDF_ABSTIME), freq)) if (!HandleChannelDelay(chan, reuse_chan, flags & (SNDF_ABSTIME | SNDF_LOOP), freq))
{ {
chan->stop(); chan->stop();
return NULL; return NULL;
@ -1648,7 +1648,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener *
chan->set3DAttributes((FMOD_VECTOR *)&pos[0], (FMOD_VECTOR *)&vel[0]); chan->set3DAttributes((FMOD_VECTOR *)&pos[0], (FMOD_VECTOR *)&vel[0]);
chan->set3DSpread(snd_3dspread); chan->set3DSpread(snd_3dspread);
} }
if (!HandleChannelDelay(chan, reuse_chan, !!(flags & SNDF_ABSTIME), freq)) if (!HandleChannelDelay(chan, reuse_chan, flags & (SNDF_ABSTIME | SNDF_LOOP), freq))
{ {
chan->stop(); chan->stop();
return NULL; return NULL;
@ -1685,7 +1685,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener *
// //
//========================================================================== //==========================================================================
bool FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, bool abstime, float freq) const bool FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, int flags, float freq) const
{ {
if (reuse_chan != NULL) if (reuse_chan != NULL)
{ // Sound is being restarted, so seek it to the position { // Sound is being restarted, so seek it to the position
@ -1695,7 +1695,7 @@ bool FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *
// If abstime is set, the sound is being restored, and // If abstime is set, the sound is being restored, and
// the channel's start time is actually its seek position. // the channel's start time is actually its seek position.
if (abstime) if (flags & SNDF_ABSTIME)
{ {
unsigned int seekpos = reuse_chan->StartTime.Lo; unsigned int seekpos = reuse_chan->StartTime.Lo;
if (seekpos > 0) if (seekpos > 0)

View File

@ -69,7 +69,7 @@ private:
static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2); static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2);
static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance); static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance);
bool HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, bool abstime, float freq) const; bool HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, int flags, float freq) const;
FISoundChannel *CommonChannelSetup(FMOD::Channel *chan, FISoundChannel *reuse_chan) const; FISoundChannel *CommonChannelSetup(FMOD::Channel *chan, FISoundChannel *reuse_chan) const;
FMOD_MODE SetChanHeadSettings(SoundListener *listener, FMOD::Channel *chan, const FVector3 &pos, bool areasound, FMOD_MODE oldmode) const; FMOD_MODE SetChanHeadSettings(SoundListener *listener, FMOD::Channel *chan, const FVector3 &pos, bool areasound, FMOD_MODE oldmode) const;