- consolidated the 4 ReadSound functions.

This commit is contained in:
Christoph Oelckers 2023-08-19 18:11:19 +02:00
parent 3c695a5abd
commit 2095a2120c
7 changed files with 14 additions and 35 deletions

View file

@ -83,6 +83,18 @@ void FX_SetReverb(int strength)
}
//==========================================================================
//
//
//
//==========================================================================
std::vector<uint8_t> RazeSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
}
//==========================================================================
//
// S_NoiseDebug

View file

@ -47,4 +47,5 @@ public:
virtual bool SourceIsActor(FSoundChan* chan) { return chan->SourceType == SOURCE_Actor; }
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
virtual void SetSource(FSoundChan* chan, int index) {}
std::vector<uint8_t> ReadSound(int lumpnum) override;
};

View file

@ -85,7 +85,7 @@ bool RTS_IsInitialized()
auto fr = fileSystem.OpenFileReader(RTSName);
RTSName = ""; // don't try ever again.
if (!fr.isOpen()) return false;
RTSFile.Resize(fr.GetLength());
RTSFile.Resize((unsigned)fr.GetLength());
fr.Read(RTSFile.Data(), fr.GetLength());
if (RTSFile.Size() >= 28) // minimum size for one entry
{

View file

@ -33,7 +33,6 @@ class BloodSoundEngine : public RazeSoundEngine
{
// client specific parts of the sound engine go in this class.
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* channel) override;
std::vector<uint8_t> ReadSound(int lumpnum) override;
public:
BloodSoundEngine()
@ -63,12 +62,6 @@ public:
//
//==========================================================================
std::vector<uint8_t> BloodSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
}
void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan*)
{
if (pos != nullptr && type != SOURCE_None)

View file

@ -139,18 +139,6 @@ static FSoundID GetReplacementSound(FSoundID soundNum)
return soundNum;
}
//==========================================================================
//
//
//
//==========================================================================
std::vector<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
}
//==========================================================================
//
//

View file

@ -137,7 +137,6 @@ class EXSoundEngine : public RazeSoundEngine
{
// client specific parts of the sound engine go in this class.
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* chan) override;
std::vector<uint8_t> ReadSound(int lumpnum) override;
public:
EXSoundEngine()
@ -159,19 +158,6 @@ public:
};
//==========================================================================
//
//
//
//==========================================================================
std::vector<uint8_t> EXSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
}
//==========================================================================
//
//

View file

@ -363,7 +363,6 @@ class SWSoundEngine : public RazeSoundEngine
{
// client specific parts of the sound engine go in this class.
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* chan) override;
std::vector<uint8_t> ReadSound(int lumpnum) override;
public:
SWSoundEngine()