mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-04 12:50:57 +00:00
- fixed: Exhumed's ChannelEnded method did not call the super class.
This caused all sorts of audio errors.
This commit is contained in:
parent
907c2bbe1e
commit
affa8240f4
5 changed files with 24 additions and 13 deletions
|
@ -31,6 +31,7 @@ enum EChanFlag
|
||||||
CHANF_VIRTUAL = 2048, // internal: Channel is currently virtual
|
CHANF_VIRTUAL = 2048, // internal: Channel is currently virtual
|
||||||
CHANF_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
|
CHANF_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
|
||||||
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
|
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
|
||||||
|
CHANF_ENDED = 16384, // Helper to detect broken ChannelEnded implementations.
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TFlags<EChanFlag> EChanFlags;
|
typedef TFlags<EChanFlag> EChanFlags;
|
||||||
|
|
|
@ -1702,7 +1702,9 @@ void OpenALSoundRenderer::StopChannel(FISoundChannel *chan)
|
||||||
|
|
||||||
ALuint source = GET_PTRID(chan->SysChannel);
|
ALuint source = GET_PTRID(chan->SysChannel);
|
||||||
// Release first, so it can be properly marked as evicted if it's being killed
|
// Release first, so it can be properly marked as evicted if it's being killed
|
||||||
|
chan->ChanFlags |= CHANF_ENDED;
|
||||||
soundEngine->ChannelEnded(chan);
|
soundEngine->ChannelEnded(chan);
|
||||||
|
assert(!(chan->ChanFlags & CHANF_ENDED));
|
||||||
|
|
||||||
ALint state = AL_INITIAL;
|
ALint state = AL_INITIAL;
|
||||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
|
@ -1726,7 +1728,9 @@ void OpenALSoundRenderer::ForceStopChannel(FISoundChannel *chan)
|
||||||
ALuint source = GET_PTRID(chan->SysChannel);
|
ALuint source = GET_PTRID(chan->SysChannel);
|
||||||
if(!source) return;
|
if(!source) return;
|
||||||
|
|
||||||
|
chan->ChanFlags |= CHANF_ENDED;
|
||||||
soundEngine->ChannelEnded(chan);
|
soundEngine->ChannelEnded(chan);
|
||||||
|
assert(!(chan->ChanFlags & CHANF_ENDED));
|
||||||
FreeSource(source);
|
FreeSource(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
||||||
}
|
}
|
||||||
if (chan != NULL)
|
if (chan != NULL)
|
||||||
{
|
{
|
||||||
|
assert(!(chan->ChanFlags & CHANF_FORGETTABLE));
|
||||||
chan->SoundID = sound_id;
|
chan->SoundID = sound_id;
|
||||||
chan->OrgID = FSoundID(org_id);
|
chan->OrgID = FSoundID(org_id);
|
||||||
chan->EntChannel = channel;
|
chan->EntChannel = channel;
|
||||||
|
@ -1347,7 +1348,7 @@ void SoundEngine::ChannelEnded(FISoundChannel *ichan)
|
||||||
{
|
{
|
||||||
FSoundChan *schan = static_cast<FSoundChan*>(ichan);
|
FSoundChan *schan = static_cast<FSoundChan*>(ichan);
|
||||||
bool evicted;
|
bool evicted;
|
||||||
|
schan->ChanFlags &= ~CHANF_ENDED;
|
||||||
if (schan != NULL)
|
if (schan != NULL)
|
||||||
{
|
{
|
||||||
// If the sound was stopped with GSnd->StopSound(), then we know
|
// If the sound was stopped with GSnd->StopSound(), then we know
|
||||||
|
@ -1781,16 +1782,17 @@ FString SoundEngine::NoiseDebug()
|
||||||
CalcPosVel(chan, &origin, nullptr);
|
CalcPosVel(chan, &origin, nullptr);
|
||||||
out.AppendFormat(TEXTCOLOR_GOLD "%5.0f | %5.0f | %5.0f | %5.0f ", origin.X, origin.Z, origin.Y, (origin - listener).Length());
|
out.AppendFormat(TEXTCOLOR_GOLD "%5.0f | %5.0f | %5.0f | %5.0f ", origin.X, origin.Z, origin.Y, (origin - listener).Length());
|
||||||
}
|
}
|
||||||
out.AppendFormat("%-.2g %-4d %-4d %s3%sZ%sU%sM%sN%sA%sL%sE%sV" TEXTCOLOR_GOLD " %-5.4f %-4u %d: %s\n", chan->Volume, chan->EntChannel, chan->Priority,
|
out.AppendFormat("%-.2g %-4d %-4d %sF%s3%sZ%sU%sM%sN%sA%sL%sE%sV" TEXTCOLOR_GOLD " %-5.4f %-4u %d: %s\n", chan->Volume, chan->EntChannel, chan->Priority,
|
||||||
(chan->ChanFlags & CHANF_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_FORGETTABLE) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
(chan->ChanFlags & CHANF_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHANF_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
|
(chan->ChanFlags & CHANF_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||||
GSnd->GetAudibility(chan), GSnd->GetPosition(chan), ((int)chan->OrgID)-1, S_sfx[chan->SoundID].name.GetChars());
|
GSnd->GetAudibility(chan), GSnd->GetPosition(chan), ((int)chan->OrgID)-1, S_sfx[chan->SoundID].name.GetChars());
|
||||||
ch++;
|
ch++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
#include "savegamehelp.h"
|
#include "savegamehelp.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
|
@ -805,6 +806,7 @@ void faketimerhandler()
|
||||||
|
|
||||||
void timerhandler()
|
void timerhandler()
|
||||||
{
|
{
|
||||||
|
UpdateSounds();
|
||||||
scan_char++;
|
scan_char++;
|
||||||
if (scan_char == kTimerTicks)
|
if (scan_char == kTimerTicks)
|
||||||
{
|
{
|
||||||
|
@ -1840,8 +1842,10 @@ void CheckCommandLine(int argc, char const* const* argv, int &doTitle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GameInterface::app_main()
|
int GameInterface::app_main()
|
||||||
{
|
{
|
||||||
|
C_DoCommand("stat sounddebug");
|
||||||
int i;
|
int i;
|
||||||
//int esi = 1;
|
//int esi = 1;
|
||||||
//int edi = esi;
|
//int edi = esi;
|
||||||
|
@ -2209,7 +2213,6 @@ GAMELOOP:
|
||||||
|
|
||||||
// TODO CONTROL_GetButtonInput();
|
// TODO CONTROL_GetButtonInput();
|
||||||
CheckKeys();
|
CheckKeys();
|
||||||
UpdateSounds();
|
|
||||||
|
|
||||||
if (bRecord || bPlayback)
|
if (bRecord || bPlayback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,6 +182,7 @@ class EXSoundEngine : public SoundEngine
|
||||||
{
|
{
|
||||||
if (inf.snd_channel == chan) inf.snd_channel = nullptr;
|
if (inf.snd_channel == chan) inf.snd_channel = nullptr;
|
||||||
}
|
}
|
||||||
|
SoundEngine::ChannelEnded(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue