aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-18 19:28:01 -0800
committerChris Robinson <[email protected]>2018-11-18 19:28:01 -0800
commit140c139852de0bde537de0314e30239832f309f1 (patch)
tree3006aafe758d4264417b317662a45e116af4c161
parent2c06ec709324b7aebdb71961a428362cfcafa68f (diff)
Use a standard string for the device's HRTF name
-rw-r--r--Alc/alc.cpp4
-rw-r--r--Alc/panning.cpp9
-rw-r--r--OpenAL32/Include/alMain.h2
3 files changed, 6 insertions, 9 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index bb51f6f0..805ba70c 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -2436,8 +2436,6 @@ ALCdevice_struct::~ALCdevice_struct()
VECTOR_DEINIT(FilterList);
almtx_destroy(&FilterLock);
- al_free(HrtfName);
- HrtfName = nullptr;
FreeHrtfList(HrtfList);
if(HrtfHandle)
Hrtf_DecRef(HrtfHandle);
@@ -3049,7 +3047,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
else
{
almtx_lock(&Device->BackendLock);
- value = ((Device->HrtfHandle && Device->HrtfName) ? Device->HrtfName : "");
+ value = (Device->HrtfHandle ? Device->HrtfName.c_str() : "");
almtx_unlock(&Device->BackendLock);
ALCdevice_DecRef(Device);
}
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index d5c8bbdf..aface673 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -933,8 +933,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
al_free(device->Hrtf);
device->Hrtf = NULL;
device->HrtfHandle = NULL;
- al_free(device->HrtfName);
- device->HrtfName = NULL;
+ device->HrtfName.clear();
device->Render_Mode = NormalRender;
memset(&device->Dry.Ambi, 0, sizeof(device->Dry.Ambi));
@@ -1114,7 +1113,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(hrtf && hrtf->sampleRate == device->Frequency)
{
device->HrtfHandle = hrtf;
- device->HrtfName = alstrdup(entry.name);
+ device->HrtfName = entry.name;
}
else if(hrtf)
Hrtf_DecRef(hrtf);
@@ -1127,7 +1126,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(hrtf && hrtf->sampleRate == device->Frequency)
{
device->HrtfHandle = hrtf;
- device->HrtfName = alstrdup(entry.name);
+ device->HrtfName = entry.name;
}
else if(hrtf)
Hrtf_DecRef(hrtf);
@@ -1164,7 +1163,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
}
TRACE("%s HRTF rendering enabled, using \"%s\"\n",
- ((device->Render_Mode == HrtfRender) ? "Full" : "Basic"), device->HrtfName
+ ((device->Render_Mode == HrtfRender) ? "Full" : "Basic"), device->HrtfName.c_str()
);
InitHrtfPanning(device);
return;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 11f9d7de..57ecd925 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -621,7 +621,7 @@ struct ALCdevice_struct {
/* HRTF state and info */
struct DirectHrtfState *Hrtf{nullptr};
- char *HrtfName{nullptr};
+ std::string HrtfName;
struct Hrtf *HrtfHandle{nullptr};
al::vector<EnumeratedHrtf> HrtfList;
ALCenum HrtfStatus{ALC_FALSE};