diff options
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/client/PortModel.h | 6 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 12 | ||||
-rw-r--r-- | src/libs/client/Store.h | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index 7743eed3..2ec6139e 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -20,6 +20,7 @@ #include <cstdlib> #include <string> #include <list> +#include <sigc++/sigc++.h> #include "ObjectModel.h" #include "util/CountedPtr.h" using std::string; using std::list; @@ -77,7 +78,7 @@ public: inline float user_max() const { return m_user_max; } inline void user_max(float f) { m_user_max = f; } inline float value() const { return m_current_val; } - inline void value(float f) { m_current_val = f; } + inline void value(float f) { m_current_val = f; control_change_sig.emit(f); } inline bool connected() { return m_connected; } inline void connected(bool b) { m_connected = b; } inline Type type() { return m_type; } @@ -94,6 +95,9 @@ public: inline bool operator==(const PortModel& pm) { return (m_path == pm.m_path); } + // Signals + sigc::signal<void, float> control_change_sig; ///< "Control" ports only + private: // Prevent copies (undefined) PortModel(const PortModel& copy); diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index ee621ad0..6a91feeb 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -36,6 +36,7 @@ Store::Store(SigClientInterface& emitter) emitter.connection_sig.connect(sigc::mem_fun(this, &Store::connection_event)); emitter.disconnection_sig.connect(sigc::mem_fun(this, &Store::disconnection_event)); emitter.metadata_update_sig.connect(sigc::mem_fun(this, &Store::metadata_update_event)); + emitter.control_change_sig.connect(sigc::mem_fun(this, &Store::control_change_event)); } @@ -311,6 +312,17 @@ Store::metadata_update_event(const string& subject_path, const string& predicate void +Store::control_change_event(const string& port_path, float value) +{ + CountedPtr<PortModel> port = object(port_path); + if (port) + port->value(value); + else + cerr << "ERROR: metadata for nonexistant object." << endl; +} + + +void Store::connection_event(const Path& src_port_path, const Path& dst_port_path) { // ConnectionModel has the clever patch-path-figuring-out stuff in it, so diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h index 2dc94f2d..bed36cd9 100644 --- a/src/libs/client/Store.h +++ b/src/libs/client/Store.h @@ -73,6 +73,7 @@ private: void new_node_event(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports); void new_port_event(const string& path, const string& data_type, bool is_output); void metadata_update_event(const string& subject_path, const string& predicate, const string& value); + void control_change_event(const string& port_path, float value); 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); |