From 671ed1abf8cc246c6e2b5f9ae3bac132fb9af519 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 22 Nov 2018 04:53:29 -0800 Subject: Use a unique_ptr for the FrontStablizer --- Alc/panning.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Alc/panning.cpp') diff --git a/Alc/panning.cpp b/Alc/panning.cpp index c167c227..4ffdf969 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -931,8 +931,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf size_t i; al_free(device->Hrtf); - device->Hrtf = NULL; - device->HrtfHandle = NULL; + device->Hrtf = nullptr; + device->HrtfHandle = nullptr; device->HrtfName.clear(); device->Render_Mode = NormalRender; @@ -945,8 +945,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf device->AvgSpeakerDist = 0.0f; device->ChannelDelay.clear(); - al_free(device->Stablizer); - device->Stablizer = NULL; + device->Stablizer = nullptr; if(device->FmtChans != DevFmtStereo) { @@ -1035,8 +1034,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf * higher). */ ALfloat scale = (ALfloat)(5000.0 / device->Frequency); - FrontStablizer *stablizer = reinterpret_cast( - al_calloc(16, sizeof(*stablizer))); + std::unique_ptr stablizer{new FrontStablizer{}}; bandsplit_init(&stablizer->LFilter, scale); stablizer->RFilter = stablizer->LFilter; @@ -1046,7 +1044,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf for(i = 1;i < (size_t)device->RealOut.NumChannels;i++) stablizer->APFilter[i] = stablizer->APFilter[0]; - device->Stablizer = stablizer; + device->Stablizer = std::move(stablizer); } break; case DevFmtMono: -- cgit v1.2.3