From 99209c4a2a7fb324cf89669f37eee5b8f2dd8abc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 30 Jun 2013 04:47:10 -0700 Subject: [PATCH] Remove an unnecessary function --- src/sound/oalsound.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 805dde2b3..541308a64 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -137,18 +137,6 @@ static ALCenum checkALCError(ALCdevice *device, const char *fn, unsigned int ln) } #define getALCError(d) checkALCError((d), __FILE__, __LINE__) -static ALsizei GetBufferLength(ALuint buffer, const char *fn, unsigned int ln) -{ - ALint bits, channels, size; - alGetBufferi(buffer, AL_BITS, &bits); - alGetBufferi(buffer, AL_CHANNELS, &channels); - alGetBufferi(buffer, AL_SIZE, &size); - if(checkALError(fn, ln) == AL_NO_ERROR) - return (ALsizei)(size / (channels * bits / 8)); - return 0; -} -#define getBufferLength(b) GetBufferLength((b), __FILE__, __LINE__) - extern ReverbContainer *ForcedEnvironment; #define PITCH_MULT (0.7937005f) /* Approx. 4 semitones lower; what Nash suggested */ @@ -575,9 +563,17 @@ unsigned int OpenALSoundRenderer::GetMSLength(SoundHandle sfx) unsigned int OpenALSoundRenderer::GetSampleLength(SoundHandle sfx) { - if(!sfx.data) - return 0; - return getBufferLength(*((ALuint*)sfx.data)); + if(sfx.data) + { + ALuint buffer = *((ALuint*)sfx.data); + ALint bits, channels, size; + alGetBufferi(buffer, AL_BITS, &bits); + alGetBufferi(buffer, AL_CHANNELS, &channels); + alGetBufferi(buffer, AL_SIZE, &size); + if(getALError() == AL_NO_ERROR) + return (ALsizei)(size / (channels * bits / 8)); + } + return 0; } float OpenALSoundRenderer::GetOutputRate()