aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/wasapi.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-15 06:23:01 -0800
committerChris Robinson <[email protected]>2018-11-15 06:23:01 -0800
commit7b3a2085aac8eac47f9968f331d3991167793e85 (patch)
tree5566b15f7a90fe8e0fb2b280c4f8b83c80247f4f /Alc/backends/wasapi.cpp
parentab9f8162b84870161948ddd27d29483206dd4e57 (diff)
Use a regular char* for the device's name
Diffstat (limited to 'Alc/backends/wasapi.cpp')
-rw-r--r--Alc/backends/wasapi.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index 64e7d43c..4fb0f317 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -719,7 +719,8 @@ static ALCenum ALCwasapiPlayback_open(ALCwasapiPlayback *self, const ALCchar *de
{
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->mDevId = iter->devid;
- alstr_copy_range(&device->DeviceName, &*iter->name.cbegin(), &*iter->name.cend());
+ al_free(device->DeviceName);
+ device->DeviceName = alstrdup(iter->name.c_str());
hr = S_OK;
}
}
@@ -775,11 +776,11 @@ HRESULT ALCwasapiPlayback::openProxy()
if(SUCCEEDED(hr))
{
mClient = reinterpret_cast<IAudioClient*>(ptr);
- if(alstr_empty(device->DeviceName))
+ if(!device->DeviceName || device->DeviceName[0] == 0)
{
- std::string devname;
- std::tie(devname, std::ignore) = get_device_name_and_guid(mMMDev);
- alstr_copy_range(&device->DeviceName, &*devname.cbegin(), &*devname.cend());
+ std::string devname{get_device_name_and_guid(mMMDev).first};
+ al_free(device->DeviceName);
+ device->DeviceName = alstrdup(devname.c_str());
}
}
@@ -1385,7 +1386,8 @@ static ALCenum ALCwasapiCapture_open(ALCwasapiCapture *self, const ALCchar *devi
{
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->mDevId = iter->devid;
- alstr_copy_range(&device->DeviceName, &*iter->name.cbegin(), &*iter->name.cend());
+ al_free(device->DeviceName);
+ device->DeviceName = alstrdup(iter->name.c_str());
hr = S_OK;
}
}
@@ -1460,11 +1462,11 @@ HRESULT ALCwasapiCapture::openProxy()
if(SUCCEEDED(hr))
{
mClient = reinterpret_cast<IAudioClient*>(ptr);
- if(alstr_empty(device->DeviceName))
+ if(!device->DeviceName || device->DeviceName[0] == 0)
{
- std::string devname;
- std::tie(devname, std::ignore) = get_device_name_and_guid(mMMDev);
- alstr_copy_range(&device->DeviceName, &*devname.cbegin(), &*devname.cend());
+ std::string devname{get_device_name_and_guid(mMMDev).first};
+ al_free(device->DeviceName);
+ device->DeviceName = alstrdup(devname.c_str());
}
}