summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/DPL2Decoder.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2014-02-05 22:07:53 +1300
committerMatthew Parlane <parlane@gmail.com>2014-02-05 22:07:53 +1300
commitcfa2d012c81e7d162487871b4c18c1c9f10e534a (patch)
tree30463902455976f0c3dee3e376527fe3ac743f31 /Source/Core/AudioCommon/DPL2Decoder.cpp
parent59e2179172a5881cb53b2048cc01ae1f52b0b703 (diff)
parent249b00c4691fb4dbd9e1c833ceccc53526babd21 (diff)
Merge pull request #36 from lioncash/generic-clamp-function
Introduce a generic clamp function to clean up some of the various 'if-else' clamps throughout parts of the codebase.
Diffstat (limited to 'Source/Core/AudioCommon/DPL2Decoder.cpp')
-rw-r--r--Source/Core/AudioCommon/DPL2Decoder.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp
index 97bdb5413d..399541c1c9 100644
--- a/Source/Core/AudioCommon/DPL2Decoder.cpp
+++ b/Source/Core/AudioCommon/DPL2Decoder.cpp
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include "DPL2Decoder.h"
+#include "MathUtil.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -72,17 +73,6 @@ template<class T> static T firfilter(const T *buf, int pos, int len, int count,
return T(r1+r2);
}
-template<class T> inline const T& limit(const T& val, const T& min, const T& max)
-{
- if (val < min) {
- return min;
- } else if (val > max) {
- return max;
- } else {
- return val;
- }
-}
-
/*
// Hamming
// 2*pi*k
@@ -133,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
// Sanity check
if(*n==0) return NULL;
- fc[0]=limit(fc[0],float(0.001),float(1));
+ MathUtil::Clamp(&fc[0],float(0.001),float(1));
float *w=(float*)calloc(sizeof(float),*n);