void Core::entry () { /* Create PluginMgr and add Core as eventmgr */ mPluginMgr = new PluginMgr (); mPluginMgr->registerEventMgr (this); /* Create all needed PluginInterfaceProviders */ AudioInputProvider *audioin = new AudioInputProvider (); AudioOutputProvider *audioout = new AudioOutputProvider (); logMsg (_("Core: Initialized interface providers"), Log::LVL_INFO); /* Try to load all plugins */ try { logMsg (_("Core: Loading plugins"), Log::LVL_INFO); mPluginMgr->loadPlugins (mConfig); logMsg (_("Core: Finished loading plugins"), Log::LVL_INFO); } catch (openSpeak::Exception &ex) { logMsg (ex.what (), Log::LVL_ERROR); } /* Initialize the audio stuff */ _initAudio (audioin, audioout); /* Delete all PluginInterfaceProviders after we're finished */ delete audioin; delete audioout; }
bool TheoraTexture::setFile( const String& filename, SFXDescription* desc ) { _reset(); if( filename.isEmpty() ) return true; // Check SFX profile. if( desc && !desc->mIsStreaming ) { Con::errorf( "TheoraTexture::setFile - Not a streaming SFXDescription" ); return false; } mSFXDescription = desc; // Open the Theora file. Stream* stream = FileStream::createAndOpen( filename, Torque::FS::File::Read ); if( !stream ) { Con::errorf( "TheoraTexture::setFile - Theora file '%s' not found.", filename.c_str() ); return false; } // Create the OGG stream. Con::printf( "TheoraTexture - Loading file '%s'", filename.c_str() ); ThreadSafeRef< OggInputStream > oggStream = new OggInputStream( stream ); oggStream->addDecoder< OggTheoraDecoder >(); #ifndef SPLIT_VORBIS oggStream->addDecoder< OggVorbisDecoder >(); #endif if( !oggStream->init() ) { Con::errorf( "TheoraTexture - Failed to initialize OGG stream" ); return false; } mFilename = filename; mAsyncState = new AsyncState( oggStream, desc ? desc->mIsLooping : false ); // Set up video. OggTheoraDecoder* theoraDecoder = _getTheora(); if( !theoraDecoder ) { Con::errorf( "TheoraTexture - '%s' is not a Theora file", filename.c_str() ); mAsyncState = NULL; return false; } Con::printf( " - Theora: %ix%i pixels, %.02f fps, %s format", theoraDecoder->getFrameWidth(), theoraDecoder->getFrameHeight(), theoraDecoder->getFramesPerSecond(), GetPixelFormatName( theoraDecoder->getDecoderPixelFormat() ) ); _initVideo(); // Set up sound if we have it. For performance reasons, create // a separate physical stream for the Vorbis sound data rather than // using the bitstream from the multiplexed OGG master stream. The // contention caused by the OGG page/packet feeding will otherwise // slow us down significantly. #ifdef SPLIT_VORBIS stream = FileStream::createAndOpen( filename, Torque::FS::File::Read ); if( stream ) { ThreadSafeRef< SFXStream > vorbisStream = SFXVorbisStream::create( stream ); if( !vorbisStream ) { Con::errorf( "TheoraTexture - could not create Vorbis stream for '%s'", filename.c_str() ); // Stream is deleted by SFXVorbisStream. } else { Con::printf( " - Vorbis: %i channels, %i kHz", vorbisStream->getFormat().getChannels(), vorbisStream->getFormat().getSamplesPerSecond() / 1000 ); _initAudio( vorbisStream ); } } #else OggVorbisDecoder* vorbisDecoder = _getVorbis(); if( vorbisDecoder ) { Con::printf( " - Vorbis: %i bits, %i channels, %i kHz", vorbisDecoder->getNumChannels(), vorbisDecoder->getSamplesPerSecond() / 1000 ); _initAudio(); } #endif // Initiate the background request chain. mAsyncState->start(); return true; }