summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 20:16:21 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 20:16:21 +0000
commit9dadfb83f9ce69a870362824bc6a3cad371385af (patch)
tree8018e5fdcd77dbb674191c3a3200c2680670876b /src/libs/engine
parentcd0bc4625bab110e8e4b780c5b80c87662d35bab (diff)
downloadingen-9dadfb83f9ce69a870362824bc6a3cad371385af.tar.gz
ingen-9dadfb83f9ce69a870362824bc6a3cad371385af.tar.bz2
ingen-9dadfb83f9ce69a870362824bc6a3cad371385af.zip
Set/send/etc properties through the engine.
Add 'ingen:selected' property so selection is persistent and shared among clients. git-svn-id: http://svn.drobilla.net/lad/ingen@1424 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/GraphObjectImpl.hpp3
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp2
-rw-r--r--src/libs/engine/ObjectSender.cpp12
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp4
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp30
-rw-r--r--src/libs/engine/events/SetMetadataEvent.hpp8
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;
};