Remove FSoundLoadBuffer since it wasn't doing anything

This commit is contained in:
Chris Robinson 2020-01-31 17:34:44 -08:00 committed by Christoph Oelckers
parent 3c975f18bc
commit 5b4c9eb7f6
8 changed files with 12 additions and 37 deletions

View file

@ -127,7 +127,7 @@ public:
void SetMusicVolume (float volume) void SetMusicVolume (float volume)
{ {
} }
SoundHandle LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *pBuffer) SoundHandle LoadSound(uint8_t *sfxdata, int length)
{ {
SoundHandle retval = { NULL }; SoundHandle retval = { NULL };
return retval; return retval;

View file

@ -88,16 +88,6 @@ typedef bool (*SoundStreamCallback)(SoundStream *stream, void *buff, int len, vo
struct SoundDecoder; struct SoundDecoder;
class MIDIDevice; class MIDIDevice;
struct FSoundLoadBuffer
{
std::vector<uint8_t> mBuffer;
uint32_t loop_start;
uint32_t loop_end;
ChannelConfig chans;
SampleType type;
int srate;
};
class SoundRenderer class SoundRenderer
{ {
public: public:
@ -107,7 +97,7 @@ public:
virtual bool IsNull() { return false; } virtual bool IsNull() { return false; }
virtual void SetSfxVolume (float volume) = 0; virtual void SetSfxVolume (float volume) = 0;
virtual void SetMusicVolume (float volume) = 0; virtual void SetMusicVolume (float volume) = 0;
virtual SoundHandle LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *pBuffer = nullptr) = 0; virtual SoundHandle LoadSound(uint8_t *sfxdata, int length) = 0;
SoundHandle LoadSoundVoc(uint8_t *sfxdata, int length); SoundHandle LoadSoundVoc(uint8_t *sfxdata, int length);
virtual SoundHandle LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1) = 0; virtual SoundHandle LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1) = 0;
virtual void UnloadSound (SoundHandle sfx) = 0; // unloads a sound from memory virtual void UnloadSound (SoundHandle sfx) = 0; // unloads a sound from memory

View file

@ -1046,7 +1046,7 @@ SoundHandle OpenALSoundRenderer::LoadSoundRaw(uint8_t *sfxdata, int length, int
return retval; return retval;
} }
SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *pBuffer) SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length)
{ {
SoundHandle retval = { NULL }; SoundHandle retval = { NULL };
ALenum format = AL_NONE; ALenum format = AL_NONE;
@ -1122,15 +1122,6 @@ SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, FSoundL
} }
retval.data = MAKE_PTRID(buffer); retval.data = MAKE_PTRID(buffer);
if (pBuffer != nullptr)
{
pBuffer->mBuffer = std::move(data);
pBuffer->loop_start = loop_start;
pBuffer->loop_end = loop_end;
pBuffer->chans = chans;
pBuffer->type = type;
pBuffer->srate = srate;
}
return retval; return retval;
} }

View file

@ -125,7 +125,7 @@ public:
virtual void SetSfxVolume(float volume); virtual void SetSfxVolume(float volume);
virtual void SetMusicVolume(float volume); virtual void SetMusicVolume(float volume);
virtual SoundHandle LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *buffer); virtual SoundHandle LoadSound(uint8_t *sfxdata, int length);
virtual SoundHandle LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1); virtual SoundHandle LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1);
virtual void UnloadSound(SoundHandle sfx); virtual void UnloadSound(SoundHandle sfx);
virtual unsigned int GetMSLength(SoundHandle sfx); virtual unsigned int GetMSLength(SoundHandle sfx);

View file

@ -413,7 +413,7 @@ unsigned int S_GetMSLength(FSoundID sound)
} }
} }
sfx = soundEngine->LoadSound(sfx, nullptr); sfx = soundEngine->LoadSound(sfx);
if (sfx != NULL) return GSnd->GetMSLength(sfx->data); if (sfx != NULL) return GSnd->GetMSLength(sfx->data);
else return 0; else return 0;
} }

