diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 3c3d6fb26e..f829ea458a 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -417,19 +417,15 @@ namespace MWSound { { const std::lock_guard openLock(mOutput.mReopenMutex); - auto defaultName = getDeviceName(nullptr); + std::basic_string_view defaultName = getDeviceName(nullptr); if (mCurrentName != defaultName) { - Log(Debug::Info) << "Default audio device changed"; - ALCboolean reopened - = alcReopenDeviceSOFT(mOutput.mDevice, nullptr, mOutput.mContextAttributes.data()); + mCurrentName = defaultName; + Log(Debug::Info) << "Default audio device changed to \"" << mCurrentName << "\""; + ALCboolean reopened = alcReopenDeviceSOFT( + mOutput.mDevice, mCurrentName.data(), mOutput.mContextAttributes.data()); if (reopened == AL_FALSE) - { - mCurrentName = defaultName; Log(Debug::Warning) << "Failed to switch to new audio device"; - } - else - mCurrentName = getDeviceName(mOutput.mDevice); } } mCondVar.wait_for(lock, std::chrono::seconds(2));