示例#1
0
void pluginInit( QObject *parent )
{
	auto teamSpeakPlugin = Driver::TeamSpeakPlugin::singleton();

	Log::setSink( teamSpeakPlugin );
	// for debugging purposes
	// Log::setSink( new Log::FileLogger( "C:/temp/tessumod_plugin.log" ) );
	Log::logQtMessages();

	QString dataPath = teamSpeakPlugin->getPluginDataPath();
	QString dataPathNative = QDir::toNativeSeparators( dataPath );
	dllSearchCookie = AddDllDirectory( (wchar_t*)dataPathNative.utf16() );

	auto iniSettingsFile = new Driver::IniSettingsFile( parent );
	auto openALBackend = new Driver::OpenALBackend( dataPath, parent );
	auto openALBackendTest = new Driver::OpenALBackend( dataPath, parent );
	auto openALConfFile = new Driver::OpenALConfFile( dataPath, parent );
	auto wotConnector = new Driver::WotConnector( parent );

	auto userStorage = new Storage::UserStorage( parent );
	auto cameraStorage = new Storage::CameraStorage( parent );
	auto adapterStorage = new Storage::AdapterStorage( parent );
	auto settingsStorage = new Storage::SettingsStorage( iniSettingsFile, parent );

	auto useCaseFactory = new UseCase::UseCaseFactory( parent );
	useCaseFactory->userStorage = userStorage;
	useCaseFactory->cameraStorage = cameraStorage;
	useCaseFactory->settingsStorage = settingsStorage;
	useCaseFactory->adapterStorage = adapterStorage;

	adapterStorage->setAudio( Entity::BuiltInBackend, new Adapter::AudioAdapter( teamSpeakPlugin->createAudioBackend(), dataPath, parent ) );
	adapterStorage->setAudio( Entity::OpenALBackend, new Adapter::AudioAdapter( openALBackend, dataPath, parent ) );
	adapterStorage->setTestAudio( Entity::BuiltInBackend, new Adapter::AudioAdapter( teamSpeakPlugin->createAudioBackend(), dataPath, parent ) );
	adapterStorage->setTestAudio( Entity::OpenALBackend, new Adapter::AudioAdapter( openALBackendTest, dataPath, parent ) );
	adapterStorage->setVoiceChat( new Adapter::VoiceChatAdapter( teamSpeakPlugin, useCaseFactory, parent ) );
	adapterStorage->setGameData( new Adapter::GameDataAdapter( wotConnector, useCaseFactory, parent ) );
	adapterStorage->setUi( new Adapter::UiAdapter( useCaseFactory, openALConfFile, parent ) );

	teamSpeakPlugin->setAudioSink( openALBackend );

	QTimer *setupTimer = new QTimer( parent );
	setupTimer->setSingleShot( true );
	setupTimer->setInterval( 0 );
	setupTimer->start();

	QObject::connect( setupTimer, &QTimer::timeout, [=] {
		teamSpeakPlugin->initialize();
		wotConnector->initialize();
		useCaseFactory->applicationInitialize();
		openALConfFile->start();
	} );
}
示例#2
0
FFmpegAudioStream::~FFmpegAudioStream()
{
    // detact the audio sink first to avoid destrction order issues.
    setAudioSink (NULL);
}