From 93f3e9357ba22017ef8e42bddc129a21a8eb3fcd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 21 Sep 2009 23:52:59 -0700 Subject: (Re)allocate and clear the stereo-to-binaural filter as needed --- Alc/ALc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Alc/ALc.c') diff --git a/Alc/ALc.c b/Alc/ALc.c index 07190754..237eb4b7 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -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); } -- cgit v1.2.3