From d583f7f307ef6cfba9a4e64a89393184bd114d11 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 6 May 2011 01:06:01 -0700 Subject: Update sources automatically when device parameters change --- Alc/ALc.c | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'Alc') diff --git a/Alc/ALc.c b/Alc/ALc.c index 84478ada..9c51aac4 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1158,6 +1158,29 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->PendingClicks[i] = 0.0f; } + if(device->FmtChans != DevFmtStereo || device->Frequency != 44100) + { + if((device->Flags&DEVICE_USE_HRTF)) + AL_PRINT("HRTF disabled (format is not 44100hz stereo)\n"); + device->Flags &= ~DEVICE_USE_HRTF; + } + + if(!(device->Flags&DEVICE_USE_HRTF) && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) + { + 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; + } + for(i = 0;i < device->NumContexts;i++) { ALCcontext *context = device->Contexts[i]; @@ -1189,34 +1212,12 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) source->Send[s].WetFilter.filter = 0; s++; } - source->NeedsUpdate = AL_TRUE; + ALsource_Update(source, context); + source->NeedsUpdate = AL_FALSE; } ProcessContext(context); } - if(device->FmtChans != DevFmtStereo || device->Frequency != 44100) - { - if((device->Flags&DEVICE_USE_HRTF)) - AL_PRINT("HRTF disabled (format is not 44100hz stereo)\n"); - device->Flags &= ~DEVICE_USE_HRTF; - } - - if(!(device->Flags&DEVICE_USE_HRTF) && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) - { - 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; - } - return ALC_TRUE; } -- cgit v1.2.3