summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 04:05:30 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 04:05:30 +0000
commitfa067527fe00b66b85d71955e152e9ef9215c9cd (patch)
tree382a8e9e58259929415e7188992252ac1ca2ea9b
parent3019b09099371b3fe568b7dcc3bb92203d800b1f (diff)
downloadingen-fa067527fe00b66b85d71955e152e9ef9215c9cd.tar.gz
ingen-fa067527fe00b66b85d71955e152e9ef9215c9cd.tar.bz2
ingen-fa067527fe00b66b85d71955e152e9ef9215c9cd.zip
Replace imperative polyphony/polyphonic stuff with properties (kill more API).
git-svn-id: http://svn.drobilla.net/lad/ingen@1412 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/bindings/Client.hpp6
-rw-r--r--src/common/interface/ClientInterface.hpp6
-rw-r--r--src/common/interface/CommonInterface.hpp3
-rw-r--r--src/common/interface/EngineInterface.hpp6
-rw-r--r--src/libs/client/ClientStore.cpp26
-rw-r--r--src/libs/client/ClientStore.hpp4
-rw-r--r--src/libs/client/DeprecatedLoader.cpp9
-rw-r--r--src/libs/client/NodeModel.cpp8
-rw-r--r--src/libs/client/NodeModel.hpp4
-rw-r--r--src/libs/client/OSCClientReceiver.cpp31
-rw-r--r--src/libs/client/OSCClientReceiver.hpp2
-rw-r--r--src/libs/client/OSCEngineSender.cpp58
-rw-r--r--src/libs/client/OSCEngineSender.hpp14
-rw-r--r--src/libs/client/ObjectModel.cpp30
-rw-r--r--src/libs/client/ObjectModel.hpp14
-rw-r--r--src/libs/client/PatchModel.cpp9
-rw-r--r--src/libs/client/PatchModel.hpp8
-rw-r--r--src/libs/client/PortModel.hpp2
-rw-r--r--src/libs/client/SigClientInterface.hpp14
-rw-r--r--src/libs/client/ThreadedSigClientInterface.hpp16
-rw-r--r--src/libs/engine/ClientBroadcaster.cpp16
-rw-r--r--src/libs/engine/ClientBroadcaster.hpp2
-rw-r--r--src/libs/engine/GraphObjectImpl.hpp10
-rw-r--r--src/libs/engine/OSCClientSender.cpp49
-rw-r--r--src/libs/engine/OSCClientSender.hpp9
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp20
-rw-r--r--src/libs/engine/ObjectSender.cpp8
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp21
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp13
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp21
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.hpp8
-rw-r--r--src/libs/engine/events/SetPolyphonicEvent.cpp2
-rw-r--r--src/libs/engine/events/SetPolyphonyEvent.cpp2
-rw-r--r--src/libs/gui/ControlPanel.cpp29
-rw-r--r--src/libs/gui/ControlPanel.hpp4
-rw-r--r--src/libs/gui/LoadPluginWindow.cpp3
-rw-r--r--src/libs/gui/NodeModule.cpp10
-rw-r--r--src/libs/gui/NodeModule.hpp1
-rw-r--r--src/libs/gui/ObjectMenu.cpp7
-rw-r--r--src/libs/gui/ObjectMenu.hpp2
-rw-r--r--src/libs/gui/PatchCanvas.cpp2
-rw-r--r--src/libs/gui/PatchPortModule.cpp19
-rw-r--r--src/libs/gui/PatchPortModule.hpp4
-rw-r--r--src/libs/serialisation/Parser.cpp3
44 files changed, 219 insertions, 316 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index 3f427ff3..6b187881 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -57,12 +57,6 @@ public:
const std::string& data_type,
bool is_output) {}
- virtual void polyphonic(const std::string& path,
- bool polyphonic) {}
-
- virtual void patch_polyphony(const std::string& path,
- uint32_t poly) = 0;
-
virtual void patch_cleared(const std::string& path) {}
virtual void object_renamed(const std::string& old_path,
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index e4e1ef44..38625a15 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -74,12 +74,6 @@ public:
const std::string& symbol,
const std::string& name) = 0;
- virtual void polyphonic(const std::string& path,
- bool polyphonic) = 0;
-
- virtual void patch_polyphony(const std::string& path,
- uint32_t poly) = 0;
-
virtual void patch_cleared(const std::string& path) = 0;
virtual void object_renamed(const std::string& old_path,
diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp
index db5234de..e76d0ce7 100644
--- a/src/common/interface/CommonInterface.hpp
+++ b/src/common/interface/CommonInterface.hpp
@@ -48,8 +48,7 @@ public:
uint32_t poly) = 0;
virtual void new_node(const std::string& path,
- const std::string& plugin_uri,
- bool polyphonic) = 0;
+ const std::string& plugin_uri) = 0;
virtual void new_port(const std::string& path,
uint32_t index,
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index 05fcb822..4cd8c64e 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -63,8 +63,7 @@ public:
virtual void new_node_deprecated(const std::string& path,
const std::string& plugin_type,
const std::string& library_name,
- const std::string& plugin_label,
- bool polyphonic) = 0;
+ const std::string& plugin_label) = 0;
virtual void rename(const std::string& old_path,
const std::string& new_symbol) = 0;
@@ -109,6 +108,9 @@ public:
virtual void request_variable(const std::string& path,
const std::string& key) = 0;
+
+ virtual void request_property(const std::string& path,
+ const std::string& key) = 0;
virtual void request_plugins() = 0;
diff --git a/src/libs/client/ClientStore.cpp b/src/libs/client/ClientStore.cpp
index 1fb00eea..969f3a8f 100644
--- a/src/libs/client/ClientStore.cpp
+++ b/src/libs/client/ClientStore.cpp
@@ -42,8 +42,6 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
emitter->signal_new_patch.connect(sigc::mem_fun(this, &ClientStore::new_patch_event));
emitter->signal_new_node.connect(sigc::mem_fun(this, &ClientStore::new_node_event));
emitter->signal_new_port.connect(sigc::mem_fun(this, &ClientStore::new_port_event));
- emitter->signal_polyphonic.connect(sigc::mem_fun(this, &ClientStore::polyphonic_event));
- emitter->signal_patch_polyphony.connect(sigc::mem_fun(this, &ClientStore::patch_polyphony_event));
emitter->signal_patch_cleared.connect(sigc::mem_fun(this, &ClientStore::patch_cleared_event));
emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connection_event));
emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnection_event));
@@ -417,14 +415,14 @@ ClientStore::new_patch_event(const Path& path, uint32_t poly)
void
-ClientStore::new_node_event(const Path& path, const string& plugin_uri, bool polyphonic)
+ClientStore::new_node_event(const Path& path, const string& plugin_uri)
{
SharedPtr<PluginModel> plug = plugin(plugin_uri);
if (!plug) {
- SharedPtr<NodeModel> n(new NodeModel(plugin_uri, path, polyphonic));
+ SharedPtr<NodeModel> n(new NodeModel(plugin_uri, path));
add_plugin_orphan(n);
} else {
- SharedPtr<NodeModel> n(new NodeModel(plug, path, polyphonic));
+ SharedPtr<NodeModel> n(new NodeModel(plug, path));
add_object(n);
}
}
@@ -441,24 +439,6 @@ ClientStore::new_port_event(const Path& path, uint32_t index, const string& type
resolve_connection_orphans(p);
}
-
-void
-ClientStore::polyphonic_event(const Path& path, bool polyphonic)
-{
- SharedPtr<ObjectModel> object = this->object(path);
- if (object)
- object->set_polyphonic(polyphonic);
-}
-
-
-void
-ClientStore::patch_polyphony_event(const Path& path, uint32_t poly)
-{
- SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path));
- if (patch)
- patch->poly(poly);
-}
-
void
ClientStore::patch_cleared_event(const Path& path)
diff --git a/src/libs/client/ClientStore.hpp b/src/libs/client/ClientStore.hpp
index e1b3adaa..a750f875 100644
--- a/src/libs/client/ClientStore.hpp
+++ b/src/libs/client/ClientStore.hpp
@@ -98,10 +98,8 @@ private:
void rename_event(const Path& old_path, const Path& new_path);
void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name);
void new_patch_event(const Path& path, uint32_t poly);
- void new_node_event(const Path& path, const string& plugin_uri, bool polyphonic);
+ void new_node_event(const Path& path, const string& plugin_uri);
void new_port_event(const Path& path, uint32_t index, const string& data_type, bool is_output);
- void polyphonic_event(const Path& path, bool polyphonic);
- void patch_polyphony_event(const Path& path, uint32_t poly);
void patch_cleared_event(const Path& path);
void variable_change_event(const Path& subject_path, const string& predicate, const Atom& value);
void property_change_event(const Path& subject_path, const string& predicate, const Atom& value);
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp
index 3ed6bc5f..6ec1db81 100644
--- a/src/libs/client/DeprecatedLoader.cpp
+++ b/src/libs/client/DeprecatedLoader.cpp
@@ -519,9 +519,11 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
}
if (plugin_uri != "")
- _engine->new_node(path, plugin_uri, polyphonic);
+ _engine->new_node(path, plugin_uri);
else
- _engine->new_node_deprecated(path, plugin_type, library_name, plugin_label, polyphonic);
+ _engine->new_node_deprecated(path, plugin_type, library_name, plugin_label);
+
+ _engine->set_property(path, "ingen:polyphonic", polyphonic);
for (GraphObject::Variables::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_variable(path, i->first, i->second);
@@ -531,7 +533,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
// Not deprecated
} else {
- _engine->new_node(path, plugin_uri, polyphonic);
+ _engine->new_node(path, plugin_uri);
+ _engine->set_property(path, "ingen:polyphonic", polyphonic);
for (GraphObject::Variables::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_variable(path, i->first, i->second);
return true;
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index 96d70663..45d7cffe 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -27,8 +27,8 @@ namespace Ingen {
namespace Client {
-NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic)
- : ObjectModel(path, polyphonic)
+NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path)
+ : ObjectModel(path)
, _plugin_uri(plugin->uri())
, _plugin(plugin)
, _min_values(0)
@@ -36,8 +36,8 @@ NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyp
{
}
-NodeModel::NodeModel(const string& plugin_uri, const Path& path, bool polyphonic)
- : ObjectModel(path, polyphonic)
+NodeModel::NodeModel(const string& plugin_uri, const Path& path)
+ : ObjectModel(path)
, _plugin_uri(plugin_uri)
, _min_values(0)
, _max_values(0)
diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp
index 08e106ab..1f212b6b 100644
--- a/src/libs/client/NodeModel.hpp
+++ b/src/libs/client/NodeModel.hpp
@@ -68,8 +68,8 @@ public:
protected:
friend class ClientStore;
- NodeModel(const string& plugin_uri, const Path& path, bool polyphonic);
- NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic);
+ NodeModel(const string& plugin_uri, const Path& path);
+ NodeModel(SharedPtr<PluginModel> plugin, const Path& path);
NodeModel(const Path& path);
void add_child(SharedPtr<ObjectModel> c);
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 6087736f..5f12cd6e 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -145,16 +145,12 @@ OSCClientReceiver::setup_callbacks()
lo_server_thread_add_method(_st, "/ingen/plugin", "ssss", plugin_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this);
lo_server_thread_add_method(_st, "/ingen/destroyed", "s", destroyed_cb, this);
- lo_server_thread_add_method(_st, "/ingen/patch_polyphony", "si", patch_polyphony_cb, this);
lo_server_thread_add_method(_st, "/ingen/patch_cleared", "s", patch_cleared_cb, this);
lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this);
lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this);
- lo_server_thread_add_method(_st, "/ingen/new_node", "ssT", new_node_cb, this);
- lo_server_thread_add_method(_st, "/ingen/new_node", "ssF", new_node_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/new_node", "ss", new_node_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_port", "sisi", new_port_cb, this);
- lo_server_thread_add_method(_st, "/ingen/polyphonic", "sT", polyphonic_cb, this);
- lo_server_thread_add_method(_st, "/ingen/polyphonic", "sF", polyphonic_cb, this);
lo_server_thread_add_method(_st, "/ingen/set_variable", NULL, set_variable_cb, this);
lo_server_thread_add_method(_st, "/ingen/set_property", NULL, set_property_cb, this);
lo_server_thread_add_method(_st, "/ingen/set_port_value", "sf", set_port_value_cb, this);
@@ -192,14 +188,6 @@ OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** a
int
-OSCClientReceiver::_patch_polyphony_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- patch_polyphony((const char*)&argv[0]->s, argv[1]->i);
- return 0;
-}
-
-
-int
OSCClientReceiver::_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
patch_cleared((const char*)&argv[0]->s);
@@ -246,9 +234,8 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
{
const char* uri = &argv[0]->s;
const char* node_path = &argv[1]->s;
- const bool polyphonic = (types[2] == 'T');
- new_node(uri, node_path, polyphonic);
+ new_node(uri, node_path);
return 0;
}
@@ -270,20 +257,6 @@ OSCClientReceiver::_new_port_cb(const char* path, const char* types, lo_arg** ar
}
-/** Notification of an object's polyphonic flag
- */
-int
-OSCClientReceiver::_polyphonic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* obj_path = &argv[0]->s;
- const bool poly = (types[1] == 'T');
-
- polyphonic(obj_path, poly);
-
- return 0;
-}
-
-
/** Notification of a new or updated variable.
*/
int
diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp
index 9950df7d..eb1efd21 100644
--- a/src/libs/client/OSCClientReceiver.hpp
+++ b/src/libs/client/OSCClientReceiver.hpp
@@ -86,14 +86,12 @@ private:
LO_HANDLER(plugin_list_end);
LO_HANDLER(new_patch);
LO_HANDLER(destroyed);
- LO_HANDLER(patch_polyphony);
LO_HANDLER(patch_cleared);
LO_HANDLER(object_renamed);
LO_HANDLER(connection);
LO_HANDLER(disconnection);
LO_HANDLER(new_node);
LO_HANDLER(new_port);
- LO_HANDLER(polyphonic);
LO_HANDLER(set_variable);
LO_HANDLER(set_property);
LO_HANDLER(set_port_value);
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index d235e7a9..22f0ce86 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -156,22 +156,14 @@ OSCEngineSender::new_port(const string& path,
void
OSCEngineSender::new_node(const string& path,
- const string& plugin_uri,
- bool polyphonic)
+ const string& plugin_uri)
{
- if (polyphonic)
- send("/ingen/new_node", "issT",
- next_id(),
- path.c_str(),
- plugin_uri.c_str(),
- LO_ARGS_END);
- else
- send("/ingen/new_node", "issF",
- next_id(),
- path.c_str(),
- plugin_uri.c_str(),
- LO_ARGS_END);
+ send("/ingen/new_node", "iss",
+ next_id(),
+ path.c_str(),
+ plugin_uri.c_str(),
+ LO_ARGS_END);
}
@@ -183,25 +175,15 @@ void
OSCEngineSender::new_node_deprecated(const string& path,
const string& plugin_type,
const string& library_name,
- const string& plugin_label,
- bool polyphonic)
+ const string& plugin_label)
{
- if (polyphonic)
- send("/ingen/new_node", "issssT",
- next_id(),
- path.c_str(),
- plugin_type.c_str(),
- library_name.c_str(),
- plugin_label.c_str(),
- LO_ARGS_END);
- else
- send("/ingen/new_node", "issssF",
- next_id(),
- path.c_str(),
- plugin_type.c_str(),
- library_name.c_str(),
- plugin_label.c_str(),
- LO_ARGS_END);
+ send("/ingen/new_node", "issss",
+ next_id(),
+ path.c_str(),
+ plugin_type.c_str(),
+ library_name.c_str(),
+ plugin_label.c_str(),
+ LO_ARGS_END);
}
@@ -459,6 +441,7 @@ OSCEngineSender::request_port_value(const string& port_path)
LO_ARGS_END);
}
+
void
OSCEngineSender::request_variable(const string& object_path, const string& key)
{
@@ -469,6 +452,17 @@ OSCEngineSender::request_variable(const string& object_path, const string& key)
LO_ARGS_END);
}
+
+void
+OSCEngineSender::request_property(const string& object_path, const string& key)
+{
+ send("/ingen/request_property", "iss",
+ next_id(),
+ object_path.c_str(),
+ key.c_str(),
+ LO_ARGS_END);
+}
+
void
OSCEngineSender::request_plugins()
diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp
index 985e1db3..771a7232 100644
--- a/src/libs/client/OSCEngineSender.hpp
+++ b/src/libs/client/OSCEngineSender.hpp
@@ -86,14 +86,12 @@ public:
bool is_output);
void new_node(const string& path,
- const string& plugin_uri,
- bool polyphonic);
+ const string& plugin_uri);
void new_node_deprecated(const string& path,
const string& plugin_type,
const string& library_name,
- const string& plugin_label,
- bool polyphonic);
+ const string& plugin_label);
void rename(const string& old_path,
const string& new_name);
@@ -148,19 +146,13 @@ public:
const Raul::Atom& value);
// Requests //
-
void ping();
-
void request_plugin(const string& uri);
-
void request_object(const string& path);
-
void request_port_value(const string& port_path);
-
void request_variable(const string& path, const string& key);
-
+ void request_property(const string& path, const string& key);
void request_plugins();
-
void request_all_objects();
protected:
diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp
index c807797e..c9236c9e 100644
--- a/src/libs/client/ObjectModel.cpp
+++ b/src/libs/client/ObjectModel.cpp
@@ -26,9 +26,8 @@ namespace Ingen {
namespace Client {
-ObjectModel::ObjectModel(const Path& path, bool polyphonic)
+ObjectModel::ObjectModel(const Path& path)
: _path(path)
- , _polyphonic(polyphonic)
{
}
@@ -38,7 +37,7 @@ ObjectModel::~ObjectModel()
}
-/** Get a piece of variable for this object.
+/** Get a variable for this object.
*
* @return Metadata value with key @a key, empty string otherwise.
*/
@@ -55,11 +54,28 @@ ObjectModel::get_variable(const string& key) const
}
-void
-ObjectModel::set_polyphonic(bool polyphonic)
+/** Get a property of this object.
+ *
+ * @return Metadata value with key @a key, empty string otherwise.
+ */
+const Atom&
+ObjectModel::get_property(const string& key) const
+{
+ static const Atom null_atom;
+
+ Variables::const_iterator i = _properties.find(key);
+ if (i != _properties.end())
+ return i->second;
+ else
+ return null_atom;
+}
+
+
+bool
+ObjectModel::polyphonic() const
{
- _polyphonic = polyphonic;
- signal_polyphonic.emit(polyphonic);
+ Variables::const_iterator i = _properties.find("ingen:polyphonic");
+ return (i != _properties.end() && i->second.type() == Atom::BOOL && i->second.get_bool());
}
diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp
index 460d7d9d..b0796275 100644
--- a/src/libs/client/ObjectModel.hpp
+++ b/src/libs/client/ObjectModel.hpp
@@ -60,10 +60,12 @@ public:
virtual ~ObjectModel();
const Atom& get_variable(const string& key) const;
- void set_variable(const string& key, const Atom& value)
+ const Atom& get_property(const string& key) const;
+
+ virtual void set_variable(const string& key, const Atom& value)
{ _variables[key] = value; signal_variable.emit(key, value); }
- void set_property(const string& key, const Atom& value)
+ virtual void set_property(const string& key, const Atom& value)
{ _properties[key] = value; signal_property.emit(key, value); }
const Variables& variables() const { return _variables; }
@@ -71,7 +73,7 @@ public:
const Path path() const { return _path; }
const Symbol symbol() const { return _path.name(); }
SharedPtr<ObjectModel> parent() const { return _parent; }
- bool polyphonic() const { return _polyphonic; }
+ bool polyphonic() const;
GraphObject* graph_parent() const { return _parent.get(); }
@@ -80,26 +82,22 @@ public:
sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child;
sigc::signal<void, const string&, const Atom&> signal_variable;
sigc::signal<void, const string&, const Atom&> signal_property;
- sigc::signal<void, bool> signal_polyphonic;
sigc::signal<void> signal_destroyed;
sigc::signal<void> signal_renamed;
protected:
friend class ClientStore;
- ObjectModel(const Path& path, bool polyphonic);
+ ObjectModel(const Path& path);
virtual void set_path(const Path& p) { _path = p; signal_renamed.emit(); }
virtual void set_parent(SharedPtr<ObjectModel> p) { assert(p); _parent = p; }
virtual void add_child(SharedPtr<ObjectModel> c) {}
virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; }
- void set_polyphonic(bool);
-
virtual void set(SharedPtr<ObjectModel> model);
Path _path;
- bool _polyphonic;
SharedPtr<ObjectModel> _parent;
Variables _variables;
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 38019eda..4fe0e641 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -166,6 +166,15 @@ PatchModel::enabled() const
Variables::const_iterator i = _properties.find("ingen:enabled");
return (i != _properties.end() && i->second.type() == Atom::BOOL && i->second.get_bool());
}
+
+
+void
+PatchModel::set_property(const string& key, const Atom& value)
+{
+ ObjectModel::set_property(key, value);
+ if (key == "ingen:polyphony")
+ _poly = value.get_int32();
+}
bool
diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp
index e39ee2f7..8c60e884 100644
--- a/src/libs/client/PatchModel.hpp
+++ b/src/libs/client/PatchModel.hpp
@@ -48,7 +48,7 @@ public:
SharedPtr<ConnectionModel> get_connection(const string& src_port_path,
const string& dst_port_path) const;
- size_t poly() const { return _poly; }
+ uint32_t poly() const { return _poly; }
uint32_t internal_polyphony() const { return _poly; }
bool enabled() const;
bool polyphonic() const;
@@ -61,6 +61,8 @@ public:
_editable = e;
signal_editable.emit(e);
} }
+
+ virtual void set_property(const string& key, const Atom& value);
static unsigned child_name_offset(ClientStore& store,
SharedPtr<PatchModel> parent,
@@ -71,20 +73,18 @@ public:
sigc::signal<void, SharedPtr<NodeModel> > signal_removed_node;
sigc::signal<void, SharedPtr<ConnectionModel> > signal_new_connection;
sigc::signal<void, SharedPtr<ConnectionModel> > signal_removed_connection;
- sigc::signal<void, uint32_t> signal_polyphony;
sigc::signal<void, bool> signal_editable;
private:
friend class ClientStore;
PatchModel(const Path& patch_path, size_t internal_poly)
- : NodeModel("ingen:Patch", patch_path, false) // FIXME
+ : NodeModel("ingen:Patch", patch_path)
, _poly(internal_poly)
, _editable(true)
{
}
- void poly(size_t p) { _poly = p; signal_polyphony.emit(p); }
void clear();
void add_child(SharedPtr<ObjectModel> c);
bool remove_child(SharedPtr<ObjectModel> c);
diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp
index 3739be58..8fa18f1c 100644
--- a/src/libs/client/PortModel.hpp
+++ b/src/libs/client/PortModel.hpp
@@ -74,7 +74,7 @@ private:
friend class ClientStore;
PortModel(const Path& path, uint32_t index, DataType type, Direction dir)
- : ObjectModel(path, true)
+ : ObjectModel(path)
, _index(index)
, _type(type)
, _direction(dir)
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index 6318f440..dbedd79c 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -54,10 +54,8 @@ public:
sigc::signal<void, uint32_t> signal_num_plugins;
sigc::signal<void, string, string, string, string> signal_new_plugin;
sigc::signal<void, string, uint32_t> signal_new_patch;
- sigc::signal<void, string, string, bool> signal_new_node;
+ sigc::signal<void, string, string> signal_new_node;
sigc::signal<void, string, uint32_t, string, bool> signal_new_port;
- sigc::signal<void, string, bool> signal_polyphonic;
- sigc::signal<void, string, uint32_t> signal_patch_polyphony;
sigc::signal<void, string> signal_patch_cleared;
sigc::signal<void, string, string> signal_object_renamed;
sigc::signal<void, string> signal_object_destroyed;
@@ -109,24 +107,18 @@ protected:
void new_patch(const string& path, uint32_t poly)
{ if (_enabled) signal_new_patch.emit(path, poly); }
- void new_node(const string& path, const string& plugin_uri, bool poly)
- { if (_enabled) signal_new_node.emit(path, plugin_uri, poly); }
+ void new_node(const string& path, const string& plugin_uri)
+ { if (_enabled) signal_new_node.emit(path, plugin_uri); }
void new_port(const string& path, uint32_t index, const string& data_type, bool is_output)
{ if (_enabled) signal_new_port.emit(path, index, data_type, is_output); }
- void polyphonic(const string& path, bool polyphonic)
- { if (_enabled) signal_polyphonic.emit(path, polyphonic); }
-
void connect(const string& src_port_path, const string& dst_port_path)
{ if (_enabled) signal_connection.emit(src_port_path, dst_port_path); }
void object_destroyed(const string& path)
{ if (_enabled) signal_object_destroyed.emit(path); }
- void patch_polyphony(const string& path, uint32_t poly)
- { if (_enabled) signal_patch_polyphony.emit(path, poly); }
-
void patch_cleared(const string& path)
{ if (_enabled) signal_patch_cleared.emit(path); }
diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp
index 291df426..fb6eb447 100644
--- a/src/libs/client/ThreadedSigClientInterface.hpp
+++ b/src/libs/client/ThreadedSigClientInterface.hpp
@@ -54,9 +54,7 @@ public:
, new_patch_slot(signal_new_patch.make_slot())
, new_node_slot(signal_new_node.make_slot())
, new_port_slot(signal_new_port.make_slot())
- , polyphonic_slot(signal_polyphonic.make_slot())
, connection_slot(signal_connection.make_slot())
- , patch_polyphony_slot(signal_patch_polyphony.make_slot())
, patch_cleared_slot(signal_patch_cleared.make_slot())
, object_destroyed_slot(signal_object_destroyed.make_slot())
, object_renamed_slot(signal_object_renamed.make_slot())
@@ -99,24 +97,18 @@ public:
void new_patch(const string& path, uint32_t poly)
{ push_sig(sigc::bind(new_patch_slot, path, poly)); }
- void new_node(const string& path, const string& plugin_uri, bool polyphonic)
- { push_sig(sigc::bind(new_node_slot, path, plugin_uri, polyphonic)); }
+ void new_node(const string& path, const string& plugin_uri)
+ { push_sig(sigc::bind(new_node_slot, path, plugin_uri)); }
void new_port(const string& path, uint32_t index, const string& data_type, bool is_output)
{ push_sig(sigc::bind(new_port_slot, path, index, data_type, is_output)); }
- void polyphonic(const string& path, bool polyphonic)
- { push_sig(sigc::bind(polyphonic_slot, path, polyphonic)); }
-
void connect(const string& src_port_path, const string& dst_port_path)
{ push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); }
void object_destroyed(const string& path)
{ push_sig(sigc::bind(object_destroyed_slot, path)); }
- void patch_polyphony(const string& path, uint32_t poly)
- { push_sig(sigc::bind(patch_polyphony_slot, path, poly)); }
-
void patch_cleared(const string& path)
{ push_sig(sigc::bind(patch_cleared_slot, path)); }
@@ -164,11 +156,9 @@ private:
sigc::slot<void, string> error_slot;
sigc::slot<void, string, string, string, string> new_plugin_slot;
sigc::slot<void, string, uint32_t> new_patch_slot;
- sigc::slot<void, string, string, bool> new_node_slot;
+ sigc::slot<void, string, string> new_node_slot;
sigc::slot<void, string, uint32_t, string, bool> new_port_slot;
- sigc::slot<void, string, bool> polyphonic_slot;
sigc::slot<void, string, string> connection_slot;
- sigc::slot<void, string, uint32_t> patch_polyphony_slot;
sigc::slot<void, string> patch_cleared_slot;
sigc::slot<void, string> object_destroyed_slot;
sigc::slot<void, string, string> object_renamed_slot;
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp
index dce6691e..ff880433 100644
--- a/src/libs/engine/ClientBroadcaster.cpp
+++ b/src/libs/engine/ClientBroadcaster.cpp
@@ -162,14 +162,6 @@ ClientBroadcaster::send_destroyed(const string& path)
void
-ClientBroadcaster::send_polyphonic(const string& path, bool polyphonic)
-{
- for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->polyphonic(path, polyphonic);
-}
-
-
-void
ClientBroadcaster::send_patch_cleared(const string& patch_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
@@ -192,14 +184,6 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string&
}
-void
-ClientBroadcaster::send_patch_polyphony(const string& patch_path, uint32_t poly)
-{
- for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->patch_polyphony(patch_path, poly);
-}
-
-
/** Send notification of a variable update.
*
* Like control changes, does not send update to client that set the variable, if applicable.
diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp
index 07da01f5..b0963610 100644
--- a/src/libs/engine/ClientBroadcaster.hpp
+++ b/src/libs/engine/ClientBroadcaster.hpp
@@ -71,12 +71,10 @@ public:
void send_node(const NodeImpl* node, bool recursive);
void send_port(const PortImpl* port);
void send_destroyed(const string& path);
- void send_polyphonic(const string& path, bool polyphonic);
void send_patch_cleared(const string& patch_path);
void send_connection(const SharedPtr<const ConnectionImpl> connection);
void send_disconnection(const string& src_port_path, const string& dst_port_path);
void send_rename(const string& old_path, const string& new_path);
- void send_patch_polyphony(const string& patch_path, uint32_t poly);
void send_variable_change(const string& node_path, const string& key, const Raul::Atom& value);
void send_property_change(const string& node_path, const string& key, const Raul::Atom& value);
void send_port_value(const string& port_path, const Raul::Atom& value);
diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp
index 1eb8acc9..628db3db 100644
--- a/src/libs/engine/GraphObjectImpl.hpp
+++ b/src/libs/engine/GraphObjectImpl.hpp
@@ -78,8 +78,15 @@ public:
Variables::iterator i = _variables.find(key);
return (i != _variables.end()) ? (*i).second : null_atom;
}
+
+ const Atom& get_property(const std::string& key) {
+ static Atom null_atom;
+ Variables::iterator i = _properties.find(key);
+ return (i != _properties.end()) ? (*i).second : null_atom;
+ }
- const Variables& variables() const { return _variables; }
+ const Variables& variables() const { return _variables; }
+ const Variables& properties() const { return _properties; }
/** The Patch this object is a child of. */
virtual PatchImpl* parent_patch() const;
@@ -111,6 +118,7 @@ protected:
private:
Variables _variables;
+ Variables _properties;
};
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 1429d616..63b7033f 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -211,15 +211,9 @@ OSCClientSender::plugins()
* followed by /ingen/new_node_end. </p> \n \n
*/
void OSCClientSender::new_node(const std::string& node_path,
- const std::string& plugin_uri,
- bool is_polyphonic)
+ const std::string& plugin_uri)
{
- if (is_polyphonic)
- send("/ingen/new_node", "ssT", node_path.c_str(),
- plugin_uri.c_str(), LO_ARGS_END);
- else
- send("/ingen/new_node", "ssF", node_path.c_str(),
- plugin_uri.c_str(), LO_ARGS_END);
+ send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str());
}
@@ -250,30 +244,6 @@ OSCClientSender::new_port(const std::string& path,
/** \page client_osc_namespace
- * <p> \b /ingen/polyphonic - Notification an object's polyphonic property has changed.
- * \arg \b path (string) - Path of object
- * \arg \b polyphonic (bool) - Whether or not object is polyphonic (from it's parent's perspective).
- *
- * \li This is a notification that the object is <em>externally</em> polyphonic,
- * i.e. its parent sees several independent buffers for a single port, one for each voice.
- * An object can be internally polyphonic but externally not if the voices are mixed down;
- * this is true of some instruments and subpatches with mismatched polyphony. </p> \n \n
- */
-void
-OSCClientSender::polyphonic(const std::string& path,
- bool polyphonic)
-{
- if (!_enabled)
- return;
-
- if (polyphonic)
- lo_send(_address, "/ingen/polyphonic", "sT", path.c_str());
- else
- lo_send(_address, "/ingen/polyphonic", "sF", path.c_str());
-}
-
-
-/** \page client_osc_namespace
* <p> \b /ingen/destroyed - Notification an object has been destroyed
* \arg \b path (string) - Path of object (which no longer exists) </p> \n \n
*/
@@ -298,21 +268,6 @@ OSCClientSender::patch_cleared(const std::string& patch_path)
/** \page client_osc_namespace
- * <p> \b /ingen/patch_polyphony - Notification a patch's DSP processing has been polyphony.
- * \arg \b path (string) - Path of polyphony patch</p> \n \n
- */
-void
-OSCClientSender::patch_polyphony(const std::string& patch_path, uint32_t poly)
-{
- if (!_enabled)
- return;
-
- lo_send(_address, "/ingen/patch_polyphony", "si", patch_path.c_str(), poly);
-}
-
-
-
-/** \page client_osc_namespace
* <p> \b /ingen/new_connection - Notification a new connection has been made.
* \arg \b src-path (string) - Path of the source port
* \arg \b dst-path (string) - Path of the destination port</p> \n \n
diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp
index 714e17b2..9a79f934 100644
--- a/src/libs/engine/OSCClientSender.hpp
+++ b/src/libs/engine/OSCClientSender.hpp
@@ -79,20 +79,13 @@ public:
virtual void new_patch(const std::string& path, uint32_t poly);
virtual void new_node(const std::string& path,
- const std::string& plugin_uri,
- bool is_polyphonic);
+ const std::string& plugin_uri);
virtual void new_port(const std::string& path,
uint32_t index,
const std::string& data_type,
bool is_output);
- virtual void polyphonic(const std::string& path,
- bool polyphonic);
-
- virtual void patch_polyphony(const std::string& path,
- uint32_t poly);
-
virtual void patch_cleared(const std::string& path);
virtual void object_destroyed(const std::string& path);
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index afac70b0..b9e2a70d 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -92,10 +92,10 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/set_polyphonic", "isT", set_polyphonic_cb, this);
lo_server_add_method(_server, "/ingen/set_polyphonic", "isF", set_polyphonic_cb, this);
lo_server_add_method(_server, "/ingen/new_port", "issi", new_port_cb, this);
- lo_server_add_method(_server, "/ingen/new_node", "issssT", new_node_cb, this);
- lo_server_add_method(_server, "/ingen/new_node", "issssF", new_node_cb, this);
- lo_server_add_method(_server, "/ingen/new_node", "issT", new_node_by_uri_cb, this);
- lo_server_add_method(_server, "/ingen/new_node", "issF", new_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/ingen/new_node", "issss", new_node_cb, this);
+ lo_server_add_method(_server, "/ingen/new_node", "issss", new_node_cb, this);
+ lo_server_add_method(_server, "/ingen/new_node", "iss", new_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/ingen/new_node", "iss", new_node_by_uri_cb, this);
lo_server_add_method(_server, "/ingen/destroy", "is", destroy_cb, this);
lo_server_add_method(_server, "/ingen/rename", "iss", rename_cb, this);
lo_server_add_method(_server, "/ingen/connect", "iss", connect_cb, this);
@@ -477,17 +477,15 @@ OSCEngineReceiver::_new_port_cb(const char* path, const char* types, lo_arg** ar
* <p> \b /ingen/new_node - Add a node into a given patch (load a plugin by URI)
* \arg \b response-id (integer)
* \arg \b node-path (string) - Full path of the new node (ie. /patch2/subpatch/newnode)
- * \arg \b plug-uri (string) - URI of the plugin to load
- * \arg \b polyphonic (boolean) - Whether node is polyphonic </p> \n \n
+ * \arg \b plug-uri (string) - URI of the plugin to load \n \n
*/
int
OSCEngineReceiver::_new_node_by_uri_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
const char* plug_uri = &argv[2]->s;
- bool polyphonic = (types[3] == 'T');
- new_node(node_path, plug_uri, polyphonic);
+ new_node(node_path, plug_uri);
return 0;
}
@@ -498,8 +496,7 @@ OSCEngineReceiver::_new_node_by_uri_cb(const char* path, const char* types, lo_a
* \arg \b node-path (string) - Full path of the new node (ie. /patch2/subpatch/newnode)
* \arg \b type (string) - Plugin type ("LADSPA" or "Internal")
* \arg \b lib-name (string) - Name of library where plugin resides (eg "cmt.so")
- * \arg \b plug-label (string) - Label (ID) of plugin (eg "sine_fcaa")
- * \arg \b poly (boolean) - Whether node is polyphonic
+ * \arg \b plug-label (string) - Label (ID) of plugin (eg "sine_fcaa") \n \n
*
* \li This is only here to provide backwards compatibility for old patches that store LADSPA plugin
* references as libname, label. It is to be removed ASAP, don't use it.
@@ -512,9 +509,8 @@ OSCEngineReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
const char* type = &argv[2]->s;
const char* lib_name = &argv[3]->s;
const char* plug_label = &argv[4]->s;
- bool polyphonic = (types[5] == 'T');
- new_node_deprecated(node_path, type, lib_name, plug_label, polyphonic);
+ new_node_deprecated(node_path, type, lib_name, plug_label);
return 0;
}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 82500446..3a716a28 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -36,7 +36,7 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r
client->bundle_begin();
client->new_patch(patch->path(), patch->internal_polyphony());
- client->polyphonic(patch->path(), patch->polyphonic());
+ client->set_property(patch->path(), "ingen:polyphonic", patch->polyphonic());
// Send variable
const GraphObjectImpl::Variables& data = patch->variables();
@@ -94,8 +94,8 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
client->bundle_begin();
- client->new_node(node->path(), node->plugin()->uri(), node->polyphonic());
- client->polyphonic(node->path(), node->polyphonic());
+ client->new_node(node->path(), node->plugin()->uri());
+ client->set_property(node->path(), "ingen:polyphonic", node->polyphonic());
// Send variable
const GraphObjectImpl::Variables& data = node->variables();
@@ -120,7 +120,7 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port)
client->bundle_begin();
client->new_port(port->path(), port->index(), port->type().uri(), port->is_output());
- client->polyphonic(port->path(), port->polyphonic());
+ client->set_property(port->path(), "ingen:polyphonic", port->polyphonic());
// Send variable
const GraphObjectImpl::Variables& data = port->variables();
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 6deeb727..23b9c77e 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -157,11 +157,10 @@ void QueuedEngineInterface::new_port(const string& path,
void
QueuedEngineInterface::new_node(const string& path,
- const string& plugin_uri,
- bool polyphonic)
+ const string& plugin_uri)
{
push_queued(new CreateNodeEvent(_engine, _responder, now(),
- path, plugin_uri, polyphonic));
+ path, plugin_uri, true)); // FIXME: polyphonic by default
}
@@ -169,11 +168,10 @@ void
QueuedEngineInterface::new_node_deprecated(const string& path,
const string& plugin_type,
const string& plugin_lib,
- const string& plugin_label,
- bool polyphonic)
+ const string& plugin_label)
{
push_queued(new CreateNodeEvent(_engine, _responder, now(),
- path, plugin_type, plugin_lib, plugin_label, polyphonic));
+ path, plugin_type, plugin_lib, plugin_label, true)); // FIXME: polyphonic by default
}
void
@@ -359,12 +357,21 @@ QueuedEngineInterface::request_port_value(const string& port_path)
push_queued(new RequestPortValueEvent(_engine, _responder, now(), port_path));
}
+
void
QueuedEngineInterface::request_variable(const string& object_path, const string& key)
{
- push_queued(new RequestMetadataEvent(_engine, _responder, now(), object_path, key));
+ push_queued(new RequestMetadataEvent(_engine, _responder, now(), false, object_path, key));
}
+
+void
+QueuedEngineInterface::request_property(const string& object_path, const string& key)
+{
+ push_queued(new RequestMetadataEvent(_engine, _responder, now(), true, object_path, key));
+}
+
+
void
QueuedEngineInterface::request_plugins()
{
diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp
index 585f1104..6fea3708 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -90,15 +90,13 @@ public:
bool direction);
virtual void new_node(const string& path,
- const string& plugin_uri,
- bool polyphonic);
+ const string& plugin_uri);
/** FIXME: DEPRECATED, REMOVE */
virtual void new_node_deprecated(const string& path,
const string& plugin_type,
const string& lib_path,
- const string& plug_label,
- bool polyphonic);
+ const string& plug_label);
virtual void rename(const string& old_path,
const string& new_name);
@@ -155,17 +153,12 @@ public:
// Requests //
virtual void ping();
-
virtual void request_plugin(const string& uri);
-
virtual void request_object(const string& path);
-
virtual void request_port_value(const string& port_path);
-
virtual void request_variable(const string& object_path, const string& key);
-
+ virtual void request_property(const string& object_path, const string& key);
virtual void request_plugins();
-
virtual void request_all_objects();
protected:
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index 23a3ac7b..733a6a82 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -28,11 +28,17 @@ using std::string;
namespace Ingen {
-RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key)
-: QueuedEvent(engine, responder, timestamp),
- _path(node_path),
- _key(key),
- _object(NULL)
+RequestMetadataEvent::RequestMetadataEvent(Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ bool property,
+ const string& node_path,
+ const string& key)
+ : QueuedEvent(engine, responder, timestamp)
+ , _path(node_path)
+ , _property(property)
+ , _key(key)
+ , _object(NULL)
{
}
@@ -48,7 +54,10 @@ RequestMetadataEvent::pre_process()
}
}
- _value = _object->get_variable(_key);
+ if (_property)
+ _value = _object->get_property(_key);
+ else
+ _value = _object->get_variable(_key);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RequestMetadataEvent.hpp b/src/libs/engine/events/RequestMetadataEvent.hpp
index 71f55399..f6a18dfc 100644
--- a/src/libs/engine/events/RequestMetadataEvent.hpp
+++ b/src/libs/engine/events/RequestMetadataEvent.hpp
@@ -38,13 +38,19 @@ namespace Shared {
class RequestMetadataEvent : public QueuedEvent
{
public:
- RequestMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key);
+ RequestMetadataEvent(Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ bool property,
+ const string& path,
+ const string& key);
void pre_process();
void post_process();
private:
string _path;
+ bool _property;
string _key;
Raul::Atom _value;
GraphObjectImpl* _object;
diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp
index bce65ba9..9b7fd980 100644
--- a/src/libs/engine/events/SetPolyphonicEvent.cpp
+++ b/src/libs/engine/events/SetPolyphonicEvent.cpp
@@ -68,7 +68,7 @@ SetPolyphonicEvent::post_process()
if (_object) {
if (_success) {
_responder->respond_ok();
- _engine.broadcaster()->send_polyphonic(_path, _poly);
+ _engine.broadcaster()->send_property_change(_path, "ingen:polyphonic", _poly);
} else {
_responder->respond_error("Unable to set object as polyphonic");
}
diff --git a/src/libs/engine/events/SetPolyphonyEvent.cpp b/src/libs/engine/events/SetPolyphonyEvent.cpp
index 17222330..eb6550cb 100644
--- a/src/libs/engine/events/SetPolyphonyEvent.cpp
+++ b/src/libs/engine/events/SetPolyphonyEvent.cpp
@@ -68,7 +68,7 @@ SetPolyphonyEvent::post_process()
{
if (_patch) {
_responder->respond_ok();
- _engine.broadcaster()->send_patch_polyphony(_patch_path, _poly);
+ _engine.broadcaster()->send_property_change(_patch_path, "ingen:polyphony", (int32_t)_poly);
} else {
_responder->respond_error("Unable to find patch");
}
diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp
index 0f38d5dd..84f1163a 100644
--- a/src/libs/gui/ControlPanel.cpp
+++ b/src/libs/gui/ControlPanel.cpp
@@ -73,12 +73,12 @@ ControlPanel::init(SharedPtr<NodeModel> node, uint32_t poly)
add_port(*i);
}
- node->signal_polyphonic.connect(
- sigc::mem_fun(this, &ControlPanel::polyphonic_changed));
+ node->signal_property.connect(bind(
+ sigc::mem_fun(this, &ControlPanel::property_changed), false));
if (node->parent()) {
- ((PatchModel*)node->parent().get())->signal_polyphony.connect(
- sigc::mem_fun(this, &ControlPanel::polyphony_changed));
+ node->signal_property.connect(bind(
+ sigc::mem_fun(this, &ControlPanel::property_changed), true));
} else {
cerr << "[ControlPanel] No parent, polyphonic controls disabled" << endl;
}
@@ -252,19 +252,16 @@ ControlPanel::specific_voice_selected()
void
-ControlPanel::polyphony_changed(uint32_t poly)
+ControlPanel::property_changed(const std::string& predicate, const Raul::Atom& value, bool parent)
{
- _voice_spinbutton->set_range(0, poly - 1);
-}
-
-
-void
-ControlPanel::polyphonic_changed(bool poly)
-{
- if (poly)
- _voice_control_box->show();
- else
- _voice_control_box->hide();
+ if (!parent && predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) {
+ if (value.get_bool())
+ _voice_control_box->show();
+ else
+ _voice_control_box->hide();
+ } else if (parent && predicate == "ingen:polyphony" && value.type() == Atom::INT) {
+ _voice_spinbutton->set_range(0, value.get_int32() - 1);
+ }
}
diff --git a/src/libs/gui/ControlPanel.hpp b/src/libs/gui/ControlPanel.hpp
index 9dded79b..8af5a728 100644
--- a/src/libs/gui/ControlPanel.hpp
+++ b/src/libs/gui/ControlPanel.hpp
@@ -69,8 +69,8 @@ public:
private:
void all_voices_selected();
void specific_voice_selected();
- void polyphony_changed(uint32_t poly);
- void polyphonic_changed(bool poly);
+
+ void property_changed(const std::string& predicate, const Raul::Atom& value, bool parent);
bool _callback_enabled;
diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp
index 5aa07c27..92fcb221 100644
--- a/src/libs/gui/LoadPluginWindow.cpp
+++ b/src/libs/gui/LoadPluginWindow.cpp
@@ -345,7 +345,8 @@ LoadPluginWindow::add_clicked()
dialog.run();
} else {
Path path = _patch->path().base() + Path::nameify(name);
- App::instance().engine()->new_node(path, plugin->uri(), polyphonic);
+ App::instance().engine()->new_node(path, plugin->uri());
+ App::instance().engine()->set_property(path, "ingen:polyphonic", polyphonic);
for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i)
App::instance().engine()->set_variable(path, i->first, i->second);
_node_name_entry->set_text(generate_module_name(++_plugin_name_offset));
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 9539c226..fe71dd2f 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -47,7 +47,7 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
node->signal_new_port.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true));
node->signal_removed_port.connect(sigc::mem_fun(this, &NodeModule::remove_port));
node->signal_variable.connect(sigc::mem_fun(this, &NodeModule::set_variable));
- node->signal_polyphonic.connect(sigc::mem_fun(this, &NodeModule::set_stacked_border));
+ node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property));
node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename));
}
@@ -308,5 +308,13 @@ NodeModule::set_variable(const string& key, const Atom& value)
}
+void
+NodeModule::set_property(const string& key, const Atom& value)
+{
+ if (key == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ set_stacked_border(value.get_bool());
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp
index 4f877b74..3bf2d3eb 100644
--- a/src/libs/gui/NodeModule.hpp
+++ b/src/libs/gui/NodeModule.hpp
@@ -73,6 +73,7 @@ protected:
void rename();
void set_variable(const std::string& key, const Atom& value);
+ void set_property(const std::string& predicate, const Raul::Atom& value);
void add_port(SharedPtr<PortModel> port, bool resize=true);
void remove_port(SharedPtr<PortModel> port);
diff --git a/src/libs/gui/ObjectMenu.cpp b/src/libs/gui/ObjectMenu.cpp
index 3a208d51..8f7c3869 100644
--- a/src/libs/gui/ObjectMenu.cpp
+++ b/src/libs/gui/ObjectMenu.cpp
@@ -68,7 +68,7 @@ ObjectMenu::init(SharedPtr<ObjectModel> object)
_properties_menuitem->signal_activate().connect(
sigc::mem_fun(this, &ObjectMenu::on_menu_properties));
- object->signal_polyphonic.connect(sigc::mem_fun(this, &ObjectMenu::polyphonic_changed));
+ object->signal_property.connect(sigc::mem_fun(this, &ObjectMenu::property_changed));
_enable_signal = true;
}
@@ -83,10 +83,11 @@ ObjectMenu::on_menu_polyphonic()
void
-ObjectMenu::polyphonic_changed(bool polyphonic)
+ObjectMenu::property_changed(const std::string& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- _polyphonic_menuitem->set_active(polyphonic);
+ if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ _polyphonic_menuitem->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/libs/gui/ObjectMenu.hpp b/src/libs/gui/ObjectMenu.hpp
index 712322e3..b5c5bf49 100644
--- a/src/libs/gui/ObjectMenu.hpp
+++ b/src/libs/gui/ObjectMenu.hpp
@@ -51,7 +51,7 @@ protected:
void on_menu_destroy();
void on_menu_properties();
- void polyphonic_changed(bool polyphonic);
+ void property_changed(const std::string& predicate, const Raul::Atom& value);
bool _enable_signal;
SharedPtr<ObjectModel> _object;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 77aa64e6..df6ba285 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -627,7 +627,7 @@ PatchCanvas::load_plugin(SharedPtr<PluginModel> plugin)
const Path path = _patch->path().base() + name;
// FIXME: polyphony?
- App::instance().engine()->new_node(path, plugin->uri(), false);
+ App::instance().engine()->new_node(path, plugin->uri());
GraphObject::Variables data = get_initial_data();
for (GraphObject::Variables::const_iterator i = data.begin(); i != data.end(); ++i)
App::instance().engine()->set_variable(path, i->first, i->second);
diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp
index a6192210..75504a91 100644
--- a/src/libs/gui/PatchPortModule.cpp
+++ b/src/libs/gui/PatchPortModule.cpp
@@ -58,8 +58,8 @@ PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPt
set_stacked_border(port->polyphonic());
- port->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::variable_change));
- port->signal_polyphonic.connect(sigc::mem_fun(this, &PatchPortModule::set_stacked_border));
+ port->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_variable));
+ port->signal_property.connect(sigc::mem_fun(this, &PatchPortModule::set_property));
}
@@ -77,7 +77,10 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod
ret->set_menu(ret->_patch_port->menu());
for (GraphObject::Variables::const_iterator m = port->variables().begin(); m != port->variables().end(); ++m)
- ret->variable_change(m->first, m->second);
+ ret->set_variable(m->first, m->second);
+
+ for (GraphObject::Variables::const_iterator m = port->properties().begin(); m != port->properties().end(); ++m)
+ ret->set_property(m->first, m->second);
ret->resize();
@@ -114,7 +117,7 @@ PatchPortModule::store_location()
void
-PatchPortModule::variable_change(const string& key, const Atom& value)
+PatchPortModule::set_variable(const string& key, const Atom& value)
{
if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT)
move_to(value.get_float(), property_y());
@@ -123,5 +126,13 @@ PatchPortModule::variable_change(const string& key, const Atom& value)
}
+void
+PatchPortModule::set_property(const string& key, const Atom& value)
+{
+ if (key == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ set_stacked_border(value.get_bool());
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/PatchPortModule.hpp b/src/libs/gui/PatchPortModule.hpp
index 5e103bbf..bdf9c6d5 100644
--- a/src/libs/gui/PatchPortModule.hpp
+++ b/src/libs/gui/PatchPortModule.hpp
@@ -61,8 +61,10 @@ public:
protected:
PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> port);
- void variable_change(const string& key, const Raul::Atom& value);
void create_menu();
+
+ void set_variable(const std::string& predicate, const Raul::Atom& value);
+ void set_property(const std::string& predicate, const Raul::Atom& value);
SharedPtr<PortModel> _port;
PortMenu* _menu;
diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp
index 8bd9bcbb..cd132b3a 100644
--- a/src/libs/serialisation/Parser.cpp
+++ b/src/libs/serialisation/Parser.cpp
@@ -152,7 +152,8 @@ Parser::parse(Ingen::Shared::World* world,
if (poly_node.is_bool() && poly_node.to_bool() == true)
node_polyphonic = true;
- target->new_node(node_path, node_plugin, node_polyphonic);
+ target->new_node(node_path, node_plugin);
+ target->set_property(node_path, "ingen:polyphonic", node_polyphonic);
created.insert(node_path);
}