mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:26:40 +00:00 
			
		
		
		
	Set thread priority and start thread on fallback usage
This commit is contained in:
		
							parent
							
								
									e020af8b4a
								
							
						
					
					
						commit
						027d49cf28
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -14,6 +14,7 @@
 | 
				
			||||||
#include <components/debug/debuglog.hpp>
 | 
					#include <components/debug/debuglog.hpp>
 | 
				
			||||||
#include <components/misc/constants.hpp>
 | 
					#include <components/misc/constants.hpp>
 | 
				
			||||||
#include <components/misc/resourcehelpers.hpp>
 | 
					#include <components/misc/resourcehelpers.hpp>
 | 
				
			||||||
 | 
					#include <components/misc/thread.hpp>
 | 
				
			||||||
#include <components/vfs/manager.hpp>
 | 
					#include <components/vfs/manager.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "loudness.hpp"
 | 
					#include "loudness.hpp"
 | 
				
			||||||
| 
						 | 
					@ -412,6 +413,7 @@ namespace MWSound
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void run()
 | 
					        void run()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            Misc::setCurrentThreadIdlePriority();
 | 
				
			||||||
            std::unique_lock<std::mutex> lock(mMutex);
 | 
					            std::unique_lock<std::mutex> lock(mMutex);
 | 
				
			||||||
            while (!mQuitNow)
 | 
					            while (!mQuitNow)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -437,7 +439,7 @@ namespace MWSound
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        DefaultDeviceThread(OpenAL_Output& output, std::basic_string_view<ALCchar> name)
 | 
					        DefaultDeviceThread(OpenAL_Output& output, std::basic_string_view<ALCchar> name = {})
 | 
				
			||||||
            : mCurrentName(name)
 | 
					            : mCurrentName(name)
 | 
				
			||||||
            , mOutput(output)
 | 
					            , mOutput(output)
 | 
				
			||||||
            , mQuitNow(false)
 | 
					            , mQuitNow(false)
 | 
				
			||||||
| 
						 | 
					@ -691,7 +693,11 @@ namespace MWSound
 | 
				
			||||||
        Log(Debug::Warning) << "Audio device disconnected, attempting to reopen...";
 | 
					        Log(Debug::Warning) << "Audio device disconnected, attempting to reopen...";
 | 
				
			||||||
        ALCboolean reopened = alcReopenDeviceSOFT(mDevice, mDeviceName.c_str(), mContextAttributes.data());
 | 
					        ALCboolean reopened = alcReopenDeviceSOFT(mDevice, mDeviceName.c_str(), mContextAttributes.data());
 | 
				
			||||||
        if (reopened == AL_FALSE && !mDeviceName.empty())
 | 
					        if (reopened == AL_FALSE && !mDeviceName.empty())
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            reopened = alcReopenDeviceSOFT(mDevice, nullptr, mContextAttributes.data());
 | 
					            reopened = alcReopenDeviceSOFT(mDevice, nullptr, mContextAttributes.data());
 | 
				
			||||||
 | 
					            if (reopened == AL_TRUE && !mDefaultDeviceThread)
 | 
				
			||||||
 | 
					                mDefaultDeviceThread = std::make_unique<DefaultDeviceThread>(*this);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (reopened == AL_FALSE)
 | 
					        if (reopened == AL_FALSE)
 | 
				
			||||||
            Log(Debug::Error) << "Failed to reopen audio device";
 | 
					            Log(Debug::Error) << "Failed to reopen audio device";
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue