diff options
author | David Robillard <d@drobilla.net> | 2007-09-19 23:54:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-19 23:54:39 +0000 |
commit | ad558bdafde7e40b5de79b47d8586aec53cf3f7e (patch) | |
tree | a4431ddd696eb66eceb3119a9f7da933f3585ea4 /src/libs/client | |
parent | 0b8415c61e321d032d62b5b1cbda65bab6f178d7 (diff) | |
download | ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.tar.gz ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.tar.bz2 ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.zip |
Toggling of individual node polyphonic state.
git-svn-id: http://svn.drobilla.net/lad/ingen@733 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/DirectSigClientInterface.hpp | 3 | ||||
-rw-r--r-- | src/libs/client/NodeModel.cpp | 6 | ||||
-rw-r--r-- | src/libs/client/OSCClientReceiver.cpp | 16 | ||||
-rw-r--r-- | src/libs/client/OSCClientReceiver.hpp | 1 | ||||
-rw-r--r-- | src/libs/client/OSCEngineSender.cpp | 4 | ||||
-rw-r--r-- | src/libs/client/ObjectModel.cpp | 13 | ||||
-rw-r--r-- | src/libs/client/ObjectModel.hpp | 14 | ||||
-rw-r--r-- | src/libs/client/PortModel.hpp | 2 | ||||
-rw-r--r-- | src/libs/client/SigClientInterface.hpp | 1 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 10 | ||||
-rw-r--r-- | src/libs/client/Store.hpp | 1 | ||||
-rw-r--r-- | src/libs/client/ThreadedSigClientInterface.hpp | 10 |
12 files changed, 65 insertions, 16 deletions
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<PluginModel> 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<PluginModel> 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<string, SharedPtr<ObjectModel> > Children; - const MetadataMap& metadata() const { return _metadata; } - const Children& children() const { return _children; } - inline const Path& path() const { return _path; } - SharedPtr<ObjectModel> parent() const { return _parent; } + const MetadataMap& metadata() const { return _metadata; } + const Children& children() const { return _children; } + inline const Path& path() const { return _path; } + SharedPtr<ObjectModel> parent() const { return _parent; } + bool polyphonic() const { return _polyphonic; } SharedPtr<ObjectModel> get_child(const string& name) const; @@ -73,13 +74,14 @@ public: sigc::signal<void, const string&, const Atom&> metadata_update_sig; sigc::signal<void, SharedPtr<ObjectModel> > new_child_sig; sigc::signal<void, SharedPtr<ObjectModel> > removed_child_sig; + sigc::signal<void, bool> polyphonic_sig; sigc::signal<void> destroyed_sig; sigc::signal<void> 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<ObjectModel> p) { assert(p); _parent = p; } @@ -87,10 +89,12 @@ protected: virtual bool remove_child(SharedPtr<ObjectModel> c); void add_metadata(const MetadataMap& data); + void set_polyphonic(bool); void set(SharedPtr<ObjectModel> model); Path _path; + bool _polyphonic; SharedPtr<ObjectModel> _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<void, string, uint32_t> new_patch_sig; sigc::signal<void, string, string, bool, uint32_t> new_node_sig; sigc::signal<void, string, string, bool> new_port_sig; + sigc::signal<void, string, bool> polyphonic_sig; sigc::signal<void, string> patch_enabled_sig; sigc::signal<void, string> patch_disabled_sig; sigc::signal<void, string, uint32_t> 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<EngineInterface> engine, SharedPtr<SigClientInterface> 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<ObjectModel> 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<void, string, uint32_t> new_patch_slot; sigc::slot<void, string, string, bool, int> new_node_slot; sigc::slot<void, string, 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; |