mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Fix default audio device switch for PulseAudio backend (#7731)
This commit is contained in:
parent
710aa9ad4f
commit
d4f4b3c304
1 changed files with 4 additions and 8 deletions
|
@ -417,19 +417,15 @@ namespace MWSound
|
|||
{
|
||||
{
|
||||
const std::lock_guard<std::mutex> openLock(mOutput.mReopenMutex);
|
||||
auto defaultName = getDeviceName(nullptr);
|
||||
std::basic_string_view<ALCchar> defaultName = getDeviceName(nullptr);
|
||||
if (mCurrentName != defaultName)
|
||||
{
|
||||
Log(Debug::Info) << "Default audio device changed";
|
||||
ALCboolean reopened
|
||||
= alcReopenDeviceSOFT(mOutput.mDevice, nullptr, mOutput.mContextAttributes.data());
|
||||
ALCboolean reopened = alcReopenDeviceSOFT(
|
||||
mOutput.mDevice, defaultName.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);
|
||||
mCurrentName = defaultName;
|
||||
}
|
||||
}
|
||||
mCondVar.wait_for(lock, std::chrono::seconds(2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue