Use a standard string for the device's HRTF name

This commit is contained in:
Chris Robinson
2018-11-18 19:28:01 -08:00
parent 2c06ec7093
commit 140c139852
3 changed files with 6 additions and 9 deletions
+1 -3
View File
@@ -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);
}
+4 -5
View File
@@ -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;
+1 -1
View File
@@ -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};