diff options
author | Chris Robinson <[email protected]> | 2014-11-21 13:45:57 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-11-21 13:45:57 -0800 |
commit | 4ad6905c135d6964e57fe48fb7f93e579d028887 (patch) | |
tree | c2de2460a576bfe06ede0b56d286987545f21597 /Alc/ALc.c | |
parent | d608f0e9f0e3c321ad02f4cbacde74df007fc2cd (diff) |
Allocate the DryBuffer dynamically
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1996,6 +1996,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) WARN("NEON performs best with multiple of 4 update sizes (%u)\n", device->UpdateSize); } + al_free(device->DryBuffer); + device->DryBuffer = al_calloc(16, sizeof(device->DryBuffer[0]) * device->NumChannels); + if(!device->DryBuffer) + { + ERR("Failed to allocate "SZFMT"-byte mix buffer\n", sizeof(device->DryBuffer[0]) * device->NumChannels); + return ALC_INVALID_DEVICE; + } + SetMixerFPUMode(&oldMode); V0(device->Backend,lock)(); context = ATOMIC_LOAD(&device->ContextList); @@ -2161,6 +2169,9 @@ static ALCvoid FreeDevice(ALCdevice *device) AL_STRING_DEINIT(device->DeviceName); + al_free(device->DryBuffer); + device->DryBuffer = NULL; + al_free(device); } @@ -3221,6 +3232,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->Bs2b = NULL; device->Bs2bLevel = 0; AL_STRING_INIT(device->DeviceName); + device->DryBuffer = NULL; ATOMIC_INIT(&device->ContextList, NULL); @@ -3484,6 +3496,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, device->Type = Capture; AL_STRING_INIT(device->DeviceName); + device->DryBuffer = NULL; InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); @@ -3666,6 +3679,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->Bs2b = NULL; device->Bs2bLevel = 0; AL_STRING_INIT(device->DeviceName); + device->DryBuffer = NULL; ATOMIC_INIT(&device->ContextList, NULL); |