aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-22 07:54:29 -0800
committerChris Robinson <[email protected]>2018-11-22 07:54:29 -0800
commit9c155a57fb37e3869f16e2f6502ee7d95d7d6a75 (patch)
tree268be0a8db18d013476b6e19dd6d60969a2b1e6c /Alc/panning.cpp
parentba8c865513d33019962a02e00ab496365de17abf (diff)
Use unique_ptr for DirectHrtfState
Diffstat (limited to 'Alc/panning.cpp')
-rw-r--r--Alc/panning.cpp9
1 files changed, 4 insertions, 5 deletions
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<DirectHrtfState*>(
- 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();