diff options
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/GraphObjectImpl.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/ObjectSender.cpp | 12 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.cpp | 30 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.hpp | 8 |
6 files changed, 45 insertions, 14 deletions
diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp index bee10c98..9b1f675d 100644 --- a/src/libs/engine/GraphObjectImpl.hpp +++ b/src/libs/engine/GraphObjectImpl.hpp @@ -72,6 +72,9 @@ public: void set_variable(const std::string& key, const Atom& value) { _variables[key] = value; } + + void set_property(const std::string& key, const Atom& value) + { _properties[key] = value; } const Atom& get_variable(const std::string& key) { static Atom null_atom; diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index b9e2a70d..1078a86a 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -70,7 +70,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t } // For debugging, print all incoming OSC messages - //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); + lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); // Set response address for this message. // It's important this is first and returns nonzero. diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 3a716a28..bcab46a8 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -97,11 +97,16 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu client->new_node(node->path(), node->plugin()->uri()); client->set_property(node->path(), "ingen:polyphonic", node->polyphonic()); - // Send variable + // Send variables const GraphObjectImpl::Variables& data = node->variables(); for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(node->path(), (*j).first, (*j).second); + // Send properties + const GraphObjectImpl::Properties& prop = node->properties(); + for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j) + client->set_property(node->path(), (*j).first, (*j).second); + client->bundle_end(); if (recursive) { @@ -127,6 +132,11 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port) for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(port->path(), (*j).first, (*j).second); + // Send properties + const GraphObjectImpl::Properties& prop = port->properties(); + for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j) + client->set_property(port->path(), (*j).first, (*j).second); + // Send control value if (port->type() == DataType::CONTROL) { const Sample value = dynamic_cast<const AudioBuffer*>(port->buffer(0))->value_at(0); diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 3e45734a..b07d3a02 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -304,7 +304,7 @@ QueuedEngineInterface::set_variable(const string& path, const string& predicate, const Atom& value) { - push_queued(new SetMetadataEvent(_engine, _responder, now(), path, predicate, value)); + push_queued(new SetMetadataEvent(_engine, _responder, now(), false, path, predicate, value)); } @@ -329,6 +329,8 @@ QueuedEngineInterface::set_property(const string& path, push_queued(new SetPolyphonyEvent(_engine, _responder, now(), this, path, value.get_int32())); return; } + } else { + push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value)); } cerr << "WARNING: Unknown property (or bad type) \"" << predicate << "\"" << endl; diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 3e41a510..b4ee00ff 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -28,12 +28,20 @@ using std::string; namespace Ingen { -SetMetadataEvent::SetMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const Atom& value) -: QueuedEvent(engine, responder, timestamp), - _path(path), - _key(key), - _value(value), - _object(NULL) +SetMetadataEvent::SetMetadataEvent( + Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + bool property, + const string& path, + const string& key, + const Atom& value) + : QueuedEvent(engine, responder, timestamp) + , _property(property) + , _path(path) + , _key(key) + , _value(value) + , _object(NULL) { } @@ -47,7 +55,10 @@ SetMetadataEvent::pre_process() return; } - _object->set_variable(_key, _value); + if (_property) + _object->set_property(_key, _value); + else + _object->set_variable(_key, _value); QueuedEvent::pre_process(); } @@ -70,7 +81,10 @@ SetMetadataEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - _engine.broadcaster()->send_variable_change(_path, _key, _value); + if (_property) + _engine.broadcaster()->send_property_change(_path, _key, _value); + else + _engine.broadcaster()->send_variable_change(_path, _key, _value); } } diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp index 457d3052..9707ce56 100644 --- a/src/libs/engine/events/SetMetadataEvent.hpp +++ b/src/libs/engine/events/SetMetadataEvent.hpp @@ -39,6 +39,7 @@ public: SetMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, + bool property, const string& path, const string& key, const Raul::Atom& value); @@ -48,9 +49,10 @@ public: void post_process(); private: - string _path; - string _key; - Raul::Atom _value; + bool _property; + string _path; + string _key; + Raul::Atom _value; GraphObjectImpl* _object; }; |