Skip to content

Commit

Permalink
Remove LoadSoundBuffered since its no longer called
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat authored and coelckers committed Feb 1, 2020
1 parent 30bdd0c commit 3c975f1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 63 deletions.
7 changes: 0 additions & 7 deletions src/sound/backend/i_sound.cpp
Expand Up @@ -487,10 +487,3 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length)
if (data) delete[] data;
return retval;
}

SoundHandle SoundRenderer::LoadSoundBuffered(FSoundLoadBuffer *buffer)
{
SoundHandle retval = { NULL };
return retval;
}

1 change: 0 additions & 1 deletion src/sound/backend/i_sound.h
Expand Up @@ -110,7 +110,6 @@ class SoundRenderer
virtual SoundHandle LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *pBuffer = nullptr) = 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 SoundHandle LoadSoundBuffered(FSoundLoadBuffer *buffer);
virtual void UnloadSound (SoundHandle sfx) = 0; // unloads a sound from memory
virtual unsigned int GetMSLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency
virtual unsigned int GetSampleLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency
Expand Down
54 changes: 0 additions & 54 deletions src/sound/backend/oalsound.cpp
Expand Up @@ -1134,60 +1134,6 @@ SoundHandle OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, FSoundL
return retval;
}

SoundHandle OpenALSoundRenderer::LoadSoundBuffered(FSoundLoadBuffer *pBuffer)
{
SoundHandle retval = { NULL };
ALenum format = AL_NONE;
int srate = pBuffer->srate;
auto type = pBuffer->type;
auto chans = pBuffer->chans;
uint32_t loop_start = pBuffer->loop_start, loop_end = pBuffer->loop_end;

if (chans == ChannelConfig_Mono)
{
if (type == SampleType_UInt8) format = AL_FORMAT_MONO8;
if (type == SampleType_Int16) format = AL_FORMAT_MONO16;
}
else if (chans == ChannelConfig_Stereo)
{
if (type == SampleType_UInt8) format = AL_FORMAT_STEREO8;
if (type == SampleType_Int16) format = AL_FORMAT_STEREO16;
}

if (format == AL_NONE)
{
Printf("Unsupported audio format: %s, %s\n", GetChannelConfigName(chans),
GetSampleTypeName(type));
return retval;
}

auto &data = pBuffer->mBuffer;

ALenum err;
ALuint buffer = 0;
alGenBuffers(1, &buffer);
alBufferData(buffer, format, &data[0], (ALsizei)data.size(), srate);
if ((err = getALError()) != AL_NO_ERROR)
{
Printf("Failed to buffer data: %s\n", alGetString(err));
alDeleteBuffers(1, &buffer);
getALError();
return retval;
}

// the loop points were already validated by the previous load.
if ((loop_start > 0 || loop_end > 0) && loop_end > loop_start && AL.SOFT_loop_points)
{
ALint loops[2] = { static_cast<ALint>(loop_start), static_cast<ALint>(loop_end) };
DPrintf(DMSG_NOTIFY, "Setting loop points %d -> %d\n", loops[0], loops[1]);
alBufferiv(buffer, AL_LOOP_POINTS_SOFT, loops);
// no console messages here, please!
}

retval.data = MAKE_PTRID(buffer);
return retval;
}

void OpenALSoundRenderer::UnloadSound(SoundHandle sfx)
{
if(!sfx.data)
Expand Down
1 change: 0 additions & 1 deletion src/sound/backend/oalsound.h
Expand Up @@ -126,7 +126,6 @@ class OpenALSoundRenderer : public SoundRenderer
virtual void SetSfxVolume(float volume);
virtual void SetMusicVolume(float volume);
virtual SoundHandle LoadSound(uint8_t *sfxdata, int length, FSoundLoadBuffer *buffer);
virtual SoundHandle LoadSoundBuffered(FSoundLoadBuffer *buffer);
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);
Expand Down

0 comments on commit 3c975f1

Please sign in to comment.