From 9c155a57fb37e3869f16e2f6502ee7d95d7d6a75 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 22 Nov 2018 07:54:29 -0800 Subject: Use unique_ptr for DirectHrtfState --- Alc/panning.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Alc/panning.cpp') diff --git a/Alc/panning.cpp b/Alc/panning.cpp index e0677600..a67234ec 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -857,8 +857,8 @@ static void InitHrtfPanning(ALCdevice *device) count = COUNTOF(IndexMap); } - device->mHrtfState = reinterpret_cast( - al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count))); + device->mHrtfState.reset( + new (al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count))) DirectHrtfState{}); for(i = 0;i < count;i++) { @@ -892,8 +892,8 @@ static void InitHrtfPanning(ALCdevice *device) device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder); BuildBFormatHrtf(device->HrtfHandle, - device->mHrtfState, device->Dry.NumChannels, AmbiPoints, AmbiMatrix, COUNTOF(AmbiPoints), - AmbiOrderHFGain + device->mHrtfState.get(), device->Dry.NumChannels, AmbiPoints, AmbiMatrix, + COUNTOF(AmbiPoints), AmbiOrderHFGain ); InitNearFieldCtrl(device, device->HrtfHandle->distance, device->AmbiUp ? 2 : 1, @@ -930,7 +930,6 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf int bs2blevel; size_t i; - al_free(device->mHrtfState); device->mHrtfState = nullptr; device->HrtfHandle = nullptr; device->HrtfName.clear(); -- cgit v1.2.3