Пример #1
0
 /**
  * We override this function in FilePluginProvider to allow the single
  * plugin method to create a non-fragmenting memory allocation. We take
  * the plugins found and tell the memory manager to allocate space for
  * them.
  */
PluginList ELFPluginProvider::getPlugins() {
	PluginList pl = FilePluginProvider::getPlugins();

#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
	// This static downcast is safe because all of the plugins must
	// be ELF plugins
	for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
		(static_cast<ELFPlugin *>(*p))->trackSize();
	}

	// The Memory Manager should now allocate space based on the information
	// it collected
	ELFMemMan.allocateHeap();
#endif

	return pl;
}
  void PluginRegistry::add_path (std::string const& path)
  {
      visual_log (VISUAL_LOG_INFO, "Adding to plugin search path: %s", path.c_str());

      m_impl->plugin_paths.push_back (path);

      PluginList plugins;
      m_impl->get_plugins_from_dir (plugins, path);

      for (PluginList::iterator plugin = plugins.begin (), plugin_end = plugins.end ();
           plugin != plugin_end;
           ++plugin)
      {
          PluginList& list = m_impl->plugin_list_map[(*plugin)->info->type];
          list.push_back (*plugin);
      }
  }
        void Application::Terminate()
        {
            BOOST_ASSERT( m_IsInitialized == true );

            // Terminate the subsystems in the opposite order as they were registered.
            SubsystemList::reverse_iterator iter = m_Subsystems.rbegin();
            while ( iter != m_Subsystems.rend() )
            {
                SubsystemPtr subsystem = (*iter);
                subsystem->Terminate();

                ++iter;
            }

            m_Subsystems.clear();

            // Unload any previously loaded plug-ins
            PluginList plugins = m_Plugins;
            PluginList::iterator pluginIter = plugins.begin();
            while ( pluginIter != plugins.end() )
            {
                PluginPtr plugin = (*pluginIter);
                plugin->Terminate();

                UnloadPlugin( plugin );
                ++pluginIter;
            }

            plugins.clear();
            m_PluginsByName.clear();
            m_PluginsByFileName.clear();
            m_Plugins.clear();

            // Flush all the libraries.  At this point
            // there should be no residual pointers to objects
            // created in the library.
            m_DynamicLibSubsystem->Flush();

            m_IsInitialized = false;

            OnTerminated( EventArgs( *this ) );
        }
Пример #4
0
void initPlugins(bool ladspa, bool lv2, bool vst)
{
    //ladspa = vst = false;

    // LADSPA
    if (ladspa)
    {
        fprintf(stderr, "Looking up LADSPA plugins...\n");

		QStringList ladspaPathList;
#ifdef __WINDOWS__
        // TODO - look for ladspa in known locations
#else
        const char* ladspaPath = getenv("LADSPA_PATH");
        if (ladspaPath == 0)
		{
			ladspaPathList = config.ladspaPaths.split(":");//"/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa";
        }
		else
			ladspaPathList = QString(ladspaPath).split(":");
#endif

        foreach(QString s, ladspaPathList)
            loadPluginDir(s, PLUGIN_LADSPA);
    }

    if (lv2)
    {
        fprintf(stderr, "Looking up LV2 plugins...\n");
        initLV2();
    }

    if (vst)
    {
        // TODO
        fprintf(stderr, "Looking up VST plugins...\n");

        QStringList vstPathList;
#ifdef __WINDOWS__
        // TODO - look for vst in known locations
#else
        const char* vstPath = getenv("VST_PATH");
        if (vstPath == 0)
		{
			if(debugMsg)
				qDebug("from config VST_PATH: %s", config.vstPaths.toUtf8().constData());
			vstPathList = config.vstPaths.split(":");
		}
		else
		{
			 vstPathList = QString(vstPath).split(":");
			if(debugMsg)
				qDebug("from env VST_PATH: %s", vstPath);
		}
			//"/usr/local/lib64/vst:/usr/lib64/vst:/usr/local/lib/vst:/usr/lib/vst";
#endif

        foreach (QString s, vstPathList)
            loadPluginDir(s, PLUGIN_VST);
    }

    // Add the synth plugins to the midi-device list
    for (iPlugin i = plugins.begin(); i != plugins.end(); ++i)
    {
        if (i->hints() & PLUGIN_IS_SYNTH)
        {
            SynthPluginDevice* dev = new SynthPluginDevice(i->type(), i->filename(true), i->name(), i->label());
            midiDevices.add(dev);
        }
    }
}