bool D3dx9Funcs::initialize() { uninitialize(); std::wstring dll_file_path; dll_file_path = System::combine_paths( System::get_system_dir(), L"d3dx9_43.dll"); library_ = ::LoadLibraryW(dll_file_path.c_str()); if (library_ == nullptr) return false; create_font_ = reinterpret_cast<FP_D3DXCREATEFONT>( ::GetProcAddress(library_, "D3DXCreateFontW")); create_sprite_ = reinterpret_cast<FP_D3DXCREATESPRITE>( ::GetProcAddress(library_, "D3DXCreateSprite")); if (create_font_ != nullptr && create_sprite_ != nullptr) is_initialized_ = true; else uninitialize(); return is_initialized_; }
Audio::~Audio() { if(m_initialized) { uninitialize(); } }
EpicNavCorePlugin::~EpicNavCorePlugin() { uninitialize(); costmap = nullptr; initialized = false; }
void EpicNavCorePlugin::initialize(std::string name, costmap_2d::Costmap2DROS *costmap_ros) { if (name.length() == 0 || costmap_ros == nullptr) { ROS_ERROR("Error[EpicNavCorePlugin::initialize]: Costmap2DROS object is not initialized."); return; } uninitialize(); costmap = costmap_ros->getCostmap(); harmonic.n = 2; harmonic.m = new unsigned int[2]; harmonic.m[0] = costmap->getSizeInCellsY(); harmonic.m[1] = costmap->getSizeInCellsX(); harmonic.u = new float[costmap->getSizeInCellsX() * costmap->getSizeInCellsY()]; harmonic.locked = new unsigned int[costmap->getSizeInCellsX() * costmap->getSizeInCellsY()]; setCellsFromCostmap(); setBoundariesAsObstacles(); ros::NodeHandle privateNodeHandle("~/" + name); pub_plan = privateNodeHandle.advertise<nav_msgs::Path>("plan", 1); //pub_potential = privateNodeHandle.advertise<nav_msgs::OccupancyGrid>("potential", 1); initialized = true; }
_nes_rom::~_nes_rom(void) { if(is_initialized()) { uninitialize(); } }
bool SceneGraph::save(char *filename, void (*callbackFn)(int nNode, void *info), void *callbackFnInfo) { ofstream outputFile(filename); if (!outputFile) return false; uninitialize(); outputFile << "#VRML V2.0 utf8" << endl; int nNode = 0; for (Node *node = Parser::getNodes(); node; node = node->next()) { node->output(outputFile, 0); nNode++; if (callbackFn) callbackFn(nNode, callbackFnInfo); } for (Route *route = Parser::getRoutes(); route; route = route->next()) { route->output(outputFile); } initialize(); return true; }
DeviceManager::~DeviceManager() { if (initialized()) uninitialize(); if (_watcher) delete _watcher; }
void PropertyAdmin::initialize() { if (m_bInitialized) return; m_bInitialized = true; try { CComPtr<IPropertyManager> pPropMan; if ((pPropMan.p = GET_OPMPROPERTY_MANAGER(m_pClass))==NULL) _com_issue_error(E_FAIL); _com_util::CheckError(CComObject<CSimpleProperty>::CreateInstance(&m_pSimple)); m_pSimple->AddRef(); _com_util::CheckError(CComObject<CCategorizedProperty>::CreateInstance(&m_pCategorized)); m_pCategorized->AddRef(); _com_util::CheckError(CComObject<CEnumProperty>::CreateInstance(&m_pEnum)); m_pEnum->AddRef(); _com_util::CheckError(pPropMan->AddProperty(m_pSimple)); _com_util::CheckError(pPropMan->AddProperty(m_pCategorized)); _com_util::CheckError(pPropMan->AddProperty(m_pEnum)); } catch(const _com_error& ) { uninitialize(); acutPrintf("\nSimpleDynProps: initialize failed!!!\n"); return; } }
// As soon as we know the channel count of our input, we can lazily initialize. // Sometimes this may be called more than once with different channel counts, in which case we must safely // uninitialize and then re-initialize with the new channel count. void AudioBasicProcessorHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) { ASSERT(context()->isAudioThread()); ASSERT(context()->isGraphOwner()); ASSERT(input == &this->input(0)); if (input != &this->input(0)) return; ASSERT(processor()); if (!processor()) return; unsigned numberOfChannels = input->numberOfChannels(); if (isInitialized() && numberOfChannels != output(0).numberOfChannels()) { // We're already initialized but the channel count has changed. uninitialize(); } if (!isInitialized()) { // This will propagate the channel count to any nodes connected further down the chain... output(0).setNumberOfChannels(numberOfChannels); // Re-initialize the processor with the new channel count. processor()->setNumberOfChannels(numberOfChannels); initialize(); } AudioHandler::checkNumberOfChannelsForInput(input); }
// As soon as we know the channel count of our input, we can lazily initialize. // Sometimes this may be called more than once with different channel counts, in which case we must safely // uninitialize and then re-initialize with the new channel count. void AudioBasicProcessorNode::checkNumberOfChannelsForInput(AudioNodeInput* input) { ASSERT(isMainThread()); ASSERT(input == this->input(0)); if (input != this->input(0)) return; ASSERT(processor()); if (!processor()) return; unsigned numberOfChannels = input->numberOfChannels(); if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) { // We're already initialized but the channel count has changed. // We need to be careful since we may be actively processing right now, so synchronize with process(). MutexLocker locker(m_processLock); uninitialize(); } // This will propagate the channel count to any nodes connected further down the chain... output(0)->setNumberOfChannels(numberOfChannels); // Re-initialize the processor with the new channel count. processor()->setNumberOfChannels(numberOfChannels); initialize(); }
// FIXME: this can go away when we do mixing with gain directly in summing junction of AudioNodeInput // // As soon as we know the channel count of our input, we can lazily initialize. // Sometimes this may be called more than once with different channel counts, in which case we must safely // uninitialize and then re-initialize with the new channel count. void GainHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) { ASSERT(context()->isAudioThread()); ASSERT(context()->isGraphOwner()); ASSERT(input); ASSERT(input == &this->input(0)); if (input != &this->input(0)) return; unsigned numberOfChannels = input->numberOfChannels(); if (isInitialized() && numberOfChannels != output(0).numberOfChannels()) { // We're already initialized but the channel count has changed. uninitialize(); } if (!isInitialized()) { // This will propagate the channel count to any nodes connected further downstream in the graph. output(0).setNumberOfChannels(numberOfChannels); initialize(); } AudioHandler::checkNumberOfChannelsForInput(input); }
/*! Main function */ int main (int argc, char *argv[]) { INFO *info; bool result = false; info = initialize (); #if HAVE_MPI MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &(info -> world_id)); MPI_Comm_size (MPI_COMM_WORLD, &(info -> world_size)); #endif #if HAVE_OPENMP info -> threads = omp_get_num_procs (); omp_set_num_threads (info -> threads); #endif /* Process the command line parameters and then check them; ** if either fail then print usage information */ if ((!processOptions (argc, argv, info)) || (!checkSettings (info))) { usage (argv[0]); } else { result = run (info); } #if HAVE_MPI MPI_Finalize (); #endif uninitialize (info); return (EXIT_SUCCESS); }
void Body::resourceUnloaded(const resource::ResourceEvent& evt) { if (evt.source && (evt.source == mBodyData || evt.source == mMaterial)) { mBodyType = BT_STATIC; mSleeping = false; mSleepiness = 0.0f; mMass = 0.0f; mLinearDamping = 0.0f; mAngularDamping = 0.0f; mLinearVelocity = core::vector3d::ORIGIN_3D; mAngularVelocity = core::vector3d::ORIGIN_3D; mMaterial = nullptr; mEnabled = false; mForce = core::vector3d::ORIGIN_3D; mTorque = core::vector3d::ORIGIN_3D; mLinearImpulse = core::vector3d::ORIGIN_3D; mAngularImpulse = core::vector3d::ORIGIN_3D; uninitialize(); } }
RenderDeviceD3D::~RenderDeviceD3D() { m_Swapchain->SetFullscreenState(FALSE, NULL); uninitialize(); destroyDevice(); }
void AmeSystemSound::initialize() { if (mInited) uninitialize(); source = ""; mixer = 0; mPause = false; mPlay = false; mUserStop = false; QSettings settings(AmeDirs::global()->stdDir(AmeDirs::Configs) + "/Sound", QSettings::IniFormat); if (useMixer) { QString mixerCard = settings.value("Mixer/mixer_card", "hw:0").toString(); QString mixerDevice = settings.value("Mixer/mixer_device", "Master").toString(); setupMixer(mixerCard, mixerDevice); } // Phonon initialization media = new Phonon::MediaObject(this); output = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(media, output); mPause = false; mPlay = false; mUserStop = false; mInited = true; return; }
// FIXME: this can go away when we do mixing with gain directly in summing junction of AudioNodeInput // // As soon as we know the channel count of our input, we can lazily initialize. // Sometimes this may be called more than once with different channel counts, in which case we must safely // uninitialize and then re-initialize with the new channel count. void GainNode::checkNumberOfChannelsForInput(ContextRenderLock& r, AudioNodeInput* input) { if (!input) return; ASSERT(r.context()); if (input != this->input(0).get()) return; unsigned numberOfChannels = input->numberOfChannels(r); if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) { // We're already initialized but the channel count has changed. uninitialize(); } if (!isInitialized()) { // This will propagate the channel count to any nodes connected further downstream in the graph. output(0)->setNumberOfChannels(r, numberOfChannels); initialize(); } AudioNode::checkNumberOfChannelsForInput(r, input); }
_daijoubu_node_factory::~_daijoubu_node_factory(void) { if(m_initialized) { uninitialize(); } }
ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { printf("Destruct gdnative interface\n"); if (is_initialized()) { uninitialize(); }; // cleanup after ourselves cleanup(); }
static void quit () { #ifdef NETSUPPORT if (client) CQuit ("Selected quit in main menu"); #endif uninitialize (); exit (0); }
void ARVRInterface::set_is_initialized(bool p_initialized) { if (p_initialized) { if (!is_initialized()) { initialize(); }; } else { if (is_initialized()) { uninitialize(); }; }; };
void MediaPlayer::loadMedia(const ds::Resource& reccy, const bool initializeImmediately) { if(mInitialized){ uninitialize(); } mResource = reccy; if(initializeImmediately){ initialize(); } }
void MediaPlayer::loadMedia(const std::string& mediaPath, const bool initializeImmediately) { if(mInitialized){ uninitialize(); } mResource = ds::Resource(mediaPath, ds::Resource::parseTypeFromFilename(mediaPath)); if(initializeImmediately){ initialize(); } }
void Node::uninitializeImpl() { if( ! mInitialized ) return; if( mAutoEnabled ) disable(); uninitialize(); mInitialized = false; }
OpenSSLInitializer::~OpenSSLInitializer() { try { uninitialize(); } catch (...) { poco_unexpected(); } }
void Opl2::initialize( const int sample_rate) { uninitialize(); sample_rate_ = std::max(sample_rate, get_min_sample_rate()); emulator_ = DBOPL::Handler{}; emulator_.Init(sample_rate_); is_initialized_ = true; }
int main (int argc, char **argv) { if (!aa_parseoptions (NULL, NULL, &argc, argv) || argc != 1) { printf ("%s", aa_help); exit (1); } initialize (); game (); uninitialize (); return 1; }
void SceneGraph::print() { uninitialize(); for (Node *node = Parser::getNodes(); node; node = node->next()) { node->print(); } for (Route *route = Parser::getRoutes(); route; route = route->next()) { route->output(cout); } initialize(); }
void TrackingSystemIGSTKService::configure() { if (mConfigurationFilePath.isEmpty() || !QFile::exists(mConfigurationFilePath)) { reportWarning(QString("Configuration file [%1] is not valid, could not configure the toolmanager.").arg(mConfigurationFilePath)); return; } //parse ConfigurationFileParser configParser(mConfigurationFilePath, mLoggingFolder); std::vector<IgstkTracker::InternalStructure> trackers = configParser.getTrackers(); if (trackers.empty()) { reportWarning("Failed to configure tracking."); return; } IgstkTracker::InternalStructure trackerStructure = trackers[0]; //we only support one tracker atm IgstkTool::InternalStructure referenceToolStructure; std::vector<IgstkTool::InternalStructure> toolStructures; QString referenceToolFile = configParser.getAbsoluteReferenceFilePath(); std::vector<QString> toolfiles = configParser.getAbsoluteToolFilePaths(); for (std::vector<QString>::iterator it = toolfiles.begin(); it != toolfiles.end(); ++it) { ToolFileParser toolParser(*it, mLoggingFolder); IgstkTool::InternalStructure internalTool = toolParser.getTool(); if ((*it) == referenceToolFile) referenceToolStructure = internalTool; else toolStructures.push_back(internalTool); } //new thread mTrackerThread.reset(new IgstkTrackerThread(trackerStructure, toolStructures, referenceToolStructure)); connect(mTrackerThread.get(), SIGNAL(configured(bool)), this, SLOT(trackerConfiguredSlot(bool))); connect(mTrackerThread.get(), SIGNAL(initialized(bool)), this, SLOT(initializedSlot(bool))); connect(mTrackerThread.get(), SIGNAL(tracking(bool)), this, SLOT(trackerTrackingSlot(bool))); connect(mTrackerThread.get(), SIGNAL(error()), this, SLOT(uninitialize())); //start threads if (mTrackerThread) mTrackerThread->start(); }
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: g_sys = NULL; break; case DLL_PROCESS_DETACH: uninitialize(); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: default: break; } return TRUE; }
bool MediaConverter::imgs2media(LPRImage *pRawImages[], size_t imgCount, EventMedia &eventMedia) { if (imgCount == 0) { printf("Input is empty.\n"); return true; } ////////////////////////////////////////////////////////////////////////// if(!initialize(pRawImages[0], "temp.avi")) { printf("Failed to initialize.\n"); return false; } ////////////////////////////////////////////////////////////////////////// if (!(mOutputFormatCtxPtr->flags & AVFMT_NOFILE)) { /*if (avio_open(&mOutputFormatCtxPtr->pb, mediaName.c_str(), AVIO_FLAG_WRITE) < 0) { printf("Could not open %s.\n", mediaName.c_str()); return false; }*/ if (avio_open_dyn_buf(&mOutputFormatCtxPtr->pb) < 0) { printf("Could not open avio buff.\n"); return false; } } ////////////////////////////////////////////////////////////////////////// // Output avformat_write_header(mOutputFormatCtxPtr, NULL); for (size_t i = 0; i < imgCount; ++ i) outputFrame(pRawImages[i]); flushFrames(); av_write_trailer(mOutputFormatCtxPtr); ////////////////////////////////////////////////////////////////////////// if (!(mOutputFormatCtxPtr->flags & AVFMT_NOFILE)) { //avio_close(mOutputFormatCtxPtr->pb); eventMedia.mBufferSize = avio_close_dyn_buf(mOutputFormatCtxPtr->pb, &eventMedia.mBufferPtr); } ////////////////////////////////////////////////////////////////////////// // 清理环境 uninitialize(); return true; }