FluidSynthSoundController::FluidSynthSoundController(QObject *parent) : Minuet::ISoundController(parent), m_audioDriver(0), m_sequencer(0), m_song(0) { m_tempo = 60; m_settings = new_fluid_settings(); fluid_settings_setstr(m_settings, "synth.reverb.active", "no"); fluid_settings_setstr(m_settings, "synth.chorus.active", "no"); m_synth = new_fluid_synth(m_settings); fluid_synth_cc(m_synth, 1, 100, 0); #ifdef Q_OS_LINUX int fluid_res = fluid_synth_sfload(m_synth, QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("soundfonts/GeneralUser-v1.47.sf2")).toLatin1(), 1); #endif #ifdef Q_OS_WIN int fluid_res = fluid_synth_sfload(m_synth, QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("minuet/soundfonts/GeneralUser-v1.47.sf2")).toLatin1(), 1); #endif if (fluid_res == FLUID_FAILED) qDebug() << "Error when loading soundfont!"; resetEngine(); }
void CdsHelper::setTermStructure(DefaultProbabilityTermStructure* ts) { RelativeDateDefaultProbabilityHelper::setTermStructure(ts); probability_.linkTo( boost::shared_ptr<DefaultProbabilityTermStructure>(ts, null_deleter()), false); resetEngine(); }
URE::~URE() { resetEngine(); #if (FLEWNIT_TRACK_MEMORY || FLEWNIT_DO_PROFILING) DESTROY_SINGLETON(Profiler); #endif DESTROY_SINGLETON(Log); }
int main(void) { int width = 4; int height = 16; // create two players... Player *player1 = createPlayer("Player1"); Player *player2 = createPlayer("Player2"); // game logic and the like Engine *engine = createEngine(consoleRenderer, eventHandler); // initialize renderer initConsoleRenderer(width + 2, height + 2); while (TRUE) { // create the game board SuPong *suPong = createGame(width, height, player1, player2); resetEngine(engine); // now run the game... while (engine->state == RUNNING) { engineTick(engine, suPong); usleep(100000); } // engine->state now contains the winner... // you could for example restart the game for a next match... // do this by calling run(engine, suPong) again // engine->state renderGameEnd(engine); usleep(1000000); } // shutdown renderer shutdownConsoleRenderer(); return 0; }
void CdsHelper::update() { RelativeDateDefaultProbabilityHelper::update(); resetEngine(); }
bool CineEngine::makeLoad(const Common::String &saveName) { Common::SharedPtr<Common::InSaveFile> saveFile(_saveFileMan->openForLoading(saveName)); if (!saveFile) { renderer->drawString(otherMessages[0], 0); waitPlayerInput(); // restoreScreen(); checkDataDisk(-1); return false; } setMouseCursor(MOUSE_CURSOR_DISK); uint32 saveSize = saveFile->size(); // TODO: Evaluate the maximum savegame size for the temporary Operation Stealth savegame format. if (saveSize == 0) { // Savefile's compressed using zlib format can't tell their unpacked size, test for it // Can't get information about the savefile's size so let's try // reading as much as we can from the file up to a predefined upper limit. // // Some estimates for maximum savefile sizes (All with 255 animDataTable entries of 30 bytes each): // With 256 global scripts, object scripts, overlays and background incrusts: // 0x2315 + (255 * 30) + (2 * 6) + (206 + 206 + 20 + 20) * 256 = ~129kB // With 512 global scripts, object scripts, overlays and background incrusts: // 0x2315 + (255 * 30) + (2 * 6) + (206 + 206 + 20 + 20) * 512 = ~242kB // // I think it extremely unlikely that there would be over 512 global scripts, object scripts, // overlays and background incrusts so 256kB seems like quite a safe upper limit. // NOTE: If the savegame format is changed then this value might have to be re-evaluated! // Hopefully devices with more limited memory can also cope with this memory allocation. saveSize = 256 * 1024; } Common::SharedPtr<Common::SeekableReadStream> in(saveFile->readStream(saveSize)); // Try to detect the used savegame format enum CineSaveGameFormat saveGameFormat = detectSaveGameFormat(*in); // Handle problematic savegame formats bool load = true; // Should we try to load the savegame? bool result = false; if (saveGameFormat == ANIMSIZE_30_PTRS_BROKEN) { // One might be able to load the ANIMSIZE_30_PTRS_BROKEN format but // that's not implemented here because it was never used in a stable // release of ScummVM but only during development (From revision 31453, // which introduced the problem, until revision 32073, which fixed it). // Therefore we bail out if we detect this particular savegame format. warning("Detected a known broken savegame format, not loading savegame"); load = false; // Don't load the savegame } else if (saveGameFormat == ANIMSIZE_UNKNOWN) { // If we can't detect the savegame format // then let's try the default format and hope for the best. warning("Couldn't detect the used savegame format, trying default savegame format. Things may break"); saveGameFormat = ANIMSIZE_30_PTRS_INTACT; } if (load) { // Reset the engine's state resetEngine(); if (saveGameFormat == TEMP_OS_FORMAT) { // Load the temporary Operation Stealth savegame format result = loadTempSaveOS(*in); } else { // Load the plain Future Wars savegame format result = loadPlainSaveFW(*in, saveGameFormat); } } setMouseCursor(MOUSE_CURSOR_NORMAL); return result; }
bool URE::init(Path& pathToGlobalConfigFile) { resetEngine(); Log::getInstance()<<INFO_LOG_LEVEL<<"initializing URE ...\n"; Log::getInstance()<<DEBUG_LOG_LEVEL<<"The Config Path is"<< pathToGlobalConfigFile.string() <<"\n"; mConfig = new Config(); mLoader= new Loader(); mLoader->loadGlobalConfig(*mConfig,pathToGlobalConfigFile); #ifdef FLEWNIT_USE_GLFW mWindowManager = new GLFWWindowManager(); #else # ifdef FLEWNIT_USE_XCB assert(0 && "Sorry, XCB Windowmanager not implemented"); # else # ifdef FLEWNIT_USE_SDL assert(0 && "Sorry, SDL Windowmanager not implemented"); # else assert(0 && "You have to specifiy window manager with cmake!"); # endif # endif #endif mInputManager = new InputManager(); mFPSCounter = new FPSCounter(); mParallelComputeManager = new ParallelComputeManager(); mSimulationResourceManager = new SimulationResourceManager(); mCLProgramManager = new CLProgramManager( ConfigCaster::cast<bool>( mConfig->root().get("generalSettings",0). get("useCacheUsingOpenCLImplementation",0) ) ); if(mConfig->root().childExists("generalSettings",0)) { mDoValidateSimulationStepResults = ConfigCaster::cast<bool> (mConfig->root().get("generalSettings",0).get("doValidateSimulationStepResults",0) ); mDoProfileAndOptimizeSettings = ConfigCaster::cast<bool> (mConfig->root().get("generalSettings",0).get("doProfileAndOptimizeSettings",0) ); mDoProfilePerformance = ConfigCaster::cast<bool> (mConfig->root().get("generalSettings",0).get("doProfilePerformance",0) ); mDoDebugDraw = ConfigCaster::cast<bool> (mConfig->root().get("generalSettings",0).get("doDebugDraw",0) ); } if(mConfig->root().childExists("simulators",0)) { ConfigStructNode& simulatorsConfigNode = mConfig->root().get("simulators",0); //BOOST_FOREACH( ConfigMap::value_type & singleSimulatorConfigNode, simulatorsConfigNode.getChildren() ) for(unsigned int i = 0 ; i < simulatorsConfigNode.get("Simulator").size() ;i++) { mSimulators.push_back( SimulatorInterface::create( simulatorsConfigNode.get("Simulator")[i] ) ); // assert("no double definition of a simulator allowed" && singleSimulatorConfigNode.second.size()== 1 ); // mSimulators[singleSimulatorConfigNode.first] = // SimulatorInterface::create(singleSimulatorConfigNode.second[0]); } } else { assert("no simulators defined in config" && 0); } //DEBUG: getSimulator(VISUAL_SIM_DOMAIN)->toLightingSimulator()->testStuff(); //load the scene before the pipeline are initialized so that the pipelines have some //world objects/materials/geometry to grab for shader/kernel generation mLoader->loadScene(); BOOST_FOREACH(SimulatorInterface* simulator, mSimulators) { simulator->initPipeLine(); } BOOST_FOREACH(SimulatorInterface* simulator, mSimulators) { simulator->validatePipeLine(); } // BOOST_FOREACH( SimulatorMap::value_type & simPair, mSimulators) // { // simPair.second -> initPipeLine(); // } // // BOOST_FOREACH( SimulatorMap::value_type & simPair, mSimulators) // { // simPair.second -> validatePipeLine(); // } mCLProgramManager->getInstance().buildProgramsAndCreateKernels(); #if (FLEWNIT_TRACK_MEMORY || FLEWNIT_DO_PROFILING) Profiler::getInstance().updateMemoryTrackingInfo(); #endif Log::getInstance()<<INFO_LOG_LEVEL<<"initializing done!\n"; //hack mCorrectlyInitializedGuard = true; return mCorrectlyInitializedGuard; }