- consolidation of sound init code.

This commit is contained in:
Christoph Oelckers 2023-05-27 09:12:51 +02:00
parent 6866e86e3e
commit 5dfb0c902a
7 changed files with 19 additions and 33 deletions

View file

@ -45,6 +45,7 @@
#include "gamecontrol.h"
#include "build.h"
#include "coreactor.h"
#include "g_input.h"
extern ReverbContainer* ForcedEnvironment;
static int LastReverb;
@ -273,6 +274,22 @@ void S_SerializeSounds(FSerializer& arc)
GSnd->UpdateSounds();
}
//==========================================================================
//
//
//
//==========================================================================
void S_CacheAllSounds(void)
{
for (unsigned i = 0; i < soundEngine->GetNumSounds(); i++)
{
soundEngine->CacheSound(FSoundID::fromInt(i));
if ((i & 31) == 0)
I_GetEvent();
}
}
//==========================================================================
//
// CCMD playsound

View file

@ -34,6 +34,7 @@ int S_LookupSound(const char* fn);
class FSerializer;
void S_SerializeSounds(FSerializer& arc);
int S_ReserveSoundSlot(const char* logicalname, int slotnum, int limit = 6);
void S_CacheAllSounds(void);
class RazeSoundEngine : public SoundEngine
{

View file

@ -157,22 +157,6 @@ TArray<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
//
//==========================================================================
void S_CacheAllSounds(void)
{
for(unsigned i = 0; i < soundEngine->GetNumSounds(); i++)
{
soundEngine->CacheSound(FSoundID::fromInt(i));
if ((i & 31) == 0)
I_GetEvent();
}
}
//==========================================================================
//
//
//
//==========================================================================
int S_GetUserFlags(FSoundID soundid)
{
if (!soundEngine->isValidSoundId(soundid)) return 0;

View file

@ -39,7 +39,6 @@ void S_ChangeSoundPitch(FSoundID soundNum, DDukeActor* spriteNum, int pitchoffse
int S_CheckActorSoundPlaying(DDukeActor* spriteNum, FSoundID soundNum, int channel = 0);
int S_CheckSoundPlaying(FSoundID soundNum);
void S_CacheAllSounds(void);
int S_DefineSound(unsigned index, const char* filename, int ps, int pe, int pr, int m, int vo, float vol);
void S_WorldTourMappingsForOldSounds();
void S_MenuSound(void);

View file

@ -305,7 +305,7 @@ void GameInterface::app_init()
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
userConfig.AddDefs.reset();
InitFX();
S_CacheAllSounds();
}
//---------------------------------------------------------------------------

View file

@ -428,20 +428,6 @@ void GameInterface::StartSoundEngine()
soundEngine = new SWSoundEngine;
}
void InitFX(void)
{
auto &S_sfx = soundEngine->GetSounds();
soundEngine->HashSounds();
for (auto& sfx : S_sfx)
{
soundEngine->CacheSound(&sfx);
}
}
//==========================================================================
//
//

View file

@ -72,7 +72,6 @@ void DeleteNoFollowSoundOwner(DSWActor*);
inline bool CacheSound(int num, int type) { return false; }
void COVER_SetReverb(int amt);
void UnInitSound(void);
void InitFX(void);
void StopFX(void);
void StopSound(void);
void StartAmbientSound(void);