View file

@ -171,9 +171,7 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx)
} }
else else
{ {
// Since we do not know in what format the sound will be used, we have to cache both. LoadSound(sfx);
FSoundLoadBuffer SoundBuffer;
LoadSound(sfx, &SoundBuffer);
sfx->bUsed = true; sfx->bUsed = true;
} }
} }
@ -383,7 +381,6 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
FSoundChan *chan; FSoundChan *chan;
FVector3 pos, vel; FVector3 pos, vel;
FRolloffInfo *rolloff; FRolloffInfo *rolloff;
FSoundLoadBuffer SoundBuffer;
if (sound_id <= 0 || volume <= 0 || nosfx || nosound ) if (sound_id <= 0 || volume <= 0 || nosfx || nosound )
return NULL; return NULL;
@ -481,7 +478,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
} }
// Make sure the sound is loaded. // Make sure the sound is loaded.
sfx = LoadSound(sfx, &SoundBuffer); sfx = LoadSound(sfx);
// The empty sound never plays. // The empty sound never plays.
if (sfx->lumpnum == sfx_empty) if (sfx->lumpnum == sfx_empty)
@ -638,13 +635,12 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
FSoundChan *ochan; FSoundChan *ochan;
sfxinfo_t *sfx = &S_sfx[chan->SoundID]; sfxinfo_t *sfx = &S_sfx[chan->SoundID];
FSoundLoadBuffer SoundBuffer;
// If this is a singular sound, don't play it if it's already playing. // If this is a singular sound, don't play it if it's already playing.
if (sfx->bSingular && CheckSingular(chan->SoundID)) if (sfx->bSingular && CheckSingular(chan->SoundID))
return; return;
sfx = LoadSound(sfx, &SoundBuffer); sfx = LoadSound(sfx);
// The empty sound never plays. // The empty sound never plays.
if (sfx->lumpnum == sfx_empty) if (sfx->lumpnum == sfx_empty)
@ -702,7 +698,7 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
// //
//========================================================================== //==========================================================================
sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer) sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
{ {
if (GSnd->IsNull()) return sfx; if (GSnd->IsNull()) return sfx;
@ -760,7 +756,7 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
// If that fails, let the sound system try and figure it out. // If that fails, let the sound system try and figure it out.
else else
{ {
sfx->data = GSnd->LoadSound(sfxdata.Data(), size, pBuffer); sfx->data = GSnd->LoadSound(sfxdata.Data(), size);
} }
} }
@ -1600,7 +1596,7 @@ unsigned int SoundEngine::GetMSLength(FSoundID sound)
} }
} }
sfx = LoadSound(sfx, nullptr); sfx = LoadSound(sfx);
if (sfx != NULL) return GSnd->GetMSLength(sfx->data); if (sfx != NULL) return GSnd->GetMSLength(sfx->data);
else return 0; else return 0;
} }

View file

@ -44,8 +44,6 @@ struct FLevelLocals;
// Called after a level is loaded. Ensures that most sounds are loaded. // Called after a level is loaded. Ensures that most sounds are loaded.
struct FSoundLoadBuffer;
// [RH] S_sfx "maintenance" routines // [RH] S_sfx "maintenance" routines
void S_ClearSoundData(); void S_ClearSoundData();
void S_ParseSndInfo (bool redefine); void S_ParseSndInfo (bool redefine);

View file

@ -274,7 +274,7 @@ public:
void EvictAllChannels(); void EvictAllChannels();
void StopChannel(FSoundChan* chan); void StopChannel(FSoundChan* chan);
sfxinfo_t* LoadSound(sfxinfo_t* sfx, FSoundLoadBuffer* pBuffer); sfxinfo_t* LoadSound(sfxinfo_t* sfx);
// Initializes sound stuff, including volume // Initializes sound stuff, including volume
// Sets channels, SFX and music volume, // Sets channels, SFX and music volume,