aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-09-08 15:04:42 -0700
committerChris Robinson <[email protected]>2015-09-08 15:04:42 -0700
commit483352f32b7c62db6c702265e8b8cc21f1d4aae1 (patch)
treece1ddf5eb1f1cebba3256a5073cfa6976fc919bd /Alc
parent475a566e3588cec51492d3ca7741ba900e118e8f (diff)
Set both BS2B parameters at once
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c3
-rw-r--r--Alc/bs2b.c23
2 files changed, 7 insertions, 19 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 0bce53ac..4f840a52 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2097,8 +2097,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->Bs2b = calloc(1, sizeof(*device->Bs2b));
bs2b_clear(device->Bs2b);
}
- bs2b_set_srate(device->Bs2b, device->Frequency);
- bs2b_set_level(device->Bs2b, bs2blevel);
+ bs2b_set_params(device->Bs2b, bs2blevel, device->Frequency);
TRACE("BS2B enabled\n");
}
else
diff --git a/Alc/bs2b.c b/Alc/bs2b.c
index d936f75a..6c3f052b 100644
--- a/Alc/bs2b.c
+++ b/Alc/bs2b.c
@@ -29,9 +29,6 @@
#include "bs2b.h"
#include "alu.h"
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
/* Set up all data. */
static void init(struct bs2b *bs2b)
@@ -40,8 +37,6 @@ static void init(struct bs2b *bs2b)
float G_lo, G_hi;
float x, g;
- bs2b->srate = clampi(bs2b->srate, 2000, 192000);
-
switch(bs2b->level)
{
case BS2B_LOW_CLEVEL: /* Low crossfeed level */
@@ -105,31 +100,25 @@ static void init(struct bs2b *bs2b)
bs2b->a1_hi = -x * g;
} /* init */
+
/* Exported functions.
* See descriptions in "bs2b.h"
*/
-void bs2b_set_level(struct bs2b *bs2b, int level)
+void bs2b_set_params(struct bs2b *bs2b, int level, int srate)
{
- if(level == bs2b->level)
- return;
+ if(srate <= 0) srate = 1;
+
bs2b->level = level;
+ bs2b->srate = srate;
init(bs2b);
-} /* bs2b_set_level */
+} /* bs2b_set_params */
int bs2b_get_level(struct bs2b *bs2b)
{
return bs2b->level;
} /* bs2b_get_level */
-void bs2b_set_srate(struct bs2b *bs2b, int srate)
-{
- if (srate == bs2b->srate)
- return;
- bs2b->srate = srate;
- init(bs2b);
-} /* bs2b_set_srate */
-
int bs2b_get_srate(struct bs2b *bs2b)
{
return bs2b->srate;