summaryrefslogtreecommitdiffstats
path: root/src/engine/events/CreateNodeEvent.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-03 00:56:34 +0000
committerDavid Robillard <d@drobilla.net>2009-06-03 00:56:34 +0000
commit952d0c985dd511050ba17f4e293faf01d7885dad (patch)
tree482c0bbd38f3afb058a2a4c4d984c13a842b9073 /src/engine/events/CreateNodeEvent.cpp
parent6fa626aa20ca44e17713d947d60ec661ba44f0f5 (diff)
downloadingen-952d0c985dd511050ba17f4e293faf01d7885dad.tar.gz
ingen-952d0c985dd511050ba17f4e293faf01d7885dad.tar.bz2
ingen-952d0c985dd511050ba17f4e293faf01d7885dad.zip
Chop "Event" from event source file names.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2066 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events/CreateNodeEvent.cpp')
-rw-r--r--src/engine/events/CreateNodeEvent.cpp148
1 files changed, 0 insertions, 148 deletions
diff --git a/src/engine/events/CreateNodeEvent.cpp b/src/engine/events/CreateNodeEvent.cpp
deleted file mode 100644
index 718a94a3..00000000
--- a/src/engine/events/CreateNodeEvent.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/Path.hpp"
-#include "redlandmm/World.hpp"
-#include "module/World.hpp"
-#include "CreateNodeEvent.hpp"
-#include "Responder.hpp"
-#include "PatchImpl.hpp"
-#include "NodeImpl.hpp"
-#include "PluginImpl.hpp"
-#include "Engine.hpp"
-#include "PatchImpl.hpp"
-#include "NodeFactory.hpp"
-#include "ClientBroadcaster.hpp"
-#include "EngineStore.hpp"
-#include "PortImpl.hpp"
-#include "AudioDriver.hpp"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-
-using namespace Shared;
-
-CreateNodeEvent::CreateNodeEvent(
- Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const Path& path,
- const URI& plugin_uri,
- bool polyphonic,
- const Resource::Properties& properties)
- : QueuedEvent(engine, responder, timestamp)
- , _path(path)
- , _plugin_uri(plugin_uri)
- , _polyphonic(polyphonic)
- , _patch(NULL)
- , _node(NULL)
- , _compiled_patch(NULL)
- , _node_already_exists(false)
- , _properties(properties)
-{
- string uri = _plugin_uri.str();
- if (uri.substr(0, 3) == "om:") {
- size_t colon = 2;
- uri = uri.substr(colon + 1);
- if ((colon = uri.find(":")) == string::npos)
- return;
- _plugin_type = uri.substr(0, colon + 1);
- _plugin_label = uri.substr(colon + 1);
- uri = "";
- }
-}
-
-
-void
-CreateNodeEvent::pre_process()
-{
- if (_engine.engine_store()->find_object(_path) != NULL) {
- _node_already_exists = true;
- QueuedEvent::pre_process();
- return;
- }
-
- _patch = _engine.engine_store()->find_patch(_path.parent());
-
- PluginImpl* const plugin = (_plugin_label == "")
- ? _engine.node_factory()->plugin(_plugin_uri.str())
- : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label);
-
- if (_patch && plugin) {
-
- _node = plugin->instantiate(_path.name(), _polyphonic, _patch, _engine);
- _node->properties().insert(_properties.begin(), _properties.end());
-
- if (_node != NULL) {
- _node->activate();
-
- // This can be done here because the audio thread doesn't touch the
- // node tree - just the process order array
- _patch->add_node(new PatchImpl::Nodes::Node(_node));
- //_node->add_to_store(_engine.engine_store());
- _engine.engine_store()->add(_node);
-
- // FIXME: not really necessary to build process order since it's not connected,
- // just append to the list
- if (_patch->enabled())
- _compiled_patch = _patch->compile();
- }
- }
- QueuedEvent::pre_process();
-}
-
-
-void
-CreateNodeEvent::execute(ProcessContext& context)
-{
- QueuedEvent::execute(context);
-
- if (_node != NULL) {
- if (_patch->compiled_patch() != NULL)
- _engine.maid()->push(_patch->compiled_patch());
- _patch->compiled_patch(_compiled_patch);
- }
-}
-
-
-void
-CreateNodeEvent::post_process()
-{
- string msg;
- if (_node_already_exists) {
- msg = string("Could not create node - ").append(_path.str());// + " already exists.";
- _responder->respond_error(msg);
- } else if (_patch == NULL) {
- msg = "Could not find patch '" + _path.parent().str() +"' to add node.";
- _responder->respond_error(msg);
- } else if (_node == NULL) {
- msg = "Unable to load node ";
- msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")";
- _responder->respond_error(msg);
- } else {
- _responder->respond_ok();
- _engine.broadcaster()->send_object(_node, true); // yes, send ports
- }
-}
-
-
-} // namespace Ingen
-