From 304454c63ea00b57b55bc2023e1d52fb51e8ef7f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 28 May 2009 22:28:05 +0000 Subject: Fix loading connections inside subpatches to patch ports. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2039 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/QueuedEngineInterface.cpp | 5 ++--- src/engine/QueuedEvent.hpp | 6 +++--- src/engine/events/CreatePortEvent.cpp | 3 --- src/engine/events/SetMetadataEvent.cpp | 27 +++++++++++++-------------- 4 files changed, 18 insertions(+), 23 deletions(-) (limited to 'src/engine') diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index a6a3f1cd..cce6bb9d 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -155,16 +155,15 @@ void QueuedEngineInterface::put(const URI& uri, const Resource::Properties& properties) { - cerr << "PUT " << uri << endl; size_t hash = uri.find("#"); bool meta = (hash != string::npos); Path path(meta ? (string("/") + uri.chop_start("#")) : uri.str()); typedef Resource::Properties::const_iterator iterator; - cerr << "ENGINE PUT " << path << " (" << path << ") {" << endl; + /*cerr << "ENGINE PUT " << path << " (" << path << ") {" << endl; for (iterator i = properties.begin(); i != properties.end(); ++i) cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl; - cerr << "}" << endl; + cerr << "}" << endl;*/ push_queued(new SetMetadataEvent(_engine, _responder, now(), this, meta, path, properties)); } diff --git a/src/engine/QueuedEvent.hpp b/src/engine/QueuedEvent.hpp index 6bc6a898..71c29624 100644 --- a/src/engine/QueuedEvent.hpp +++ b/src/engine/QueuedEvent.hpp @@ -60,9 +60,9 @@ protected: bool blocking = false, QueuedEventSource* source = NULL) : Event(engine, responder, time) + , _source(source) , _pre_processed(false) , _blocking(blocking) - , _source(source) { if (blocking) assert(_source); @@ -71,14 +71,14 @@ protected: // NULL event base (for internal events only!) QueuedEvent(Engine& engine) : Event(engine, SharedPtr(), 0) + , _source(NULL) , _pre_processed(false) , _blocking(false) - , _source(NULL) {} + QueuedEventSource* _source; bool _pre_processed; bool _blocking; - QueuedEventSource* _source; }; diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp index e954c56d..8136e3ae 100644 --- a/src/engine/events/CreatePortEvent.cpp +++ b/src/engine/events/CreatePortEvent.cpp @@ -153,9 +153,6 @@ CreatePortEvent::execute(ProcessContext& context) _engine.midi_driver()->add_port(_driver_port); } } - - if (_source) - _source->unblock(); } diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp index 0349ba29..24dbce88 100644 --- a/src/engine/events/SetMetadataEvent.cpp +++ b/src/engine/events/SetMetadataEvent.cpp @@ -30,6 +30,7 @@ #include "CreatePatchEvent.hpp" #include "CreateNodeEvent.hpp" #include "CreatePortEvent.hpp" +#include "QueuedEventSource.hpp" using namespace std; @@ -82,7 +83,6 @@ SetMetadataEvent::pre_process() if (is_graph_object && !_object) { Path path(_subject.str()); - cerr << "CREATE NEW GRAPH OBJECT" << 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); @@ -115,7 +115,8 @@ SetMetadataEvent::pre_process() for (Properties::iterator p = _properties.begin(); p != _properties.end(); ++p) { const Raul::URI& key = p->first; const Raul::Atom& value = p->second; - GraphObjectImpl* obj = dynamic_cast(_object); + GraphObjectImpl* obj = dynamic_cast(_object); + SpecialType op = NONE; if (obj) { if (_is_meta) obj->meta().set_property(key, value); @@ -125,11 +126,11 @@ SetMetadataEvent::pre_process() _patch = dynamic_cast(_object); if (key.str() == "ingen:broadcast") { - _types.push_back(ENABLE_BROADCAST); + op = ENABLE_BROADCAST; } else if (_patch) { if (key.str() == "ingen:enabled") { if (value.type() == Atom::BOOL) { - _types.push_back(ENABLE); + op = ENABLE; if (value.get_bool() && !_patch->compiled_patch()) _compiled_patch = _patch->compile(); } else { @@ -137,29 +138,25 @@ SetMetadataEvent::pre_process() } } else if (key.str() == "ingen:polyphonic") { if (value.type() == Atom::BOOL) { - _types.push_back(POLYPHONIC); + op = POLYPHONIC; } else { _error = BAD_TYPE; } } else if (key.str() == "ingen:polyphony") { if (value.type() == Atom::INT) { - _types.push_back(POLYPHONY); + op = POLYPHONY; _patch->prepare_internal_poly(value.get_int32()); } else { _error = BAD_TYPE; } - } else { - _object->set_property(key, value); - _types.push_back(NONE); } - if (_error != NO_ERROR) - break; } - } else { - _types.push_back(NONE); } - _object->set_property(key, value); + if (_error != NO_ERROR) + break; + + _types.push_back(op); } QueuedEvent::pre_process(); @@ -177,6 +174,8 @@ SetMetadataEvent::execute(ProcessContext& context) if (_create_event) { QueuedEvent::execute(context); _create_event->execute(context); + if (_blocking) + _source->unblock(); return; } -- cgit v1.2.1