Set both BS2B parameters at once

This commit is contained in:
Chris Robinson 2015-09-08 15:04:42 -07:00
parent 475a566e35
commit 483352f32b
3 changed files with 11 additions and 26 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);