aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-09-21 23:52:59 -0700
committerChris Robinson <[email protected]>2009-09-21 23:52:59 -0700
commit93f3e9357ba22017ef8e42bddc129a21a8eb3fcd (patch)
tree791a412b491f2b07e6149f4692ff949bf0c9ca6d
parent8ea8b49464419af80c860740339cea33eee05712 (diff)
(Re)allocate and clear the stereo-to-binaural filter as needed
-rw-r--r--Alc/ALc.c13
-rw-r--r--Alc/bs2b.c2
2 files changed, 10 insertions, 5 deletions
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);
}
diff --git a/Alc/bs2b.c b/Alc/bs2b.c
index f8e8f8ff..f6229e90 100644
--- a/Alc/bs2b.c
+++ b/Alc/bs2b.c
@@ -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.