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 drfrag
parent c37caf4498
commit 350d57e8db
8 changed files with 12 additions and 37 deletions

View file

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

View file

@ -88,16 +88,6 @@ typedef bool (*SoundStreamCallback)(SoundStream *stream, void *buff, int len, vo
struct SoundDecoder;
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
{
public:
@ -107,7 +97,7 @@ public:
virtual bool IsNull() { return false; }
virtual void SetSfxVolume (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);
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

View file

@ -1046,7 +1046,7 @@ SoundHandle OpenALSoundRenderer::LoadSoundRaw(uint8_t *sfxdata, int length, int
return retval;
}
SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *pBuffer)
SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length)
{
SoundHandle retval = { NULL };
ALenum format = AL_NONE;
@ -1122,15 +1122,6 @@ SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, FSoundL
}
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;
}

View file

@ -125,7 +125,7 @@ public:
virtual void SetSfxVolume(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 void UnloadSound(SoundHandle sfx);
virtual unsigned int GetMSLength(SoundHandle sfx);

View file

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

View file

@ -172,9 +172,7 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx)
}
else
{
// Since we do not know in what format the sound will be used, we have to cache both.
FSoundLoadBuffer SoundBuffer;
LoadSound(sfx, &SoundBuffer);
LoadSound(sfx);
sfx->bUsed = true;
}
}
@ -384,7 +382,6 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
FSoundChan *chan;
FVector3 pos, vel;
FRolloffInfo *rolloff;
FSoundLoadBuffer SoundBuffer;
if (sound_id <= 0 || volume <= 0 || nosfx || nosound )
return NULL;
@ -482,7 +479,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
}
// Make sure the sound is loaded.
sfx = LoadSound(sfx, &SoundBuffer);
sfx = LoadSound(sfx);
// The empty sound never plays.
if (sfx->lumpnum == sfx_empty)
@ -639,13 +636,12 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
FSoundChan *ochan;
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 (sfx->bSingular && CheckSingular(chan->SoundID))
return;
sfx = LoadSound(sfx, &SoundBuffer);
sfx = LoadSound(sfx);
// The empty sound never plays.
if (sfx->lumpnum == sfx_empty)
@ -703,7 +699,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;
@ -761,7 +757,7 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
// If that fails, let the sound system try and figure it out.
else
{
sfx->data = GSnd->LoadSound(sfxdata.Data(), size, pBuffer);
sfx->data = GSnd->LoadSound(sfxdata.Data(), size);
}
}
@ -1602,7 +1598,7 @@ unsigned int SoundEngine::GetMSLength(FSoundID sound)
}
}
sfx = LoadSound(sfx, nullptr);
sfx = LoadSound(sfx);
if (sfx != NULL) return GSnd->GetMSLength(sfx->data);
else return 0;
}

View file

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

View file

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