aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-17 18:54:10 -0800
committerChris Robinson <[email protected]>2018-11-17 18:54:10 -0800
commit1468dee831c6d2d2b05d4fb29de062c72ea3a324 (patch)
tree8442cce5bc4865ca5dffab474ca45daf70bcddf2
parent9992cef9159cbee8d97fdc43733d370877129ddc (diff)
Convert bs2b.c to C++
-rw-r--r--Alc/bs2b.cpp (renamed from Alc/bs2b.c)15
-rw-r--r--CMakeLists.txt2
2 files changed, 9 insertions, 8 deletions
diff --git a/Alc/bs2b.c b/Alc/bs2b.cpp
index e0ce3249..1307e5c1 100644
--- a/Alc/bs2b.c
+++ b/Alc/bs2b.cpp
@@ -23,11 +23,12 @@
#include "config.h"
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
+#include <algorithm>
#include "bs2b.h"
-#include "alu.h"
+#include "math_defs.h"
/* Set up all data. */
@@ -90,11 +91,11 @@ static void init(struct bs2b *bs2b)
* $d = 1 / 2 / pi / $fc;
* $x = exp(-1 / $d);
*/
- x = expf(-2.0f * F_PI * Fc_lo / bs2b->srate);
+ x = std::exp(-2.0f * F_PI * Fc_lo / bs2b->srate);
bs2b->b1_lo = x;
bs2b->a0_lo = G_lo * (1.0f - x) * g;
- x = expf(-2.0f * F_PI * Fc_hi / bs2b->srate);
+ x = std::exp(-2.0f * F_PI * Fc_hi / bs2b->srate);
bs2b->b1_hi = x;
bs2b->a0_hi = (1.0f - G_hi * (1.0f - x)) * g;
bs2b->a1_hi = -x * g;
@@ -126,7 +127,7 @@ int bs2b_get_srate(struct bs2b *bs2b)
void bs2b_clear(struct bs2b *bs2b)
{
- memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample));
+ std::memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample));
} /* bs2b_clear */
void bs2b_cross_feed(struct bs2b *bs2b, float *RESTRICT Left, float *RESTRICT Right, int SamplesToDo)
@@ -137,7 +138,7 @@ void bs2b_cross_feed(struct bs2b *bs2b, float *RESTRICT Left, float *RESTRICT Ri
for(base = 0;base < SamplesToDo;)
{
- int todo = mini(128, SamplesToDo-base);
+ int todo = std::min(128, SamplesToDo-base);
int i;
/* Process left input */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1b1e18f..89357900 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -786,7 +786,7 @@ SET(ALC_OBJS
Alc/alu.cpp
Alc/alconfig.cpp
Alc/alconfig.h
- Alc/bs2b.c
+ Alc/bs2b.cpp
Alc/converter.cpp
Alc/converter.h
Alc/inprogext.h