- fixed the fire sound in the intro.

This commit is contained in:
Christoph Oelckers 2019-12-27 23:09:05 +01:00
parent bea7391ac9
commit 93fccfd767
3 changed files with 24 additions and 27 deletions

View file

@ -1343,9 +1343,7 @@ void FinishLevel()
if (levelnum != kMap20)
{
EraseScreen(4);
SetLocalChan(1);
PlayLocalSound(StaticSound[59], 0);
SetLocalChan(0);
PlayLocalSound(StaticSound[59], 0, true);
videoNextPage();
WaitTicks(12);
WaitVBL();
@ -2570,10 +2568,7 @@ void DoTitle()
SetOverscan(BASEPAL);
GrabPalette();
SetLocalChan(1);
PlayLocalSound(StaticSound[59], 0);
SetLocalChan(0);
PlayLocalSound(StaticSound[59], 0, true);
EraseScreen(4);

View file

@ -160,11 +160,6 @@ enum
nSwirlyChan4,
};
void SetLocalChan(int c)
{
nLocalChan = c;
}
//==========================================================================
//
//
@ -337,33 +332,41 @@ void BendAmbientSound(void)
//
//==========================================================================
void PlayLocalSound(short nSound, short nRate)
void PlayLocalSound(short nSound, short nRate, bool unattached)
{
if (nSound < 0 || nSound >= kMaxSounds || !soundEngine->isValidSoundId(nSound + 1))
{
initprintf("PlayLocalSound: Invalid sound nSound == %i, nRate == %i\n", nSound, nRate);
return;
}
int bLoop = looped[nSound];
if (nLocalChan == nAmbientChannel)
nAmbientChannel = -1;
int bLoop = looped[nSound];
ActiveSound* pASound = &sActiveSound[nLocalChan];
if (pASound->snd_channel != nullptr)
soundEngine->StopChannel(pASound->snd_channel);
// There is exactly one occurence in the entire game which alters the pitch.
pASound->snd_channel = soundEngine->StartSound(SOURCE_Unattached, nullptr, nullptr, CHAN_BODY, CHANF_OVERLAP, nSound + 1, 1.f, ATTN_NONE, nullptr);
if (nRate && pASound->snd_channel)
ActiveSound* pASound = nullptr;
if (!unattached)
{
float ratefac = (11025 + nRate) / 11025.f;
soundEngine->SetPitch(pASound->snd_channel, ratefac);
pASound = &sActiveSound[nLocalChan];
if (pASound->snd_channel != nullptr)
soundEngine->StopChannel(pASound->snd_channel);
}
pASound->snd_id = nSound;
// There is exactly one occurence in the entire game which alters the pitch, and that's the laugh on the logo.
auto chan = soundEngine->StartSound(SOURCE_Unattached, nullptr, nullptr, CHAN_BODY, CHANF_OVERLAP, nSound + 1, 1.f, ATTN_NONE, nullptr);
if (nRate && chan)
{
float ratefac = (11025 + nRate) / 11025.f;
soundEngine->SetPitch(chan, ratefac);
}
if (pASound)
{
pASound->snd_id = nSound;
pASound->snd_channel = chan;
}
}
//==========================================================================

View file

@ -125,11 +125,10 @@ int fadecdaudio();
int LocalSoundPlaying();
void LoadFX();
void StopAllSounds();
void SetLocalChan(int nChannel);
int GetLocalSound();
void UpdateLocalSound();
void StopLocalSound();
void PlayLocalSound(short nSound, short val);
void PlayLocalSound(short nSound, short val, bool unattached = false);
int LoadSound(const char* sound);
void BendAmbientSound();