aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/wasapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r--alc/backends/wasapi.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 96c56fa8..c9ea7980 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -526,18 +526,18 @@ struct DeviceHelper final : private IMMNotificationClient
if(role != eMultimedia)
return S_OK;
+ const std::wstring_view devid{pwstrDefaultDeviceId ? pwstrDefaultDeviceId
+ : std::wstring_view{}};
if(flow == eRender)
{
- DeviceListLock{gDeviceList}.setPlaybackDefaultId(pwstrDefaultDeviceId);
- const std::string msg{"Default playback device changed: "+
- wstr_to_utf8(pwstrDefaultDeviceId)};
+ DeviceListLock{gDeviceList}.setPlaybackDefaultId(devid);
+ const std::string msg{"Default playback device changed: " + wstr_to_utf8(devid)};
alc::Event(alc::EventType::DefaultDeviceChanged, alc::DeviceType::Playback, msg);
}
else if(flow == eCapture)
{
- DeviceListLock{gDeviceList}.setCaptureDefaultId(pwstrDefaultDeviceId);
- const std::string msg{"Default capture device changed: "+
- wstr_to_utf8(pwstrDefaultDeviceId)};
+ DeviceListLock{gDeviceList}.setCaptureDefaultId(devid);
+ const std::string msg{"Default capture device changed: " + wstr_to_utf8(devid)};
alc::Event(alc::EventType::DefaultDeviceChanged, alc::DeviceType::Capture, msg);
}
return S_OK;