aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/wasapi.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 76c249de..f1f027e6 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -251,6 +251,8 @@ al::vector<DevMap> CaptureDevices;
using NameGUIDPair = std::pair<std::string,std::string>;
NameGUIDPair get_device_name_and_guid(IMMDevice *device)
{
+ static constexpr char UnknownName[]{"Unknown Device Name"};
+ static constexpr char UnknownGuid[]{"Unknown Device GUID"};
std::string name{DEVNAME_HEAD};
std::string guid;
@@ -259,7 +261,7 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
- return std::make_pair("Unknown Device Name", "Unknown Device GUID");
+ return std::make_pair(UnknownName, UnknownGuid);
}
PropVariant pvprop;
@@ -267,14 +269,14 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
- name += "Unknown Device Name";
+ name += UnknownName;
}
else if(pvprop->vt == VT_LPWSTR)
name += wstr_to_utf8(pvprop->pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvprop->vt);
- name += "Unknown Device Name";
+ name += UnknownName;
}
pvprop.clear();
@@ -282,14 +284,14 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("GetValue AudioEndpoint_GUID failed: 0x%08lx\n", hr);
- guid = "Unknown Device GUID";
+ guid = UnknownGuid;
}
else if(pvprop->vt == VT_LPWSTR)
guid = wstr_to_utf8(pvprop->pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvprop->vt);
- guid = "Unknown Device GUID";
+ guid = UnknownGuid;
}
return std::make_pair(std::move(name), std::move(guid));