コード例 #1
0
clAudioSubsystem_OpenAL::~clAudioSubsystem_OpenAL()
{
	std::lock_guard<std::mutex> Lock( m_ActiveSourcesMutex );

	m_ActiveSources.clear();

	UnloadAL();
}
コード例 #2
0
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();
}