changed SoundEngine::ReadSound back to a TArray.

This commit is contained in:
Christoph Oelckers 2023-12-10 09:00:55 +01:00
parent 41573df58f
commit 54fb37e39e
3 changed files with 8 additions and 5 deletions

View file

@ -1141,7 +1141,7 @@ SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, int def
return retval;
}
std::vector<uint8_t> data;
TArray<uint8_t> data;
unsigned total = 0;
unsigned got;

View file

@ -216,7 +216,7 @@ private:
// Checks if a copy of this sound is already playing.
bool CheckSingular(FSoundID sound_id);
virtual std::vector<uint8_t> ReadSound(int lumpnum) = 0;
virtual TArray<uint8_t> ReadSound(int lumpnum) = 0;
protected:
virtual bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel, float attenuation);

View file

@ -81,7 +81,7 @@ class DoomSoundEngine : public SoundEngine
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID soundid, FVector3* pos, FVector3* vel, FSoundChan *) override;
bool ValidatePosVel(int sourcetype, const void* source, const FVector3& pos, const FVector3& vel);
std::vector<uint8_t> ReadSound(int lumpnum);
TArray<uint8_t> ReadSound(int lumpnum);
FSoundID PickReplacement(FSoundID refid);
FSoundID ResolveSound(const void *ent, int type, FSoundID soundid, float &attenuation) override;
void CacheSound(sfxinfo_t* sfx) override;
@ -1166,10 +1166,13 @@ bool DoomSoundEngine::ValidatePosVel(int sourcetype, const void* source, const F
//
//==========================================================================
std::vector<uint8_t> DoomSoundEngine::ReadSound(int lumpnum)
TArray<uint8_t> DoomSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
TArray<uint8_t> buffer(wlump.GetLength(), true);
auto len = wlump.Read(buffer.data(), buffer.size());
buffer.Resize(len);
return buffer;
}
//==========================================================================