mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 11:40:44 +00:00
- Blood: add a dummy sound entry at index 0.
Parts of the sound system treat entry 0 as "no sound" so nothing placed there would play. This made the one custom sound in "The Way of Ira" not play because as the last sound being defined it ended up in the first, invalid slot.
This commit is contained in:
parent
d25838fe15
commit
f87e40131f
4 changed files with 54 additions and 48 deletions
|
@ -208,50 +208,50 @@ void S_SerializeSounds(FSerializer& arc)
|
|||
{
|
||||
FSoundChan* chan;
|
||||
|
||||
GSnd->Sync(true);
|
||||
GSnd->Sync(true);
|
||||
|
||||
if (arc.isWriting())
|
||||
if (arc.isWriting())
|
||||
{
|
||||
// Count channels and accumulate them so we can store them in
|
||||
// reverse order. That way, they will be in the same order when
|
||||
// reloaded later as they are now.
|
||||
TArray<FSoundChan*> chans = soundEngine->AllActiveChannels();
|
||||
|
||||
if (chans.Size() > 0 && arc.BeginArray("sounds"))
|
||||
{
|
||||
// Count channels and accumulate them so we can store them in
|
||||
// reverse order. That way, they will be in the same order when
|
||||
// reloaded later as they are now.
|
||||
TArray<FSoundChan*> chans = soundEngine->AllActiveChannels();
|
||||
|
||||
if (chans.Size() > 0 && arc.BeginArray("sounds"))
|
||||
for (unsigned int i = chans.Size(); i-- != 0; )
|
||||
{
|
||||
for (unsigned int i = chans.Size(); i-- != 0; )
|
||||
{
|
||||
// Replace start time with sample position.
|
||||
uint64_t start = chans[i]->StartTime;
|
||||
chans[i]->StartTime = GSnd ? GSnd->GetPosition(chans[i]) : 0;
|
||||
arc(nullptr, *chans[i]);
|
||||
chans[i]->StartTime = start;
|
||||
}
|
||||
arc.EndArray();
|
||||
// Replace start time with sample position.
|
||||
uint64_t start = chans[i]->StartTime;
|
||||
chans[i]->StartTime = GSnd ? GSnd->GetPosition(chans[i]) : 0;
|
||||
arc(nullptr, *chans[i]);
|
||||
chans[i]->StartTime = start;
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int count;
|
||||
|
||||
soundEngine->StopAllChannels();
|
||||
if (arc.BeginArray("sounds"))
|
||||
{
|
||||
unsigned int count;
|
||||
|
||||
soundEngine->StopAllChannels();
|
||||
if (arc.BeginArray("sounds"))
|
||||
count = arc.ArraySize();
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
{
|
||||
count = arc.ArraySize();
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
{
|
||||
chan = (FSoundChan*)soundEngine->GetChannel(nullptr);
|
||||
arc(nullptr, *chan);
|
||||
// Sounds always start out evicted when restored from a save.
|
||||
chan->ChanFlags |= CHANF_EVICTED | CHANF_ABSTIME;
|
||||
}
|
||||
arc.EndArray();
|
||||
chan = (FSoundChan*)soundEngine->GetChannel(nullptr);
|
||||
arc(nullptr, *chan);
|
||||
// Sounds always start out evicted when restored from a save.
|
||||
chan->ChanFlags |= CHANF_EVICTED | CHANF_ABSTIME;
|
||||
}
|
||||
// Add a small delay so that eviction only runs once the game is up and runnnig.
|
||||
soundEngine->SetRestartTime(I_GetTime() + 2);
|
||||
arc.EndArray();
|
||||
}
|
||||
GSnd->Sync(false);
|
||||
GSnd->UpdateSounds();
|
||||
// Add a small delay so that eviction only runs once the game is up and runnnig.
|
||||
soundEngine->SetRestartTime(I_GetTime() + 2);
|
||||
}
|
||||
GSnd->Sync(false);
|
||||
GSnd->UpdateSounds();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -297,3 +297,18 @@ CCMD(playsoundid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD listsounds
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD(listsounds)
|
||||
{
|
||||
auto& S_sfx = soundEngine->GetSounds();
|
||||
for (unsigned i = 0; i < S_sfx.Size(); i++)
|
||||
{
|
||||
Printf("%4d: name = %s, resId = %d, lumpnum = %d\n", i, S_sfx[i].name.GetChars(), S_sfx[i].ResourceId, S_sfx[i].lumpnum);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,15 +58,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
void sfxInit(void)
|
||||
{
|
||||
soundEngine = new BloodSoundEngine;
|
||||
}
|
||||
|
||||
void sfxTerm()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -106,7 +106,8 @@ static void S_AddBloodSFX(int lumpnum)
|
|||
|
||||
void sndInit(void)
|
||||
{
|
||||
sfxInit();
|
||||
soundEngine = new BloodSoundEngine;
|
||||
soundEngine->AddSoundLump("", 0, 0, -1, 6); // add a dummy entry at index #0
|
||||
for (int i = fileSystem.GetNumEntries() - 1; i >= 0; i--)
|
||||
{
|
||||
auto type = fileSystem.GetResourceType(i);
|
||||
|
@ -117,7 +118,8 @@ void sndInit(void)
|
|||
}
|
||||
else if (!stricmp(type, "WAV") || !stricmp(type, "OGG") || !stricmp(type, "FLAC") || !stricmp(type, "VOC"))
|
||||
{
|
||||
soundEngine->AddSoundLump(fileSystem.GetFileFullName(i), i, 0, fileSystem.GetResourceId(i)| 0x40000000, 6); // mark the resource ID as special.
|
||||
if (fileSystem.GetFileNamespace(i) != ns_music)
|
||||
soundEngine->AddSoundLump(fileSystem.GetFileFullName(i), i, 0, fileSystem.GetResourceId(i)| 0x40000000, 6); // mark the resource ID as special.
|
||||
}
|
||||
}
|
||||
soundEngine->HashSounds();
|
||||
|
|
|
@ -50,8 +50,6 @@ void sndProcess(void);
|
|||
void sndTerm(void);
|
||||
void sndInit(void);
|
||||
|
||||
void sfxInit(void);
|
||||
void sfxTerm(void);
|
||||
void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector);
|
||||
void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3 = -1, int a4 = 0);
|
||||
void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3 = -1, int a4 = 0, int pitch = 0, int volume = 0);
|
||||
|
|
Loading…
Reference in a new issue