Exemplo n.º 1
0
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_;
}
Exemplo n.º 2
0
		Audio::~Audio()
		{
			if(m_initialized)
			{
				uninitialize();
			}
		}
Exemplo n.º 3
0
EpicNavCorePlugin::~EpicNavCorePlugin()
{
    uninitialize();

    costmap = nullptr;
    initialized = false;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
		_nes_rom::~_nes_rom(void)
		{

			if(is_initialized()) {
				uninitialize();
			}
		}
Exemplo n.º 6
0
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;
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 10
0
// 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();
}
Exemplo n.º 11
0
// 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);
}
Exemplo n.º 12
0
/*!  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);
}
Exemplo n.º 13
0
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();
	}
}
Exemplo n.º 14
0
RenderDeviceD3D::~RenderDeviceD3D()
{
	m_Swapchain->SetFullscreenState(FALSE, NULL);

	uninitialize();
	destroyDevice();
}
Exemplo n.º 15
0
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;
}
Exemplo n.º 16
0
// 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);
}
Exemplo n.º 17
0
		_daijoubu_node_factory::~_daijoubu_node_factory(void)
		{

			if(m_initialized) {
				uninitialize();
			}
		}
Exemplo n.º 18
0
ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
	printf("Destruct gdnative interface\n");

	if (is_initialized()) {
		uninitialize();
	};

	// cleanup after ourselves
	cleanup();
}
Exemplo n.º 19
0
static void
quit ()
{
#ifdef NETSUPPORT
  if (client)
    CQuit ("Selected quit in main menu");
#endif
  uninitialize ();
  exit (0);
}
Exemplo n.º 20
0
void ARVRInterface::set_is_initialized(bool p_initialized) {
	if (p_initialized) {
		if (!is_initialized()) {
			initialize();
		};
	} else {
		if (is_initialized()) {
			uninitialize();
		};
	};
};
Exemplo n.º 21
0
void MediaPlayer::loadMedia(const ds::Resource& reccy, const bool initializeImmediately) {
	if(mInitialized){
		uninitialize();
	}

	mResource = reccy;

	if(initializeImmediately){
		initialize();
	}
}
Exemplo n.º 22
0
void MediaPlayer::loadMedia(const std::string& mediaPath, const bool initializeImmediately) {
	if(mInitialized){
		uninitialize();
	}

	mResource = ds::Resource(mediaPath, ds::Resource::parseTypeFromFilename(mediaPath));

	if(initializeImmediately){
		initialize();
	}
}
Exemplo n.º 23
0
void Node::uninitializeImpl()
{
	if( ! mInitialized )
		return;

	if( mAutoEnabled )
		disable();

	uninitialize();
	mInitialized = false;
}
Exemplo n.º 24
0
OpenSSLInitializer::~OpenSSLInitializer()
{
	try
	{
		uninitialize();
	}
	catch (...)
	{
		poco_unexpected();
	}
}
Exemplo n.º 25
0
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;
}
Exemplo n.º 26
0
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;
}
Exemplo n.º 27
0
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();
}
Exemplo n.º 29
0
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;
}
Exemplo n.º 30
0
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;
}