(Re)allocate and clear the stereo-to-binaural filter as needed

This commit is contained in:
Chris Robinson
2009-09-21 23:52:59 -07:00
parent 8ea8b49464
commit 93f3e9357b
2 changed files with 10 additions and 5 deletions
+10 -3
View File
@@ -1214,14 +1214,21 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
ALContext->Frequency = device->Frequency;
free(device->Bs2b);
device->Bs2b = NULL;
if(device->Bs2bLevel > 0 && device->Bs2bLevel <= 6)
{
device->Bs2b = calloc(1, sizeof(*device->Bs2b));
if(!device->Bs2b)
{
device->Bs2b = calloc(1, sizeof(*device->Bs2b));
bs2b_clear(device->Bs2b);
}
bs2b_set_srate(device->Bs2b, device->Frequency);
bs2b_set_level(device->Bs2b, device->Bs2bLevel);
}
else
{
free(device->Bs2b);
device->Bs2b = NULL;
}
ProcessContext(NULL);
}
-2
View File
@@ -113,8 +113,6 @@ static void init(struct bs2b *bs2b)
bs2b->a1_hi = -x;
bs2b->gain = 1.0 / (1.0 - G_hi + G_lo);
bs2b_clear(bs2b);
} /* init */
/* Exported functions.