- removed some redundant utility functions.

This commit is contained in:
Christoph Oelckers 2020-11-18 00:43:56 +01:00
parent 8bfc6d98d4
commit 7945242fa8
2 changed files with 2 additions and 20 deletions

View file

@ -534,15 +534,6 @@ inline int ClipRange(int a, int b, int c)
return a;
}
inline float ClipRangeF(float a, float b, float c)
{
if (a < b)
return b;
if (a > c)
return c;
return a;
}
inline int interpolate(int a, int b, int c)
{
return a+mulscale16(b-a,c);

View file

@ -49,6 +49,7 @@
#include "v_draw.h"
#include "s_music.h"
#include "cmdlib.h"
#include "templates.h"
@ -91,16 +92,6 @@ static const int16_t delta_table[] = {
// macro to fetch 16-bit little-endian words from a bytestream
#define LE_16(x) ((*x) | ((*(x+1)) << 8))
static int ClipRange(int val, int min, int max)
{
if (val < min)
return min;
else if (val > max)
return max;
else
return val;
}
static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* userdata)
{
InterplayDecoder* pId = (InterplayDecoder*)userdata;
@ -380,7 +371,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
for (; i < (nSamples / 2); i++)
{
predictor[ch] += delta_table[fr.ReadUInt8()];
predictor[ch] = ClipRange(predictor[ch], -32768, 32768);
predictor[ch] = clamp(predictor[ch], -32768, 32768);
audio.samples[audio.nWrite++] = predictor[ch];
if (audio.nWrite >= countof(audio.samples)) audio.nWrite = 0;