Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get rid of the LoadSound3D method
It no longer does anything since there's no separate buffer for 3D sfx.
  • Loading branch information
kcat authored and coelckers committed Feb 1, 2020
1 parent d823091 commit 30bdd0c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
48 changes: 0 additions & 48 deletions src/sound/s_sound.cpp
Expand Up @@ -174,7 +174,6 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx)
// Since we do not know in what format the sound will be used, we have to cache both.
FSoundLoadBuffer SoundBuffer;
LoadSound(sfx, &SoundBuffer);
LoadSound3D(sfx, &SoundBuffer);
sfx->bUsed = true;
}
}
Expand Down Expand Up @@ -575,7 +574,6 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,

if (attenuation > 0 && type != SOURCE_None)
{
LoadSound3D(sfx, &SoundBuffer);
chan = (FSoundChan*)GSnd->StartSound3D (sfx->data, &listener, float(volume), rolloff, float(attenuation), pitch, basepriority, pos, vel, channel, startflags, NULL);
}
else
Expand Down Expand Up @@ -680,7 +678,6 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
return;
}

LoadSound3D(sfx, &SoundBuffer);
chan->ChanFlags &= ~(CHANF_EVICTED|CHANF_ABSTIME);
ochan = (FSoundChan*)GSnd->StartSound3D(sfx->data, &listener, chan->Volume, &chan->Rolloff, chan->DistanceScale, chan->Pitch,
chan->Priority, pos, vel, chan->EntChannel, startflags, chan);
Expand Down Expand Up @@ -780,51 +777,6 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
return sfx;
}

void SoundEngine::LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
{
if (GSnd->IsNull()) return;

if(sfx->data.isValid())
return;

//DPrintf(DMSG_NOTIFY, "Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);

if (pBuffer->mBuffer.size() > 0)
{
sfx->data = GSnd->LoadSoundBuffered(pBuffer);
}
else if (sfx->lumpnum >= 0)
{
auto sfxdata = ReadSound(sfx->lumpnum);
int size = sfxdata.Size();
if (size <= 8) return;
int32_t dmxlen = LittleLong(((int32_t *)sfxdata.Data())[1]);

// If the sound is voc, use the custom loader.
if (strncmp((const char *)sfxdata.Data(), "Creative Voice File", 19) == 0)
{
sfx->data = GSnd->LoadSoundVoc(sfxdata.Data(), size);
}
// If the sound is raw, just load it as such.
else if (sfx->bLoadRAW)
{
sfx->data = GSnd->LoadSoundRaw(sfxdata.Data(), size, sfx->RawRate, 1, 8, sfx->LoopStart);
}
// Otherwise, try the sound as DMX format.
else if (((uint8_t *)sfxdata.Data())[0] == 3 && ((uint8_t *)sfxdata.Data())[1] == 0 && dmxlen <= size - 8)
{
int frequency = LittleShort(((uint16_t *)sfxdata.Data())[1]);
if (frequency == 0) frequency = 11025;
sfx->data = GSnd->LoadSoundRaw(sfxdata.Data() + 8, dmxlen, frequency, 1, 8, sfx->LoopStart, -1);
}
// If that fails, let the sound system try and figure it out.
else
{
sfx->data = GSnd->LoadSound(sfxdata.Data(), size, pBuffer);
}
}
}

//==========================================================================
//
// S_CheckSingular
Expand Down
1 change: 0 additions & 1 deletion src/sound/s_soundinternal.h
Expand Up @@ -248,7 +248,6 @@ class SoundEngine
TArray<FRandomSoundList> S_rnd;

private:
void LoadSound3D(sfxinfo_t* sfx, FSoundLoadBuffer* pBuffer);
void LinkChannel(FSoundChan* chan, FSoundChan** head);
void UnlinkChannel(FSoundChan* chan);
void ReturnChannel(FSoundChan* chan);
Expand Down

0 comments on commit 30bdd0c

Please sign in to comment.