1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-25 16:43:33 +00:00

Be prepared if someone feels like breaking getDeviceName

This commit is contained in:
Alexei Kotov 2025-01-09 03:31:09 +03:00
parent d4f4b3c304
commit dd44b2668c

View File

@ -420,12 +420,12 @@ namespace MWSound
std::basic_string_view<ALCchar> defaultName = getDeviceName(nullptr); std::basic_string_view<ALCchar> defaultName = getDeviceName(nullptr);
if (mCurrentName != defaultName) if (mCurrentName != defaultName)
{ {
Log(Debug::Info) << "Default audio device changed"; mCurrentName = defaultName;
Log(Debug::Info) << "Default audio device changed to \"" << mCurrentName << "\"";
ALCboolean reopened = alcReopenDeviceSOFT( ALCboolean reopened = alcReopenDeviceSOFT(
mOutput.mDevice, defaultName.data(), mOutput.mContextAttributes.data()); mOutput.mDevice, mCurrentName.data(), mOutput.mContextAttributes.data());
if (reopened == AL_FALSE) if (reopened == AL_FALSE)
Log(Debug::Warning) << "Failed to switch to new audio device"; Log(Debug::Warning) << "Failed to switch to new audio device";
mCurrentName = defaultName;
} }
} }
mCondVar.wait_for(lock, std::chrono::seconds(2)); mCondVar.wait_for(lock, std::chrono::seconds(2));