summaryrefslogtreecommitdiffstats
path: root/src/server/NodeFactory.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-18 23:05:06 +0000
committerDavid Robillard <d@drobilla.net>2012-08-18 23:05:06 +0000
commit317627ef40f7654c298aa1ac707851c852259e3a (patch)
tree38f7ed57aafb7b3b8e21e6caa3429a39207e4a9a /src/server/NodeFactory.cpp
parent160b2baf7df8b960f22619c013b3197c0dc51c2b (diff)
downloadingen-317627ef40f7654c298aa1ac707851c852259e3a.tar.gz
ingen-317627ef40f7654c298aa1ac707851c852259e3a.tar.bz2
ingen-317627ef40f7654c298aa1ac707851c852259e3a.zip
Node => Block
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4720 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/NodeFactory.cpp')
-rw-r--r--src/server/NodeFactory.cpp134
1 files changed, 0 insertions, 134 deletions
diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp
deleted file mode 100644
index 6683658b..00000000
--- a/src/server/NodeFactory.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-
-#include "lilv/lilv.h"
-
-#include "ingen/World.hpp"
-#include "internals/Controller.hpp"
-#include "internals/Delay.hpp"
-#include "internals/Note.hpp"
-#include "internals/Trigger.hpp"
-
-#include "InternalPlugin.hpp"
-#include "LV2Plugin.hpp"
-#include "NodeFactory.hpp"
-#include "ThreadManager.hpp"
-
-using namespace std;
-
-namespace Ingen {
-namespace Server {
-
-using namespace Internals;
-
-NodeFactory::NodeFactory(Ingen::World* world)
- : _world(world)
- , _lv2_info(new LV2Info(world))
- , _has_loaded(false)
-{
- load_internal_plugins();
-}
-
-NodeFactory::~NodeFactory()
-{
- for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i)
- delete i->second;
-
- _plugins.clear();
-}
-
-const NodeFactory::Plugins&
-NodeFactory::plugins()
-{
- ThreadManager::assert_thread(THREAD_PRE_PROCESS);
- if (!_has_loaded) {
- _has_loaded = true;
- // TODO: Plugin list refreshing
- load_lv2_plugins();
- _has_loaded = true;
- }
- return _plugins;
-}
-
-PluginImpl*
-NodeFactory::plugin(const Raul::URI& uri)
-{
- load_plugin(uri);
- const Plugins::const_iterator i = _plugins.find(uri);
- return ((i != _plugins.end()) ? i->second : NULL);
-}
-
-void
-NodeFactory::load_internal_plugins()
-{
- Ingen::URIs& uris = _world->uris();
- InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris);
- _plugins.insert(make_pair(controller_plug->uri(), controller_plug));
-
- InternalPlugin* delay_plug = DelayNode::internal_plugin(uris);
- _plugins.insert(make_pair(delay_plug->uri(), delay_plug));
-
- InternalPlugin* note_plug = NoteNode::internal_plugin(uris);
- _plugins.insert(make_pair(note_plug->uri(), note_plug));
-
- InternalPlugin* trigger_plug = TriggerNode::internal_plugin(uris);
- _plugins.insert(make_pair(trigger_plug->uri(), trigger_plug));
-}
-
-void
-NodeFactory::load_plugin(const Raul::URI& uri)
-{
- if (_has_loaded || _plugins.find(uri) != _plugins.end()) {
- return;
- }
-
- LilvNode* node = lilv_new_uri(_world->lilv_world(), uri.c_str());
- const LilvPlugins* plugs = lilv_world_get_all_plugins(_world->lilv_world());
- const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node);
- if (plug) {
- LV2Plugin* const ingen_plugin = new LV2Plugin(_lv2_info, uri);
- ingen_plugin->lilv_plugin(plug);
- _plugins.insert(make_pair(uri, ingen_plugin));
- }
- lilv_node_free(node);
-}
-
-/** Loads information about all LV2 plugins into internal plugin database.
- */
-void
-NodeFactory::load_lv2_plugins()
-{
- const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world());
- LILV_FOREACH(plugins, i, plugins) {
- const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i);
-
- const Raul::URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug)));
-
- if (_plugins.find(uri) != _plugins.end()) {
- continue;
- }
-
- LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri);
-
- plugin->lilv_plugin(lv2_plug);
- _plugins.insert(make_pair(uri, plugin));
- }
-}
-
-} // namespace Server
-} // namespace Ingen