From c11ecf0fd10641218326ae384e80413ba3cdf46c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 May 2009 17:42:51 +0000 Subject: Remove 'new_patch', 'new_node', and 'new_port' from interface in favour of generic 'put'. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2011 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/QueuedEngineInterface.cpp | 57 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'src/engine/QueuedEngineInterface.cpp') diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index e19261f7..a1192c03 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -23,6 +23,7 @@ #include "Engine.hpp" #include "AudioDriver.hpp" +using namespace std; using namespace Raul; namespace Ingen { @@ -149,36 +150,36 @@ QueuedEngineInterface::bundle_end() // Object commands -bool -QueuedEngineInterface::new_object(const GraphObject* object) -{ - return false; -} - - -void -QueuedEngineInterface::new_patch(const Path& path, - uint32_t poly) -{ - push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly)); -} - - -// FIXME: use index -void QueuedEngineInterface::new_port(const Path& path, - const URI& type, - uint32_t index, - bool direction) -{ - push_queued(new CreatePortEvent(_engine, _responder, now(), path, type, direction, this)); -} - void -QueuedEngineInterface::new_node(const Path& path, - const URI& plugin_uri) -{ - push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_uri, true)); +QueuedEngineInterface::put(const Path& path, + const Resource::Properties& properties) +{ + typedef Resource::Properties::const_iterator iterator; + cerr << "ENGINE PUT " << path << " {" << endl; + for (iterator i = properties.begin(); i != properties.end(); ++i) + cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl; + cerr << "}" << endl; + + bool is_patch = false, is_node = false, is_port = false, is_output = false; + DataType data_type(DataType::UNKNOWN); + ResourceImpl::type(properties, is_patch, is_node, is_port, is_output, data_type); + + if (is_patch) { + uint32_t poly = 1; + iterator p = properties.find("ingen:polyphony"); + if (p != properties.end() && p->second.is_valid() && p->second.type() == Atom::INT) + poly = p->second.get_int32(); + push_queued(new CreatePatchEvent( + _engine, _responder, now(), path, poly, properties)); + } else if (is_node) { + const iterator p = properties.find("rdf:instanceOf"); + push_queued(new CreateNodeEvent( + _engine, _responder, now(), path, p->second.get_uri(), true, properties)); + } else if (is_port) { + push_queued(new CreatePortEvent( + _engine, _responder, now(), path, data_type.uri(), is_output, this, properties)); + } } -- cgit v1.2.1