From ad558bdafde7e40b5de79b47d8586aec53cf3f7e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 19 Sep 2007 23:54:39 +0000 Subject: Toggling of individual node polyphonic state. git-svn-id: http://svn.drobilla.net/lad/ingen@733 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/DirectSigClientInterface.hpp | 3 +++ src/libs/client/NodeModel.cpp | 6 +++--- src/libs/client/OSCClientReceiver.cpp | 16 ++++++++++++++++ src/libs/client/OSCClientReceiver.hpp | 1 + src/libs/client/OSCEngineSender.cpp | 4 ++-- src/libs/client/ObjectModel.cpp | 13 +++++++++++-- src/libs/client/ObjectModel.hpp | 14 +++++++++----- src/libs/client/PortModel.hpp | 2 +- src/libs/client/SigClientInterface.hpp | 1 + src/libs/client/Store.cpp | 10 ++++++++++ src/libs/client/Store.hpp | 1 + src/libs/client/ThreadedSigClientInterface.hpp | 10 +++++++--- 12 files changed, 65 insertions(+), 16 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/DirectSigClientInterface.hpp b/src/libs/client/DirectSigClientInterface.hpp index 43877992..72265d11 100644 --- a/src/libs/client/DirectSigClientInterface.hpp +++ b/src/libs/client/DirectSigClientInterface.hpp @@ -74,6 +74,9 @@ private: virtual void new_port(const string& path, const string& data_type, bool is_output) { new_port_sig.emit(path, data_type, is_output); } + virtual void polyphonic(const string& path, bool polyphonic) + { polyphonic_sig.emit(path, polyphonic); } + virtual void patch_enabled(const string& path) { patch_enabled_sig.emit(path); } diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index 3ba343e3..c5aa3f61 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -26,7 +26,8 @@ namespace Client { NodeModel::NodeModel(SharedPtr plugin, const Path& path, bool polyphonic) -: ObjectModel(path), + + : ObjectModel(path, polyphonic), _polyphonic(polyphonic), _plugin_uri(plugin->uri()), _plugin(plugin) @@ -34,8 +35,7 @@ NodeModel::NodeModel(SharedPtr plugin, const Path& path, bool polyp } NodeModel::NodeModel(const string& plugin_uri, const Path& path, bool polyphonic) -: ObjectModel(path), - _polyphonic(polyphonic), +: ObjectModel(path, polyphonic), _plugin_uri(plugin_uri) { } diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index d223e211..9c68f2dd 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -159,6 +159,8 @@ OSCClientReceiver::setup_callbacks() lo_server_thread_add_method(_st, "/ingen/new_node", "ssTi", new_node_cb, this); lo_server_thread_add_method(_st, "/ingen/new_node", "ssFi", new_node_cb, this); lo_server_thread_add_method(_st, "/ingen/new_port", "ssi", 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/metadata_update", NULL, metadata_update_cb, this); lo_server_thread_add_method(_st, "/ingen/control_change", "sf", control_change_cb, this); lo_server_thread_add_method(_st, "/ingen/program_add", "siis", program_add_cb, this); @@ -336,6 +338,20 @@ 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 piece of metadata. */ int diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp index 45273201..41669662 100644 --- a/src/libs/client/OSCClientReceiver.hpp +++ b/src/libs/client/OSCClientReceiver.hpp @@ -99,6 +99,7 @@ private: LO_HANDLER(disconnection); LO_HANDLER(new_node); LO_HANDLER(new_port); + LO_HANDLER(polyphonic); LO_HANDLER(metadata_update); LO_HANDLER(control_change); LO_HANDLER(program_add); diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index e7b94e48..46181195 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -283,11 +283,11 @@ OSCEngineSender::set_polyphonic(const string& path, bool poly) { assert(_engine_addr); if (poly) { - lo_send(_engine_addr, "/ingen/set_polyphony", "isT", + lo_send(_engine_addr, "/ingen/set_polyphonic", "isT", next_id(), path.c_str()); } else { - lo_send(_engine_addr, "/ingen/set_polyphony", "isF", + lo_send(_engine_addr, "/ingen/set_polyphonic", "isF", next_id(), path.c_str()); } diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp index f1393232..fe7b6aaf 100644 --- a/src/libs/client/ObjectModel.cpp +++ b/src/libs/client/ObjectModel.cpp @@ -25,8 +25,9 @@ namespace Ingen { namespace Client { -ObjectModel::ObjectModel(const Path& path) -: _path(path) +ObjectModel::ObjectModel(const Path& path, bool polyphonic) + : _path(path) + , _polyphonic(polyphonic) { } @@ -106,6 +107,14 @@ ObjectModel::add_metadata(const MetadataMap& data) } +void +ObjectModel::set_polyphonic(bool polyphonic) +{ + _polyphonic = polyphonic; + polyphonic_sig.emit(polyphonic); +} + + /** Merge the data of @a model with self, as much as possible. * * This will merge the two models, but with any conflict take the value in diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp index 429f5359..6d2675fb 100644 --- a/src/libs/client/ObjectModel.hpp +++ b/src/libs/client/ObjectModel.hpp @@ -62,10 +62,11 @@ public: typedef Raul::Table > Children; - const MetadataMap& metadata() const { return _metadata; } - const Children& children() const { return _children; } - inline const Path& path() const { return _path; } - SharedPtr parent() const { return _parent; } + const MetadataMap& metadata() const { return _metadata; } + const Children& children() const { return _children; } + inline const Path& path() const { return _path; } + SharedPtr parent() const { return _parent; } + bool polyphonic() const { return _polyphonic; } SharedPtr get_child(const string& name) const; @@ -73,13 +74,14 @@ public: sigc::signal metadata_update_sig; sigc::signal > new_child_sig; sigc::signal > removed_child_sig; + sigc::signal polyphonic_sig; sigc::signal destroyed_sig; sigc::signal renamed_sig; protected: friend class Store; - ObjectModel(const Path& path); + ObjectModel(const Path& path, bool polyphonic); virtual void set_path(const Path& p) { _path = p; renamed_sig.emit(); } virtual void set_parent(SharedPtr p) { assert(p); _parent = p; } @@ -87,10 +89,12 @@ protected: virtual bool remove_child(SharedPtr c); void add_metadata(const MetadataMap& data); + void set_polyphonic(bool); void set(SharedPtr model); Path _path; + bool _polyphonic; SharedPtr _parent; MetadataMap _metadata; diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp index cf8b94f0..b8d1f094 100644 --- a/src/libs/client/PortModel.hpp +++ b/src/libs/client/PortModel.hpp @@ -74,7 +74,7 @@ private: friend class Store; PortModel(const Path& path, const string& type, Direction dir) - : ObjectModel(path), + : ObjectModel(path, false), _type(type), _direction(dir), _current_val(0.0f), diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp index 29c13741..7e020ca2 100644 --- a/src/libs/client/SigClientInterface.hpp +++ b/src/libs/client/SigClientInterface.hpp @@ -53,6 +53,7 @@ public: sigc::signal new_patch_sig; sigc::signal new_node_sig; sigc::signal new_port_sig; + sigc::signal polyphonic_sig; sigc::signal patch_enabled_sig; sigc::signal patch_disabled_sig; sigc::signal patch_polyphony_sig; diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 84528d00..1ca94cce 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -42,6 +42,7 @@ Store::Store(SharedPtr engine, SharedPtr em emitter->new_patch_sig.connect(sigc::mem_fun(this, &Store::new_patch_event)); emitter->new_node_sig.connect(sigc::mem_fun(this, &Store::new_node_event)); emitter->new_port_sig.connect(sigc::mem_fun(this, &Store::new_port_event)); + emitter->polyphonic_sig.connect(sigc::mem_fun(this, &Store::polyphonic_event)); emitter->patch_enabled_sig.connect(sigc::mem_fun(this, &Store::patch_enabled_event)); emitter->patch_disabled_sig.connect(sigc::mem_fun(this, &Store::patch_disabled_event)); emitter->patch_polyphony_sig.connect(sigc::mem_fun(this, &Store::patch_polyphony_event)); @@ -434,6 +435,15 @@ Store::new_port_event(const Path& path, const string& type, bool is_output) resolve_connection_orphans(p); } + +void +Store::polyphonic_event(const Path& path, bool polyphonic) +{ + SharedPtr object = this->object(path); + if (object) + object->set_polyphonic(polyphonic); +} + void Store::patch_enabled_event(const Path& path) diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp index e5309484..4565dbc2 100644 --- a/src/libs/client/Store.hpp +++ b/src/libs/client/Store.hpp @@ -97,6 +97,7 @@ private: void new_patch_event(const Path& path, uint32_t poly); void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); void new_port_event(const Path& path, 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); diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp index 71ee96d2..105db4f4 100644 --- a/src/libs/client/ThreadedSigClientInterface.hpp +++ b/src/libs/client/ThreadedSigClientInterface.hpp @@ -54,6 +54,7 @@ public: , new_patch_slot(new_patch_sig.make_slot()) , new_node_slot(new_node_sig.make_slot()) , new_port_slot(new_port_sig.make_slot()) + , polyphonic_slot(polyphonic_sig.make_slot()) , connection_slot(connection_sig.make_slot()) , patch_enabled_slot(patch_enabled_sig.make_slot()) , patch_disabled_slot(patch_disabled_sig.make_slot()) @@ -73,9 +74,8 @@ public: virtual void subscribe(Shared::EngineInterface* engine) { throw; } // FIXME - // FIXME: make this insert bundle-boundary-events, where the GTK thread - // process all events between start and finish in one cycle, guaranteed - // (no more node jumping) + // TODO: make this insert bundle-boundary-events, where the GTK thread + // process all events between start and finish in one (GTK) "cycle", guaranteed void bundle_begin() {} void bundle_end() {} @@ -104,6 +104,9 @@ public: void new_port(const string& path, const string& data_type, bool is_output) { push_sig(sigc::bind(new_port_slot, path, data_type, is_output)); } + + void polyphonic(const string& path, bool polyphonic) + { push_sig(sigc::bind(polyphonic_slot, path, polyphonic)); } void connection(const string& src_port_path, const string& dst_port_path) { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } @@ -162,6 +165,7 @@ private: sigc::slot new_patch_slot; sigc::slot new_node_slot; sigc::slot new_port_slot; + sigc::slot polyphonic_slot; sigc::slot connection_slot; sigc::slot patch_enabled_slot; sigc::slot patch_disabled_slot; -- cgit v1.2.1