diff options
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/OSCClientReceiver.cpp | 18 | ||||
-rw-r--r-- | src/libs/client/OSCClientReceiver.hpp | 5 | ||||
-rw-r--r-- | src/libs/client/PortModel.hpp | 3 | ||||
-rw-r--r-- | src/libs/client/SigClientInterface.hpp | 4 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 12 | ||||
-rw-r--r-- | src/libs/client/Store.hpp | 1 | ||||
-rw-r--r-- | src/libs/client/ThreadedSigClientInterface.hpp | 5 |
7 files changed, 38 insertions, 10 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 63bf5b69..b9f5a70d 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -33,11 +33,7 @@ namespace Client { OSCClientReceiver::OSCClientReceiver(int listen_port) : ClientInterface("localhost"), _listen_port(listen_port), - _st(NULL)//, -// _receiving_node(false), -// _receiving_node_model(NULL), -// _receiving_node_num_ports(0), -// _num_received_ports(0) + _st(NULL) { start(false); } @@ -164,6 +160,7 @@ OSCClientReceiver::setup_callbacks() 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/port_activity", "s", port_activity_cb, this); lo_server_thread_add_method(_st, "/ingen/program_add", "siis", program_add_cb, this); lo_server_thread_add_method(_st, "/ingen/program_remove", "sii", program_remove_cb, this); } @@ -336,6 +333,17 @@ OSCClientReceiver::_control_change_cb(const char* path, const char* types, lo_ar int +OSCClientReceiver::_port_activity_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + const char* const port_path = &argv[0]->s; + + port_activity(port_path); + + return 0; +} + + +int OSCClientReceiver::_response_ok_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { assert(!strcmp(types, "i")); diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp index 4c036ebf..82c4ff4c 100644 --- a/src/libs/client/OSCClientReceiver.hpp +++ b/src/libs/client/OSCClientReceiver.hpp @@ -62,10 +62,6 @@ public: OSCClientReceiver(int listen_port); ~OSCClientReceiver(); - // Engine side only - //void enable() {} - //void disable() {} - void start(bool dump_osc); void stop(); @@ -103,6 +99,7 @@ private: LO_HANDLER(polyphonic); LO_HANDLER(metadata_update); LO_HANDLER(control_change); + LO_HANDLER(port_activity); LO_HANDLER(program_add); LO_HANDLER(program_remove); }; diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp index 80d5e524..8548a898 100644 --- a/src/libs/client/PortModel.hpp +++ b/src/libs/client/PortModel.hpp @@ -66,7 +66,8 @@ public: } // Signals - sigc::signal<void, float> signal_control; ///< "Control" ports only + sigc::signal<void, float> signal_control; ///< Control ports + sigc::signal<void> signal_activity; ///< Message ports sigc::signal<void, SharedPtr<PortModel> > signal_connection; sigc::signal<void, SharedPtr<PortModel> > signal_disconnection; diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp index bdfdd783..895b4cde 100644 --- a/src/libs/client/SigClientInterface.hpp +++ b/src/libs/client/SigClientInterface.hpp @@ -64,6 +64,7 @@ public: sigc::signal<void, string, string> signal_disconnection; sigc::signal<void, string, string, Raul::Atom> signal_metadata_update; sigc::signal<void, string, float> signal_control_change; + sigc::signal<void, string> signal_port_activity; sigc::signal<void, string, uint32_t, uint32_t, string> signal_program_add; sigc::signal<void, string, uint32_t, uint32_t> signal_program_remove; @@ -133,6 +134,9 @@ protected: void control_change(const string& port_path, float value) { signal_control_change.emit(port_path, value); } + + void port_activity(const string& port_path) + { signal_port_activity.emit(port_path); } void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) { signal_program_add.emit(path, bank, program, name); } diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index e3d93d60..b399505d 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -51,6 +51,7 @@ Store::Store(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> em emitter->signal_disconnection.connect(sigc::mem_fun(this, &Store::disconnection_event)); emitter->signal_metadata_update.connect(sigc::mem_fun(this, &Store::metadata_update_event)); emitter->signal_control_change.connect(sigc::mem_fun(this, &Store::control_change_event)); + emitter->signal_port_activity.connect(sigc::mem_fun(this, &Store::port_activity_event)); } @@ -509,6 +510,17 @@ Store::control_change_event(const Path& port_path, float value) cerr << "ERROR: control change for nonexistant port " << port_path << endl; } + +void +Store::port_activity_event(const Path& port_path) +{ + SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path)); + if (port) + port->signal_activity.emit(); + else + cerr << "ERROR: activity for nonexistant port " << port_path << endl; +} + SharedPtr<PatchModel> Store::connection_patch(const Path& src_port_path, const Path& dst_port_path) diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp index 6b0ec7d3..af241097 100644 --- a/src/libs/client/Store.hpp +++ b/src/libs/client/Store.hpp @@ -104,6 +104,7 @@ private: void patch_cleared_event(const Path& path); void metadata_update_event(const Path& subject_path, const string& predicate, const Atom& value); void control_change_event(const Path& port_path, float value); + void port_activity_event(const Path& port_path); void connection_event(const Path& src_port_path, const Path& dst_port_path); void disconnection_event(const Path& src_port_path, const Path& dst_port_path); diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp index 22f03118..c79ed090 100644 --- a/src/libs/client/ThreadedSigClientInterface.hpp +++ b/src/libs/client/ThreadedSigClientInterface.hpp @@ -65,6 +65,7 @@ public: , disconnection_slot(signal_disconnection.make_slot()) , metadata_update_slot(signal_metadata_update.make_slot()) , control_change_slot(signal_control_change.make_slot()) + , port_activity_slot(signal_port_activity.make_slot()) , program_add_slot(signal_program_add.make_slot()) , program_remove_slot(signal_program_remove.make_slot()) {} @@ -137,6 +138,9 @@ public: void control_change(const string& port_path, float value) { push_sig(sigc::bind(control_change_slot, port_path, value)); } + + void port_activity(const string& port_path) + { push_sig(sigc::bind(port_activity_slot, port_path)); } void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) { push_sig(sigc::bind(program_add_slot, path, bank, program, name)); } @@ -176,6 +180,7 @@ private: sigc::slot<void, string, string> disconnection_slot; sigc::slot<void, string, string, Raul::Atom> metadata_update_slot; sigc::slot<void, string, float> control_change_slot; + sigc::slot<void, string> port_activity_slot; sigc::slot<void, string, uint32_t, uint32_t, string> program_add_slot; sigc::slot<void, string, uint32_t, uint32_t> program_remove_slot; }; |