clAudioSubsystem_OpenAL::clAudioSubsystem_OpenAL() : m_Device( nullptr ) , m_Context( nullptr ) , m_AudioThread() , m_IsPendingExit( false ) , m_IsInitialized( false ) { LoadAL(); }
void clAudioThread::Run() { if ( !LoadAL() ) { return; } // We should use actual device name if the default does not work FDevice = alcOpenDevice( NULL ); FContext = alcCreateContext( FDevice, NULL ); alcMakeContextCurrent( FContext ); FInitialized = true; FPendingExit = false; double Seconds = GetSeconds(); while ( !IsPendingExit() ) { float DeltaSeconds = static_cast<float>( GetSeconds() - Seconds ); { LMutex Lock( &FMutex ); for ( auto i = FActiveSources.begin(); i != FActiveSources.end(); i++ ) { ( *i )->Update( DeltaSeconds ); } } Seconds = GetSeconds(); Env_Sleep( 100 ); } alcDestroyContext( FContext ); alcCloseDevice( FDevice ); UnloadAL(); }