mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 20:20:54 +00:00
- fixed issues with underwater sound pitch.
This would repeatedly lower the pitch until the sound got inaudible.
This commit is contained in:
parent
dd5c3eee91
commit
afea519b10
1 changed files with 22 additions and 7 deletions
|
@ -243,10 +243,21 @@ void GetSpriteSoundPitch(int* pVolume, int* pPitch)
|
||||||
int nSoundSect = nPlayerViewSect[nLocalPlayer];
|
int nSoundSect = nPlayerViewSect[nLocalPlayer];
|
||||||
int nLocalSectFlags = SectFlag[nSoundSect];
|
int nLocalSectFlags = SectFlag[nSoundSect];
|
||||||
if (nLocalSectFlags & kSectUnderwater)
|
if (nLocalSectFlags & kSectUnderwater)
|
||||||
|
{
|
||||||
|
if (*pVolume == 255)
|
||||||
{
|
{
|
||||||
*pVolume >>= 1;
|
*pVolume >>= 1;
|
||||||
*pPitch -= 1200;
|
*pPitch -= 1200;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*pVolume < 255)
|
||||||
|
{
|
||||||
|
*pVolume = 255;
|
||||||
|
*pPitch += 1200;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -397,7 +408,7 @@ void SoundBigEntrance(void)
|
||||||
StopAllSounds();
|
StopAllSounds();
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
short nPitch = i * 512 - 1200;
|
short nPitch = 11025 + (i * 512 - 1200);
|
||||||
//pASound->snd_pitch = nPitch;
|
//pASound->snd_pitch = nPitch;
|
||||||
soundEngine->StopSound(SOURCE_EXBoss, &fakesources[i], -1);
|
soundEngine->StopSound(SOURCE_EXBoss, &fakesources[i], -1);
|
||||||
soundEngine->StartSound(SOURCE_EXBoss, &fakesources[i], nullptr, CHAN_BODY, CHANF_TRANSIENT, StaticSound[kSoundTorchOn]+1, 200 / 255.f, ATTN_NONE, nullptr, nPitch / 11025.f);
|
soundEngine->StartSound(SOURCE_EXBoss, &fakesources[i], nullptr, CHAN_BODY, CHANF_TRANSIENT, StaticSound[kSoundTorchOn]+1, 200 / 255.f, ATTN_NONE, nullptr, nPitch / 11025.f);
|
||||||
|
@ -523,12 +534,16 @@ void GameInterface::UpdateSounds()
|
||||||
{
|
{
|
||||||
if (!(chan->ChanFlags & (CHANF_UI|CHANF_FORGETTABLE)))
|
if (!(chan->ChanFlags & (CHANF_UI|CHANF_FORGETTABLE)))
|
||||||
{
|
{
|
||||||
int nVolume = 255;
|
int nVolume = int(chan->Volume * 255);
|
||||||
int nPitch = int(chan->Pitch * (11025.f / 128.f)) - 11025;
|
int nPitch = int(chan->Pitch * (11025.f / 128.f)) - 11025;
|
||||||
|
int oVolume = nVolume;
|
||||||
GetSpriteSoundPitch(&nVolume, &nPitch);
|
GetSpriteSoundPitch(&nVolume, &nPitch);
|
||||||
|
if (oVolume != nVolume)
|
||||||
|
{
|
||||||
soundEngine->SetPitch(chan, (11025 + nPitch) / 11025.f);
|
soundEngine->SetPitch(chan, (11025 + nPitch) / 11025.f);
|
||||||
soundEngine->SetVolume(chan, nVolume / 255.f);
|
soundEngine->SetVolume(chan, nVolume / 255.f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue