summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 03:10:58 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 03:10:58 +0000
commitd6823fa9b29bcff74ca180e6d389d8a21cf88d1f (patch)
treeb79dcfd907f83f035d657964d26b578c85ef0de2 /src
parent694b31089c8060fc6b908b146b12c0e340d004c7 (diff)
downloadingen-d6823fa9b29bcff74ca180e6d389d8a21cf88d1f.tar.gz
ingen-d6823fa9b29bcff74ca180e6d389d8a21cf88d1f.tar.bz2
ingen-d6823fa9b29bcff74ca180e6d389d8a21cf88d1f.zip
There!
Loader uses only CommonInterface and is now able to parse into a client or engine. Proper OSC serialisation of boolean atoms. Remove patch_enabled and patch_disabled calls/signals/etc in favour of new generic "property" mechanism (courtesy of which much more killed API is to come). git-svn-id: http://svn.drobilla.net/lad/ingen@1410 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/bindings/Client.hpp4
-rw-r--r--src/common/interface/ClientInterface.hpp9
-rw-r--r--src/common/interface/CommonInterface.hpp9
-rw-r--r--src/common/interface/EngineInterface.hpp8
-rw-r--r--src/libs/client/ClientStore.cpp37
-rw-r--r--src/libs/client/ClientStore.hpp3
-rw-r--r--src/libs/client/DeprecatedLoader.cpp15
-rw-r--r--src/libs/client/OSCClientReceiver.cpp40
-rw-r--r--src/libs/client/OSCClientReceiver.hpp3
-rw-r--r--src/libs/client/OSCEngineSender.cpp38
-rw-r--r--src/libs/client/OSCEngineSender.hpp9
-rw-r--r--src/libs/client/ObjectModel.cpp10
-rw-r--r--src/libs/client/ObjectModel.hpp7
-rw-r--r--src/libs/client/PatchModel.cpp20
-rw-r--r--src/libs/client/PatchModel.hpp14
-rw-r--r--src/libs/client/SigClientInterface.hpp12
-rw-r--r--src/libs/client/ThreadedSigClientInterface.hpp15
-rw-r--r--src/libs/engine/ClientBroadcaster.cpp28
-rw-r--r--src/libs/engine/ClientBroadcaster.hpp3
-rw-r--r--src/libs/engine/OSCClientSender.cpp54
-rw-r--r--src/libs/engine/OSCClientSender.hpp8
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp65
-rw-r--r--src/libs/engine/OSCEngineReceiver.hpp3
-rw-r--r--src/libs/engine/ObjectSender.cpp3
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp32
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp9
-rw-r--r--src/libs/engine/events/EnablePatchEvent.cpp5
-rw-r--r--src/libs/gui/NewSubpatchWindow.cpp2
-rw-r--r--src/libs/gui/PatchCanvas.cpp3
-rw-r--r--src/libs/gui/PatchTreeWindow.cpp61
-rw-r--r--src/libs/gui/PatchTreeWindow.hpp3
-rw-r--r--src/libs/gui/PatchView.cpp31
-rw-r--r--src/libs/gui/PatchView.hpp3
-rw-r--r--src/libs/gui/ThreadedLoader.cpp3
-rw-r--r--src/libs/serialisation/Loader.cpp48
-rw-r--r--src/libs/serialisation/Loader.hpp15
-rw-r--r--src/progs/ingen/main.cpp2
37 files changed, 261 insertions, 373 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index 5fac8552..3f427ff3 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -60,10 +60,6 @@ public:
virtual void polyphonic(const std::string& path,
bool polyphonic) {}
- virtual void patch_enabled(const std::string& path) {}
-
- virtual void patch_disabled(const std::string& path) {}
-
virtual void patch_polyphony(const std::string& path,
uint32_t poly) = 0;
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index 16e17fc0..e4e1ef44 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -74,18 +74,9 @@ public:
const std::string& symbol,
const std::string& name) = 0;
- virtual void new_port(const std::string& path,
- uint32_t index,
- const std::string& data_type,
- bool is_output) = 0;
-
virtual void polyphonic(const std::string& path,
bool polyphonic) = 0;
- virtual void patch_enabled(const std::string& path) = 0;
-
- virtual void patch_disabled(const std::string& path) = 0;
-
virtual void patch_polyphony(const std::string& path,
uint32_t poly) = 0;
diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp
index 1f760a3e..db5234de 100644
--- a/src/common/interface/CommonInterface.hpp
+++ b/src/common/interface/CommonInterface.hpp
@@ -51,6 +51,11 @@ public:
const std::string& plugin_uri,
bool polyphonic) = 0;
+ virtual void new_port(const std::string& path,
+ uint32_t index,
+ const std::string& data_type,
+ bool is_output) = 0;
+
virtual void connect(const std::string& src_port_path,
const std::string& dst_port_path) = 0;
@@ -61,6 +66,10 @@ public:
const std::string& predicate,
const Raul::Atom& value) = 0;
+ virtual void set_property(const std::string& subject_path,
+ const std::string& predicate,
+ const Raul::Atom& value) = 0;
+
virtual void set_port_value(const std::string& port_path,
const Raul::Atom& value) = 0;
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index 3983dc65..05fcb822 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -59,10 +59,6 @@ public:
// Object commands
- virtual void new_port(const std::string& path,
- const std::string& data_type,
- bool is_output) = 0;
-
/** DEPRECATED */
virtual void new_node_deprecated(const std::string& path,
const std::string& plugin_type,
@@ -81,10 +77,6 @@ public:
virtual void set_polyphonic(const std::string& path, bool poly) = 0;
- virtual void enable_patch(const std::string& patch_path) = 0;
-
- virtual void disable_patch(const std::string& patch_path) = 0;
-
virtual void disconnect_all(const std::string& parent_patch_path,
const std::string& path) = 0;
diff --git a/src/libs/client/ClientStore.cpp b/src/libs/client/ClientStore.cpp
index 39908eb5..1fb00eea 100644
--- a/src/libs/client/ClientStore.cpp
+++ b/src/libs/client/ClientStore.cpp
@@ -43,13 +43,12 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
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_enabled.connect(sigc::mem_fun(this, &ClientStore::patch_enabled_event));
- emitter->signal_patch_disabled.connect(sigc::mem_fun(this, &ClientStore::patch_disabled_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));
emitter->signal_variable_change.connect(sigc::mem_fun(this, &ClientStore::variable_change_event));
+ emitter->signal_property_change.connect(sigc::mem_fun(this, &ClientStore::property_change_event));
emitter->signal_port_value.connect(sigc::mem_fun(this, &ClientStore::port_value_event));
emitter->signal_port_activity.connect(sigc::mem_fun(this, &ClientStore::port_activity_event));
}
@@ -453,24 +452,6 @@ ClientStore::polyphonic_event(const Path& path, bool polyphonic)
void
-ClientStore::patch_enabled_event(const Path& path)
-{
- SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path));
- if (patch)
- patch->enable();
-}
-
-
-void
-ClientStore::patch_disabled_event(const Path& path)
-{
- SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path));
- if (patch)
- patch->disable();
-}
-
-
-void
ClientStore::patch_polyphony_event(const Path& path, uint32_t poly)
{
SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path));
@@ -522,6 +503,22 @@ ClientStore::variable_change_event(const Path& subject_path, const string& predi
}
}
+
+void
+ClientStore::property_change_event(const Path& subject_path, const string& predicate, const Atom& value)
+{
+ SharedPtr<ObjectModel> subject = object(subject_path);
+
+ if (!value.is_valid()) {
+ cerr << "ERROR: property '" << predicate << "' has no type" << endl;
+ } else if (subject) {
+ subject->set_property(predicate, value);
+ } else {
+ cerr << "WARNING: property for unknown object " << subject_path
+ << " lost. Client must refresh!" << endl;
+ }
+}
+
void
ClientStore::port_value_event(const Path& port_path, const Raul::Atom& value)
diff --git a/src/libs/client/ClientStore.hpp b/src/libs/client/ClientStore.hpp
index d71067d6..e1b3adaa 100644
--- a/src/libs/client/ClientStore.hpp
+++ b/src/libs/client/ClientStore.hpp
@@ -101,11 +101,10 @@ private:
void new_node_event(const Path& path, const string& plugin_uri, bool polyphonic);
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_enabled_event(const Path& path);
- void patch_disabled_event(const Path& path);
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);
void port_value_event(const Path& port_path, const Raul::Atom& value);
void port_activity_event(const Path& port_path);
void connection_event(const Path& src_port_path, const Path& dst_port_path);
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp
index 42f2f5fc..3ed6bc5f 100644
--- a/src/libs/client/DeprecatedLoader.cpp
+++ b/src/libs/client/DeprecatedLoader.cpp
@@ -359,7 +359,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
// _engine->set_variable(subject, i->first, i->second);
if (!existing)
- _engine->enable_patch(path);
+ _engine->set_property(path, "ingen:enabled", (bool)true);
_load_path_translations.clear();
@@ -459,23 +459,24 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
bool is_port = false;
if (plugin_type == "Internal") {
+ // FIXME: indices
if (plugin_label == "audio_input") {
- _engine->new_port(path, "ingen:AudioPort", false);
+ _engine->new_port(path, 0, "ingen:AudioPort", false);
is_port = true;
} else if (plugin_label == "audio_output") {
- _engine->new_port(path, "ingen:AudioPort", true);
+ _engine->new_port(path, 0, "ingen:AudioPort", true);
is_port = true;
} else if (plugin_label == "control_input") {
- _engine->new_port(path, "ingen:ControlPort", false);
+ _engine->new_port(path, 0, "ingen:ControlPort", false);
is_port = true;
} else if (plugin_label == "control_output" ) {
- _engine->new_port(path, "ingen:ControlPort", true);
+ _engine->new_port(path, 0, "ingen:ControlPort", true);
is_port = true;
} else if (plugin_label == "midi_input") {
- _engine->new_port(path, "ingen:MIDIPort", false);
+ _engine->new_port(path, 0, "ingen:MIDIPort", false);
is_port = true;
} else if (plugin_label == "midi_output" ) {
- _engine->new_port(path, "ingen:MIDIPort", true);
+ _engine->new_port(path, 0, "ingen:MIDIPort", true);
is_port = true;
} else {
cerr << "WARNING: Unknown internal plugin label \"" << plugin_label << "\"" << endl;
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 091b921b..6087736f 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -145,8 +145,6 @@ 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_enabled", "s", patch_enabled_cb, this);
- lo_server_thread_add_method(_st, "/ingen/patch_disabled", "s", patch_disabled_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);
@@ -158,6 +156,7 @@ OSCClientReceiver::setup_callbacks()
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);
lo_server_thread_add_method(_st, "/ingen/set_voice_value", "sif", set_voice_value_cb, this);
lo_server_thread_add_method(_st, "/ingen/port_activity", "s", port_activity_cb, this);
@@ -193,22 +192,6 @@ OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** a
int
-OSCClientReceiver::_patch_enabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- patch_enabled((const char*)&argv[0]->s);
- return 0;
-}
-
-
-int
-OSCClientReceiver::_patch_disabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- patch_disabled((const char*)&argv[0]->s);
- return 0;
-}
-
-
-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);
@@ -301,7 +284,7 @@ OSCClientReceiver::_polyphonic_cb(const char* path, const char* types, lo_arg**
}
-/** Notification of a new or updated piece of variable.
+/** Notification of a new or updated variable.
*/
int
OSCClientReceiver::_set_variable_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
@@ -320,6 +303,25 @@ OSCClientReceiver::_set_variable_cb(const char* path, const char* types, lo_arg*
}
+/** Notification of a new or updated property.
+ */
+int
+OSCClientReceiver::_set_property_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+{
+ if (argc != 3 || types[0] != 's' || types[1] != 's')
+ return 1;
+
+ const char* obj_path = &argv[0]->s;
+ const char* key = &argv[1]->s;
+
+ Atom value = AtomLiblo::lo_arg_to_atom(types[2], argv[2]);
+
+ set_property(obj_path, key, value);
+
+ return 0;
+}
+
+
int
OSCClientReceiver::_set_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp
index 564e39a9..9950df7d 100644
--- a/src/libs/client/OSCClientReceiver.hpp
+++ b/src/libs/client/OSCClientReceiver.hpp
@@ -86,8 +86,6 @@ private:
LO_HANDLER(plugin_list_end);
LO_HANDLER(new_patch);
LO_HANDLER(destroyed);
- LO_HANDLER(patch_enabled);
- LO_HANDLER(patch_disabled);
LO_HANDLER(patch_polyphony);
LO_HANDLER(patch_cleared);
LO_HANDLER(object_renamed);
@@ -97,6 +95,7 @@ private:
LO_HANDLER(new_port);
LO_HANDLER(polyphonic);
LO_HANDLER(set_variable);
+ LO_HANDLER(set_property);
LO_HANDLER(set_port_value);
LO_HANDLER(set_voice_value);
LO_HANDLER(port_activity);
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index 5f2db7ad..d235e7a9 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -140,9 +140,11 @@ OSCEngineSender::new_patch(const string& path,
void
OSCEngineSender::new_port(const string& path,
+ uint32_t index,
const string& data_type,
bool is_output)
{
+ // FIXME: use index
send("/ingen/new_port", "issi",
next_id(),
path.c_str(),
@@ -264,26 +266,6 @@ OSCEngineSender::set_polyphonic(const string& path, bool poly)
void
-OSCEngineSender::enable_patch(const string& patch_path)
-{
- send("/ingen/enable_patch", "is",
- next_id(),
- patch_path.c_str(),
- LO_ARGS_END);
-}
-
-
-void
-OSCEngineSender::disable_patch(const string& patch_path)
-{
- send("/ingen/disable_patch", "is",
- next_id(),
- patch_path.c_str(),
- LO_ARGS_END);
-}
-
-
-void
OSCEngineSender::connect(const string& src_port_path,
const string& dst_port_path)
{
@@ -415,7 +397,6 @@ OSCEngineSender::set_variable(const string& obj_path,
const string& predicate,
const Raul::Atom& value)
{
-
lo_message m = lo_message_new();
lo_message_add_int32(m, next_id());
lo_message_add_string(m, obj_path.c_str());
@@ -424,6 +405,21 @@ OSCEngineSender::set_variable(const string& obj_path,
send_message("/ingen/set_variable", m);
}
+
+void
+OSCEngineSender::set_property(const string& obj_path,
+ const string& predicate,
+ const Raul::Atom& value)
+{
+ lo_message m = lo_message_new();
+ lo_message_add_int32(m, next_id());
+ lo_message_add_string(m, obj_path.c_str());
+ lo_message_add_string(m, predicate.c_str());
+ Raul::AtomLiblo::lo_message_add_atom(m, value);
+ send_message("/ingen/set_property", m);
+}
+
+
// Requests //
diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp
index d32a4849..985e1db3 100644
--- a/src/libs/client/OSCEngineSender.hpp
+++ b/src/libs/client/OSCEngineSender.hpp
@@ -81,6 +81,7 @@ public:
uint32_t poly);
void new_port(const string& path,
+ uint32_t index,
const string& data_type,
bool is_output);
@@ -105,10 +106,6 @@ public:
void set_polyphonic(const string& path, bool poly);
- void enable_patch(const string& patch_path);
-
- void disable_patch(const string& patch_path);
-
void connect(const string& src_port_path,
const string& dst_port_path);
@@ -146,6 +143,10 @@ public:
const string& predicate,
const Raul::Atom& value);
+ void set_property(const string& obj_path,
+ const string& predicate,
+ const Raul::Atom& value);
+
// Requests //
void ping();
diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp
index e83b9fe1..c807797e 100644
--- a/src/libs/client/ObjectModel.cpp
+++ b/src/libs/client/ObjectModel.cpp
@@ -56,16 +56,6 @@ ObjectModel::get_variable(const string& key) const
void
-ObjectModel::add_variable(const Variables& data)
-{
- for (Variables::const_iterator i = data.begin(); i != data.end(); ++i) {
- _variables[i->first] = i->second;
- signal_variable.emit(i->first, i->second);
- }
-}
-
-
-void
ObjectModel::set_polyphonic(bool polyphonic)
{
_polyphonic = polyphonic;
diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp
index dbd188a3..460d7d9d 100644
--- a/src/libs/client/ObjectModel.hpp
+++ b/src/libs/client/ObjectModel.hpp
@@ -62,8 +62,12 @@ public:
const Atom& get_variable(const string& key) const;
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)
+ { _properties[key] = value; signal_property.emit(key, value); }
const Variables& variables() const { return _variables; }
+ const Variables& properties() const { return _properties; }
const Path path() const { return _path; }
const Symbol symbol() const { return _path.name(); }
SharedPtr<ObjectModel> parent() const { return _parent; }
@@ -75,6 +79,7 @@ public:
sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child;
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;
@@ -89,7 +94,6 @@ protected:
virtual void add_child(SharedPtr<ObjectModel> c) {}
virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; }
- void add_variable(const Variables& data);
void set_polyphonic(bool);
virtual void set(SharedPtr<ObjectModel> model);
@@ -99,6 +103,7 @@ protected:
SharedPtr<ObjectModel> _parent;
Variables _variables;
+ Variables _properties;
};
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 20a47406..38019eda 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -160,23 +160,11 @@ PatchModel::remove_connection(const string& src_port_path, const string& dst_por
}
-void
-PatchModel::enable()
-{
- if (!_enabled) {
- _enabled = true;
- signal_enabled.emit();
- }
-}
-
-
-void
-PatchModel::disable()
+bool
+PatchModel::enabled() const
{
- if (_enabled) {
- _enabled = false;
- signal_disabled.emit();
- }
+ Variables::const_iterator i = _properties.find("ingen:enabled");
+ return (i != _properties.end() && i->second.type() == Atom::BOOL && i->second.get_bool());
}
diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp
index 62b9db44..e39ee2f7 100644
--- a/src/libs/client/PatchModel.hpp
+++ b/src/libs/client/PatchModel.hpp
@@ -48,10 +48,10 @@ public:
SharedPtr<ConnectionModel> get_connection(const string& src_port_path,
const string& dst_port_path) const;
- size_t poly() const { return _poly; }
- bool enabled() const { return _enabled; }
- uint32_t internal_polyphony() const { return _poly; }
- bool polyphonic() const;
+ size_t poly() const { return _poly; }
+ uint32_t internal_polyphony() const { return _poly; }
+ bool enabled() const;
+ bool polyphonic() const;
/** "editable" = arranging,connecting,adding,deleting,etc
* not editable (control mode) you can just change controllers (performing)
@@ -71,8 +71,6 @@ 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> signal_enabled;
- sigc::signal<void> signal_disabled;
sigc::signal<void, uint32_t> signal_polyphony;
sigc::signal<void, bool> signal_editable;
@@ -81,15 +79,12 @@ private:
PatchModel(const Path& patch_path, size_t internal_poly)
: NodeModel("ingen:Patch", patch_path, false) // FIXME
- , _enabled(false)
, _poly(internal_poly)
, _editable(true)
{
}
void poly(size_t p) { _poly = p; signal_polyphony.emit(p); }
- void enable();
- void disable();
void clear();
void add_child(SharedPtr<ObjectModel> c);
bool remove_child(SharedPtr<ObjectModel> c);
@@ -98,7 +93,6 @@ private:
void remove_connection(const string& src_port_path, const string& dst_port_path);
Connections _connections;
- bool _enabled;
uint32_t _poly;
bool _editable;
};
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index 6463bf3a..6318f440 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -57,8 +57,6 @@ public:
sigc::signal<void, string, string, bool> 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> signal_patch_enabled;
- sigc::signal<void, string> signal_patch_disabled;
sigc::signal<void, string, uint32_t> signal_patch_polyphony;
sigc::signal<void, string> signal_patch_cleared;
sigc::signal<void, string, string> signal_object_renamed;
@@ -66,6 +64,7 @@ public:
sigc::signal<void, string, string> signal_connection;
sigc::signal<void, string, string> signal_disconnection;
sigc::signal<void, string, string, Raul::Atom> signal_variable_change;
+ sigc::signal<void, string, string, Raul::Atom> signal_property_change;
sigc::signal<void, string, Raul::Atom> signal_port_value;
sigc::signal<void, string, uint32_t, Raul::Atom> signal_voice_value;
sigc::signal<void, string> signal_port_activity;
@@ -125,12 +124,6 @@ protected:
void object_destroyed(const string& path)
{ if (_enabled) signal_object_destroyed.emit(path); }
- void patch_enabled(const string& path)
- { if (_enabled) signal_patch_enabled.emit(path); }
-
- void patch_disabled(const string& path)
- { if (_enabled) signal_patch_disabled.emit(path); }
-
void patch_polyphony(const string& path, uint32_t poly)
{ if (_enabled) signal_patch_polyphony.emit(path, poly); }
@@ -145,6 +138,9 @@ protected:
void set_variable(const string& path, const string& key, const Raul::Atom& value)
{ if (_enabled) signal_variable_change.emit(path, key, value); }
+
+ void set_property(const string& path, const string& key, const Raul::Atom& value)
+ { if (_enabled) signal_property_change.emit(path, key, value); }
void set_port_value(const string& port_path, const Raul::Atom& value)
{ if (_enabled) signal_port_value.emit(port_path, value); }
diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp
index ccdbf318..291df426 100644
--- a/src/libs/client/ThreadedSigClientInterface.hpp
+++ b/src/libs/client/ThreadedSigClientInterface.hpp
@@ -56,14 +56,13 @@ public:
, new_port_slot(signal_new_port.make_slot())
, polyphonic_slot(signal_polyphonic.make_slot())
, connection_slot(signal_connection.make_slot())
- , patch_enabled_slot(signal_patch_enabled.make_slot())
- , patch_disabled_slot(signal_patch_disabled.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())
, disconnection_slot(signal_disconnection.make_slot())
, variable_change_slot(signal_variable_change.make_slot())
+ , property_change_slot(signal_property_change.make_slot())
, port_value_slot(signal_port_value.make_slot())
, port_activity_slot(signal_port_activity.make_slot())
, program_add_slot(signal_program_add.make_slot())
@@ -115,12 +114,6 @@ public:
void object_destroyed(const string& path)
{ push_sig(sigc::bind(object_destroyed_slot, path)); }
- void patch_enabled(const string& path)
- { push_sig(sigc::bind(patch_enabled_slot, path)); }
-
- void patch_disabled(const string& path)
- { push_sig(sigc::bind(patch_disabled_slot, path)); }
-
void patch_polyphony(const string& path, uint32_t poly)
{ push_sig(sigc::bind(patch_polyphony_slot, path, poly)); }
@@ -135,6 +128,9 @@ public:
void set_variable(const string& path, const string& key, const Raul::Atom& value)
{ push_sig(sigc::bind(variable_change_slot, path, key, value)); }
+
+ void set_property(const string& path, const string& key, const Raul::Atom& value)
+ { push_sig(sigc::bind(property_change_slot, path, key, value)); }
void set_port_value(const string& port_path, const Raul::Atom& value)
{ push_sig(sigc::bind(port_value_slot, port_path, value)); }
@@ -172,14 +168,13 @@ private:
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> patch_enabled_slot;
- sigc::slot<void, string> patch_disabled_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;
sigc::slot<void, string, string> disconnection_slot;
sigc::slot<void, string, string, Raul::Atom> variable_change_slot;
+ sigc::slot<void, string, string, Raul::Atom> property_change_slot;
sigc::slot<void, string, Raul::Atom> port_value_slot;
sigc::slot<void, string, uint32_t, Raul::Atom> voice_value_slot;
sigc::slot<void, string> port_activity_slot;
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp
index 949784c3..dce6691e 100644
--- a/src/libs/engine/ClientBroadcaster.cpp
+++ b/src/libs/engine/ClientBroadcaster.cpp
@@ -193,22 +193,6 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string&
void
-ClientBroadcaster::send_patch_enable(const string& patch_path)
-{
- for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->patch_enabled(patch_path);
-}
-
-
-void
-ClientBroadcaster::send_patch_disable(const string& patch_path)
-{
- for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->patch_disabled(patch_path);
-}
-
-
-void
ClientBroadcaster::send_patch_polyphony(const string& patch_path, uint32_t poly)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
@@ -228,6 +212,18 @@ ClientBroadcaster::send_variable_change(const string& node_path, const string& k
}
+/** Send notification of a property update.
+ *
+ * Like control changes, does not send update to client that set the property, if applicable.
+ */
+void
+ClientBroadcaster::send_property_change(const string& node_path, const string& key, const Atom& value)
+{
+ for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ (*i).second->set_property(node_path, key, value);
+}
+
+
/** Send notification of a control change.
*
* If responder is specified, the notification will not be send to the address of
diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp
index 323a1912..07da01f5 100644
--- a/src/libs/engine/ClientBroadcaster.hpp
+++ b/src/libs/engine/ClientBroadcaster.hpp
@@ -76,10 +76,9 @@ public:
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_enable(const string& patch_path);
- void send_patch_disable(const string& patch_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);
void send_port_activity(const string& port_path);
void send_program_add(const string& node_path, int bank, int program, const string& name);
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 60edbe07..1429d616 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -298,28 +298,6 @@ OSCClientSender::patch_cleared(const std::string& patch_path)
/** \page client_osc_namespace
- * <p> \b /ingen/patch_enabled - Notification a patch's DSP processing has been enabled.
- * \arg \b path (string) - Path of enabled patch</p> \n \n
- */
-void
-OSCClientSender::patch_enabled(const std::string& patch_path)
-{
- send("/ingen/patch_enabled", "s", patch_path.c_str(), LO_ARGS_END);
-}
-
-
-/** \page client_osc_namespace
- * <p> \b /ingen/patch_disabled - Notification a patch's DSP processing has been disabled.
- * \arg \b path (string) - Path of disabled patch</p> \n \n
- */
-void
-OSCClientSender::patch_disabled(const std::string& patch_path)
-{
- send("/ingen/patch_disabled", "s", patch_path.c_str(), LO_ARGS_END);
-}
-
-
-/** \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
*/
@@ -359,8 +337,8 @@ OSCClientSender::disconnect(const std::string& src_port_path, const std::string&
/** \page client_osc_namespace
- * <p> \b /ingen/set_variable - Notification of a piece of variable.
- * \arg \b path (string) - Path of the object associated with variable (can be a node, patch, or port)
+ * <p> \b /ingen/set_variable - Notification of a variable.
+ * \arg \b path (string) - Path of the object associated with variable (node, patch, or port)
* \arg \b key (string)
* \arg \b value (string)</p> \n \n
*/
@@ -376,6 +354,23 @@ OSCClientSender::set_variable(const std::string& path, const std::string& key, c
/** \page client_osc_namespace
+ * <p> \b /ingen/set_property - Notification of a property.
+ * \arg \b path (string) - Path of the object associated with property (node, patch, or port)
+ * \arg \b key (string)
+ * \arg \b value (string)</p> \n \n
+ */
+void
+OSCClientSender::set_property(const std::string& path, const std::string& key, const Atom& value)
+{
+ lo_message m = lo_message_new();
+ lo_message_add_string(m, path.c_str());
+ lo_message_add_string(m, key.c_str());
+ Raul::AtomLiblo::lo_message_add_atom(m, value);
+ send_message("/ingen/set_property", m);
+}
+
+
+/** \page client_osc_namespace
* <p> \b /ingen/set_port_value - Notification the value of a port has changed
* \arg \b path (string) - Path of port
* \arg \b value (any) - New value of port </p> \n \n
@@ -467,17 +462,6 @@ void
OSCClientSender::new_patch(const std::string& path, uint32_t poly)
{
send("/ingen/new_patch", "si", path.c_str(), poly, LO_ARGS_END);
-
- /*
- if (p->process())
- patch_enabled(p->path());
-
- // Send variables
- const map<const std::string&, const std::string&>& data = p->variable();
- for (map<const std::string&, const std::string&>::const_iterator i = data.begin(); i != data.end(); ++i) {
- set_variable(p->path(), (*i).first, (*i).second);
- }
- */
}
diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp
index 662ba75b..714e17b2 100644
--- a/src/libs/engine/OSCClientSender.hpp
+++ b/src/libs/engine/OSCClientSender.hpp
@@ -90,10 +90,6 @@ public:
virtual void polyphonic(const std::string& path,
bool polyphonic);
- virtual void patch_enabled(const std::string& path);
-
- virtual void patch_disabled(const std::string& path);
-
virtual void patch_polyphony(const std::string& path,
uint32_t poly);
@@ -114,6 +110,10 @@ public:
const std::string& predicate,
const Raul::Atom& value);
+ virtual void set_property(const std::string& subject_path,
+ const std::string& predicate,
+ const Raul::Atom& value);
+
virtual void set_port_value(const std::string& port_path,
const Raul::Atom& value);
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 74947917..afac70b0 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -87,8 +87,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/activate", "i", engine_activate_cb, this);
lo_server_add_method(_server, "/ingen/deactivate", "i", engine_deactivate_cb, this);
lo_server_add_method(_server, "/ingen/new_patch", "isi", new_patch_cb, this);
- lo_server_add_method(_server, "/ingen/enable_patch", "is", enable_patch_cb, this);
- lo_server_add_method(_server, "/ingen/disable_patch", "is", disable_patch_cb, this);
lo_server_add_method(_server, "/ingen/clear_patch", "is", clear_patch_cb, this);
lo_server_add_method(_server, "/ingen/set_polyphony", "isi", set_polyphony_cb, this);
lo_server_add_method(_server, "/ingen/set_polyphonic", "isT", set_polyphonic_cb, this);
@@ -112,6 +110,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/all_notes_off", "isi", all_notes_off_cb, this);
lo_server_add_method(_server, "/ingen/midi_learn", "is", midi_learn_cb, this);
lo_server_add_method(_server, "/ingen/set_variable", NULL, variable_set_cb, this);
+ lo_server_add_method(_server, "/ingen/set_property", NULL, property_set_cb, this);
// Queries
lo_server_add_method(_server, "/ingen/request_variable", "iss", variable_get_cb, this);
@@ -407,36 +406,6 @@ OSCEngineReceiver::_rename_cb(const char* path, const char* types, lo_arg** argv
/** \page engine_osc_namespace
- * <p> \b /ingen/enable_patch - Enable DSP processing of a patch
- * \arg \b response-id (integer)
- * \arg \b patch-path - Patch's path </p> \n \n
- */
-int
-OSCEngineReceiver::_enable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* patch_path = &argv[1]->s;
-
- enable_patch(patch_path);
- return 0;
-}
-
-
-/** \page engine_osc_namespace
- * <p> \b /ingen/disable_patch - Disable DSP processing of a patch
- * \arg \b response-id (integer)
- * \arg \b patch-path - Patch's path </p> \n \n
- */
-int
-OSCEngineReceiver::_disable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* patch_path = &argv[1]->s;
-
- disable_patch(patch_path);
- return 0;
-}
-
-
-/** \page engine_osc_namespace
* <p> \b /ingen/clear_patch - Remove all nodes from a patch
* \arg \b response-id (integer)
* \arg \b patch-path - Patch's path </p> \n \n
@@ -485,6 +454,7 @@ OSCEngineReceiver::_set_polyphonic_cb(const char* path, const char* types, lo_ar
}
+// FIXME: add index
/** \page engine_osc_namespace
* <p> \b /ingen/new_port - Add a port into a given patch (load a plugin by URI)
* \arg \b response-id (integer)
@@ -499,7 +469,7 @@ OSCEngineReceiver::_new_port_cb(const char* path, const char* types, lo_arg** ar
const char* data_type = &argv[2]->s;
const int32_t direction = argv[3]->i;
- new_port(port_path, data_type, (direction == 1));
+ new_port(port_path, 0, data_type, (direction == 1));
return 0;
}
@@ -840,11 +810,11 @@ OSCEngineReceiver::_midi_learn_cb(const char* path, const char* types, lo_arg**
/** \page engine_osc_namespace
- * <p> \b /ingen/set_variable - Sets a piece of variable, associated with a synth-space object (node, etc)
+ * <p> \b /ingen/set_variable - Set a variable, associated with a synth-space object (node, etc)
* \arg \b response-id (integer)
* \arg \b object-path (string) - Full path of object to associate variable with
- * \arg \b key (string) - Key (index) for new piece of variable
- * \arg \b value (string) - Value of new piece of variable </p> \n \n
+ * \arg \b key (string) - Key (index/predicate/ID) for new variable
+ * \arg \b value (string) - Value of new variable </p> \n \n
*/
int
OSCEngineReceiver::_variable_set_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
@@ -863,6 +833,29 @@ OSCEngineReceiver::_variable_set_cb(const char* path, const char* types, lo_arg*
/** \page engine_osc_namespace
+ * <p> \b /ingen/set_property - Set an (RDF) property, associated with a synth-space object (node, etc)
+ * \arg \b response-id (integer)
+ * \arg \b object-path (string) - Full path of object to associate variable with
+ * \arg \b key (string) - URI/QName for predicate of this property (e.g. "ingen:enabled")
+ * \arg \b value (string) - Value of property </p> \n \n
+ */
+int
+OSCEngineReceiver::_property_set_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+{
+ if (argc != 4 || types[0] != 'i' || types[1] != 's' || types[2] != 's')
+ return 1;
+
+ const char* object_path = &argv[1]->s;
+ const char* key = &argv[2]->s;
+
+ Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(types[3], argv[3]);
+
+ set_property(object_path, key, value);
+ return 0;
+}
+
+
+/** \page engine_osc_namespace
* <p> \b /ingen/request_variable - Requests the engine send a piece of variable, associated with a synth-space object (node, etc)
* \arg \b response-id (integer)
* \arg \b object-path (string) - Full path of object variable is associated with
diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp
index 35d7d531..980e2f78 100644
--- a/src/libs/engine/OSCEngineReceiver.hpp
+++ b/src/libs/engine/OSCEngineReceiver.hpp
@@ -98,8 +98,6 @@ private:
LO_HANDLER(new_port);
LO_HANDLER(new_node);
LO_HANDLER(new_node_by_uri);
- LO_HANDLER(enable_patch);
- LO_HANDLER(disable_patch);
LO_HANDLER(clear_patch);
LO_HANDLER(set_polyphony);
LO_HANDLER(set_polyphonic);
@@ -117,6 +115,7 @@ private:
LO_HANDLER(midi_learn);
LO_HANDLER(variable_get);
LO_HANDLER(variable_set);
+ LO_HANDLER(property_set);
LO_HANDLER(request_plugin);
LO_HANDLER(request_object);
LO_HANDLER(request_port_value);
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 0bbe6533..82500446 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -43,8 +43,7 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r
for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j)
client->set_variable(patch->path(), (*j).first, (*j).second);
- if (patch->enabled())
- client->patch_enabled(patch->path());
+ client->set_property(patch->path(), "ingen:enabled", (bool)patch->enabled());
client->bundle_end();
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 6593ec81..6deeb727 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -145,7 +145,9 @@ QueuedEngineInterface::new_patch(const string& path,
}
+// FIXME: use index
void QueuedEngineInterface::new_port(const string& path,
+ uint32_t index,
const string& data_type,
bool direction)
{
@@ -211,20 +213,6 @@ QueuedEngineInterface::set_polyphonic(const string& path, bool poly)
void
-QueuedEngineInterface::enable_patch(const string& patch_path)
-{
- push_queued(new EnablePatchEvent(_engine, _responder, now(), patch_path, true));
-}
-
-
-void
-QueuedEngineInterface::disable_patch(const string& patch_path)
-{
- push_queued(new EnablePatchEvent(_engine, _responder, now(), patch_path, false));
-}
-
-
-void
QueuedEngineInterface::connect(const string& src_port_path,
const string& dst_port_path)
{
@@ -321,6 +309,22 @@ QueuedEngineInterface::set_variable(const string& path,
push_queued(new SetMetadataEvent(_engine, _responder, now(), path, predicate, value));
}
+
+void
+QueuedEngineInterface::set_property(const string& path,
+ const string& predicate,
+ const Atom& value)
+{
+ // FIXME: implement generically
+ if (predicate == "ingen:enabled") {
+ if (value.type() == Atom::BOOL) {
+ push_queued(new EnablePatchEvent(_engine, _responder, now(), path, value.get_bool()));
+ return;
+ }
+ }
+ cerr << "WARNING: Unknown property \"" << predicate << "\" ignored" << endl;
+}
+
// Requests //
diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp
index 3d8b8d12..585f1104 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -85,6 +85,7 @@ public:
uint32_t poly);
virtual void new_port(const string& path,
+ uint32_t index,
const string& data_type,
bool direction);
@@ -110,10 +111,6 @@ public:
virtual void set_polyphonic(const string& path, bool poly);
- virtual void enable_patch(const string& patch_path);
-
- virtual void disable_patch(const string& patch_path);
-
virtual void connect(const string& src_port_path,
const string& dst_port_path);
@@ -151,6 +148,10 @@ public:
const string& predicate,
const Raul::Atom& value);
+ virtual void set_property(const string& path,
+ const string& predicate,
+ const Raul::Atom& value);
+
// Requests //
virtual void ping();
diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp
index 48657146..04759cea 100644
--- a/src/libs/engine/events/EnablePatchEvent.cpp
+++ b/src/libs/engine/events/EnablePatchEvent.cpp
@@ -75,10 +75,7 @@ EnablePatchEvent::post_process()
{
if (_patch != NULL) {
_responder->respond_ok();
- if (_enable)
- _engine.broadcaster()->send_patch_enable(_patch_path);
- else
- _engine.broadcaster()->send_patch_disable(_patch_path);
+ _engine.broadcaster()->send_property_change(_patch_path, "ingen:enabled", (bool)_enable);
} else {
_responder->respond_error(string("Patch ") + _patch_path + " not found");
}
diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp
index 90e6c911..580ebb51 100644
--- a/src/libs/gui/NewSubpatchWindow.cpp
+++ b/src/libs/gui/NewSubpatchWindow.cpp
@@ -96,7 +96,7 @@ NewSubpatchWindow::ok_clicked()
for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i)
App::instance().engine()->set_variable(path, i->first, i->second);
- App::instance().engine()->enable_patch(path);
+ App::instance().engine()->set_property(_patch->path(), "ingen:enabled", (bool)true);
hide();
}
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 77078831..77aa64e6 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -606,7 +606,8 @@ PatchCanvas::menu_add_port(const string& name, const string& type, bool is_outpu
{
// FIXME: bundleify
const Path& path = _patch->path().base() + generate_port_name(name);
- App::instance().engine()->new_port(path, type, is_output);
+ // FIXME: index
+ App::instance().engine()->new_port(path, 0, type, is_output);
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/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp
index 336d3aaf..ee831cb3 100644
--- a/src/libs/gui/PatchTreeWindow.cpp
+++ b/src/libs/gui/PatchTreeWindow.cpp
@@ -29,10 +29,10 @@ namespace Ingen {
namespace GUI {
-PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject,
- const Glib::RefPtr<Gnome::Glade::Xml>& xml)
-: Gtk::Window(cobject),
- _enable_signal(true)
+PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject,
+ const Glib::RefPtr<Gnome::Glade::Xml>& xml)
+ : Gtk::Window(cobject)
+ , _enable_signal(true)
{
xml->get_widget_derived("patches_treeview", _patches_treeview);
@@ -115,8 +115,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
}
}
- pm->signal_enabled.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_enabled), pm->path()));
- pm->signal_disabled.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_disabled), pm->path()));
+ pm->signal_property.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_property_changed), pm->path()));
}
@@ -197,52 +196,24 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
assert(pm);
- if ( ! pm->enabled()) {
- if (_enable_signal)
- App::instance().engine()->enable_patch(patch_path);
- //row[_patch_tree_columns.enabled_col] = true;
- } else {
- if (_enable_signal)
- App::instance().engine()->disable_patch(patch_path);
- //row[_patch_tree_columns.enabled_col] = false;
- }
+ if (_enable_signal)
+ App::instance().engine()->set_property(patch_path, "ingen:enabled", (bool)!pm->enabled());
}
void
-PatchTreeWindow::patch_enabled(const Path& path)
+PatchTreeWindow::patch_property_changed(const string& key, const Raul::Atom& value, const Path& path)
{
_enable_signal = false;
-
- Gtk::TreeModel::iterator i
- = find_patch(_patch_treestore->children(), path);
-
- if (i != _patch_treestore->children().end()) {
- Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.enabled_col] = true;
- } else {
- cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
- }
-
- _enable_signal = true;
-}
-
-
-void
-PatchTreeWindow::patch_disabled(const Path& path)
-{
- _enable_signal = false;
-
- Gtk::TreeModel::iterator i
- = find_patch(_patch_treestore->children(), path);
-
- if (i != _patch_treestore->children().end()) {
- Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.enabled_col] = false;
- } else {
- cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
+ if (key == "ingen:enabled" && value.type() == Atom::BOOL) {
+ Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), path);
+ if (i != _patch_treestore->children().end()) {
+ Gtk::TreeModel::Row row = *i;
+ row[_patch_tree_columns.enabled_col] = value.get_bool();
+ } else {
+ cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
+ }
}
-
_enable_signal = true;
}
diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp
index 85d803cd..5cd078a5 100644
--- a/src/libs/gui/PatchTreeWindow.hpp
+++ b/src/libs/gui/PatchTreeWindow.hpp
@@ -47,8 +47,7 @@ public:
void new_object(SharedPtr<ObjectModel> object);
- void patch_enabled(const Path& path);
- void patch_disabled(const Path& path);
+ void patch_property_changed(const string& key, const Raul::Atom& value, const Path& path);
void patch_renamed(const Path& old_path, const Path& new_path);
void add_patch(SharedPtr<PatchModel> pm);
diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp
index 2ba05070..8b720db4 100644
--- a/src/libs/gui/PatchView.cpp
+++ b/src/libs/gui/PatchView.cpp
@@ -79,11 +79,13 @@ PatchView::set_patch(SharedPtr<PatchModel> patch)
_poly_spin->set_value(patch->poly());
_destroy_but->set_sensitive(patch->path() != "/");
- patch->enabled() ? enable() : disable();
+
+ for (GraphObject::Variables::const_iterator i = patch->properties().begin();
+ i != patch->properties().end(); ++i)
+ property_changed(i->first, i->second);
// Connect model signals to track state
- patch->signal_enabled.connect(sigc::mem_fun(this, &PatchView::enable));
- patch->signal_disabled.connect(sigc::mem_fun(this, &PatchView::disable));
+ patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed));
// Connect widget signals to do things
_process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled));
@@ -151,13 +153,8 @@ PatchView::process_toggled()
if (!_enable_signal)
return;
- if (_process_but->get_active()) {
- App::instance().engine()->enable_patch(_patch->path());
- App::instance().patch_tree()->patch_enabled(_patch->path());
- } else {
- App::instance().engine()->disable_patch(_patch->path());
- App::instance().patch_tree()->patch_disabled(_patch->path());
- }
+ App::instance().engine()->set_property(_patch->path(), "ingen:enabled",
+ (bool)_process_but->get_active());
}
@@ -183,19 +180,11 @@ PatchView::refresh_clicked()
void
-PatchView::enable()
-{
- _enable_signal = false;
- _process_but->set_active(true);
- _enable_signal = true;
-}
-
-
-void
-PatchView::disable()
+PatchView::property_changed(const std::string& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- _process_but->set_active(false);
+ if (predicate == "ingen:enabled" && value.type() == Atom::BOOL)
+ _process_but->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/libs/gui/PatchView.hpp b/src/libs/gui/PatchView.hpp
index 7cc72f5a..2c0570bd 100644
--- a/src/libs/gui/PatchView.hpp
+++ b/src/libs/gui/PatchView.hpp
@@ -74,8 +74,7 @@ private:
void on_editable_sig(bool locked);
void editable_toggled();
- void enable();
- void disable();
+ void property_changed(const std::string& predicate, const Raul::Atom& value);
void zoom_full();
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index c2ba9307..0247529d 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -101,11 +101,12 @@ ThreadedLoader::load_patch(bool merge,
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load),
App::instance().world(),
+ App::instance().world()->engine.get(),
data_base_uri,
engine_parent,
(engine_name) ? engine_name.get() : "",
"",
- engine_data )));
+ engine_data)));
}
whip();
diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp
index bb085d57..b0d919e0 100644
--- a/src/libs/serialisation/Loader.cpp
+++ b/src/libs/serialisation/Loader.cpp
@@ -42,12 +42,13 @@ namespace Serialisation {
* @return whether or not load was successful.
*/
bool
-Loader::load(Ingen::Shared::World* world,
- const Glib::ustring& document_uri,
- boost::optional<Raul::Path> parent,
- std::string patch_name,
- Glib::ustring patch_uri,
- GraphObject::Variables data)
+Loader::load(Ingen::Shared::World* world,
+ Ingen::Shared::CommonInterface* target,
+ const Glib::ustring& document_uri,
+ boost::optional<Raul::Path> parent,
+ std::string patch_name,
+ Glib::ustring patch_uri,
+ GraphObject::Variables data)
{
setlocale(LC_NUMERIC, "C");
@@ -112,11 +113,11 @@ Loader::load(Ingen::Shared::World* world,
cout << " as " << patch_path << endl;
if (patch_path != "/")
- world->engine->new_patch(patch_path, patch_poly);
+ target->new_patch(patch_path, patch_poly);
/* Set document metadata (so File->Save doesn't prompt)
* FIXME: This needs some thinking for multiple clients... */
- world->engine->set_variable(patch_path, "ingen:document", Atom(document_uri.c_str()));
+ target->set_variable(patch_path, "ingen:document", Atom(document_uri.c_str()));
/* Load (plugin) nodes */
@@ -151,7 +152,7 @@ Loader::load(Ingen::Shared::World* world,
if (poly_node.is_bool() && poly_node.to_bool() == true)
node_polyphonic = true;
- world->engine->new_node(node_path, node_plugin, node_polyphonic);
+ target->new_node(node_path, node_plugin, node_polyphonic);
created.insert(node_path);
}
@@ -159,7 +160,7 @@ Loader::load(Ingen::Shared::World* world,
Redland::Node val_node = (*i)["varval"];
if (key != "")
- world->engine->set_variable(node_path, key, AtomRDF::node_to_atom(val_node));
+ target->set_variable(node_path, key, AtomRDF::node_to_atom(val_node));
}
world->rdf_world->mutex().unlock();
@@ -185,7 +186,7 @@ Loader::load(Ingen::Shared::World* world,
if (created.find(subpatch_path) == created.end()) {
created.insert(subpatch_path);
- load(world, document_uri, patch_path, name, patch);
+ load(world, target, document_uri, patch_path, name, patch);
}
}
@@ -215,7 +216,7 @@ Loader::load(Ingen::Shared::World* world,
assert(Path::is_valid_name(port_name));
const Path port_path = patch_path.base() + node_name + "/" + port_name;
- world->engine->set_port_value(port_path, AtomRDF::node_to_atom((*i)["portval"]));
+ target->set_port_value(port_path, AtomRDF::node_to_atom((*i)["portval"]));
}
@@ -248,18 +249,19 @@ Loader::load(Ingen::Shared::World* world,
if (created.find(port_path) == created.end()) {
bool is_output = (type == "ingen:OutputPort"); // FIXME: check validity
- world->engine->new_port(port_path, datatype, is_output);
+ // FIXME: read index
+ target->new_port(port_path, 0, datatype, is_output);
created.insert(port_path);
}
const Redland::Node val_node = (*i)["portval"];
- world->engine->set_port_value(patch_path.base() + name, AtomRDF::node_to_atom(val_node));
+ target->set_port_value(patch_path.base() + name, AtomRDF::node_to_atom(val_node));
const string key = world->rdf_world->prefixes().qualify((*i)["varkey"].to_string());
const Redland::Node var_val_node = (*i)["varval"];
if (key != "")
- world->engine->set_variable(patch_path.base() + name, key, AtomRDF::node_to_atom(var_val_node));
+ target->set_variable(patch_path.base() + name, key, AtomRDF::node_to_atom(var_val_node));
}
created.clear();
@@ -290,7 +292,7 @@ Loader::load(Ingen::Shared::World* world,
//cerr << patch_path << " 1 CONNECTION: " << src_port << " -> " << dst_port << endl;
- world->engine->connect(src_port, dst_port);
+ target->connect(src_port, dst_port);
}
@@ -316,7 +318,7 @@ Loader::load(Ingen::Shared::World* world,
//cerr << patch_path << " 2 CONNECTION: " << src_port << " -> " << dst_port << endl;
- world->engine->connect(src_port, dst_port);
+ target->connect(src_port, dst_port);
}
@@ -342,7 +344,7 @@ Loader::load(Ingen::Shared::World* world,
//cerr << patch_path << " 3 CONNECTION: " << src_port << " -> " << dst_port << endl;
- world->engine->connect(src_port, dst_port);
+ target->connect(src_port, dst_port);
}
@@ -365,7 +367,7 @@ Loader::load(Ingen::Shared::World* world,
//cerr << patch_path << " 4 CONNECTION: " << src_port << " -> " << dst_port << endl;
- world->engine->connect(src_port, dst_port);
+ target->connect(src_port, dst_port);
}
@@ -386,13 +388,13 @@ Loader::load(Ingen::Shared::World* world,
Redland::Node val_node = (*i)["varval"];
if (key != "")
- world->engine->set_variable(patch_path, key, AtomRDF::node_to_atom(val_node));
+ target->set_variable(patch_path, key, AtomRDF::node_to_atom(val_node));
}
// Set passed variables last to override any loaded values
for (GraphObject::Variables::const_iterator i = data.begin(); i != data.end(); ++i)
- world->engine->set_variable(patch_path, i->first, i->second);
+ target->set_variable(patch_path, i->first, i->second);
/* Enable */
@@ -409,8 +411,10 @@ Loader::load(Ingen::Shared::World* world,
Redland::Node enabled_node = (*i)["enabled"];
if (enabled_node.is_bool() && enabled_node) {
- world->engine->enable_patch(patch_path);
+ target->set_property(patch_path, "ingen:enabled", (bool)true);
break;
+ } else {
+ cerr << "WARNING: Unknown type for property ingen:enabled" << endl;
}
}
diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp
index 1f9328d2..9220e4c9 100644
--- a/src/libs/serialisation/Loader.hpp
+++ b/src/libs/serialisation/Loader.hpp
@@ -28,7 +28,7 @@
#include "module/World.hpp"
namespace Redland { class World; }
-namespace Ingen { namespace Shared { class EngineInterface; } }
+namespace Ingen { namespace Shared { class CommonInterface; } }
using namespace Ingen::Shared;
@@ -40,12 +40,13 @@ class Loader {
public:
virtual ~Loader() {}
- virtual bool load(Ingen::Shared::World* world,
- const Glib::ustring& uri,
- boost::optional<Raul::Path> parent,
- std::string patch_name,
- Glib::ustring patch_uri = "",
- GraphObject::Variables data = GraphObject::Variables());
+ virtual bool load(Ingen::Shared::World* world,
+ Ingen::Shared::CommonInterface* target,
+ const Glib::ustring& uri,
+ boost::optional<Raul::Path> parent,
+ std::string patch_name,
+ Glib::ustring patch_uri = "",
+ GraphObject::Variables data = GraphObject::Variables());
};
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index 2fe368f7..9715e12f 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -184,7 +184,7 @@ main(int argc, char** argv)
engine_interface->load_plugins();
- loader->load(world, uri, parent_path, "");
+ loader->load(world, engine_interface.get(), uri, parent_path, "");
} else {
cerr << "Unable to load serialisation module, aborting." << endl;