diff options
-rw-r--r-- | Alc/ALc.c | 3 | ||||
-rw-r--r-- | Alc/bs2b.c | 23 | ||||
-rw-r--r-- | OpenAL32/Include/bs2b.h | 11 |
3 files changed, 11 insertions, 26 deletions
@@ -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 @@ -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; diff --git a/OpenAL32/Include/bs2b.h b/OpenAL32/Include/bs2b.h index f1f3627a..903c6bc5 100644 --- a/OpenAL32/Include/bs2b.h +++ b/OpenAL32/Include/bs2b.h @@ -69,19 +69,16 @@ struct bs2b { } last_sample; }; -/* Clear buffers and set new coefficients with new crossfeed level value. +/* Clear buffers and set new coefficients with new crossfeed level and sample + * rate values. * level - crossfeed level of *LEVEL values. + * srate - sample rate by Hz. */ -void bs2b_set_level(struct bs2b *bs2b, int level); +void bs2b_set_params(struct bs2b *bs2b, int level, int srate); /* Return current crossfeed level value */ int bs2b_get_level(struct bs2b *bs2b); -/* Clear buffers and set new coefficients with new sample rate value. - * srate - sample rate by Hz. - */ -void bs2b_set_srate(struct bs2b *bs2b, int srate); - /* Return current sample rate value */ int bs2b_get_srate(struct bs2b *bs2b); |