summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2016-10-28 17:34:17 -0700
committerLen Ovens <len@ovenwerks.net>2016-10-28 17:34:17 -0700
commit82d38426562f16b1b168d3f305afb9a85f53afbe (patch)
tree035ad033d74355b5e157198ddfba8166b69578d5 /libs/surfaces
parente6311190921b7b3cb64f3750cdd1035b4afc866f (diff)
OSC: Add names/fader value to master and monitor.
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/osc/osc_global_observer.cc47
-rw-r--r--libs/surfaces/osc/osc_global_observer.h2
2 files changed, 32 insertions, 17 deletions
diff --git a/libs/surfaces/osc/osc_global_observer.cc b/libs/surfaces/osc/osc_global_observer.cc
index b6c2170b1d..e78032f95d 100644
--- a/libs/surfaces/osc/osc_global_observer.cc
+++ b/libs/surfaces/osc/osc_global_observer.cc
@@ -50,6 +50,7 @@ OSCGlobalObserver::OSCGlobalObserver (Session& s, lo_address a, uint32_t gm, std
*/
// Master channel first
+ text_message (X_("/master/name"), "Master");
boost::shared_ptr<Stripable> strip = session->master_out();
boost::shared_ptr<Controllable> mute_controllable = boost::dynamic_pointer_cast<Controllable>(strip->mute_control());
@@ -67,13 +68,8 @@ OSCGlobalObserver::OSCGlobalObserver (Session& s, lo_address a, uint32_t gm, std
}
boost::shared_ptr<Controllable> gain_controllable = boost::dynamic_pointer_cast<Controllable>(strip->gain_control());
- if (gainmode) {
- gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/master/fader"), strip->gain_control()), OSC::instance());
- send_gain_message ("/master/fader", strip->gain_control());
- } else {
- gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/master/gain"), strip->gain_control()), OSC::instance());
- send_gain_message ("/master/gain", strip->gain_control());
- }
+ gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/master/"), strip->gain_control()), OSC::instance());
+ send_gain_message ("/master/", strip->gain_control());
// monitor stuff next
/*
@@ -86,6 +82,7 @@ OSCGlobalObserver::OSCGlobalObserver (Session& s, lo_address a, uint32_t gm, std
*/
strip = session->monitor_out();
if (strip) {
+ text_message (X_("/monitor/name"), "Monitor");
// Hmm, it seems the monitor mute is not at route->mute_control()
/*boost::shared_ptr<Controllable> mute_controllable2 = boost::dynamic_pointer_cast<Controllable>(strip->mute_control());
@@ -94,13 +91,8 @@ OSCGlobalObserver::OSCGlobalObserver (Session& s, lo_address a, uint32_t gm, std
send_change_message ("/monitor/mute", strip->mute_control());
*/
gain_controllable = boost::dynamic_pointer_cast<Controllable>(strip->gain_control());
- if (gainmode) {
- gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/monitor/fader"), strip->gain_control()), OSC::instance());
- send_gain_message ("/monitor/fader", strip->gain_control());
- } else {
- gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/monitor/gain"), strip->gain_control()), OSC::instance());
- send_gain_message ("/monitor/gain", strip->gain_control());
- }
+ gain_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCGlobalObserver::send_gain_message, this, X_("/monitor/"), strip->gain_control()), OSC::instance());
+ send_gain_message ("/monitor/", strip->gain_control());
}
/*
@@ -241,6 +233,20 @@ OSCGlobalObserver::tick ()
_last_meter = now_meter;
}
+ if (feedback[4]) {
+ if (master_timeout) {
+ if (master_timeout == 1) {
+ text_message (X_("/master/name"), "Master");
+ }
+ master_timeout--;
+ }
+ if (monitor_timeout) {
+ if (monitor_timeout == 1) {
+ text_message (X_("/monitor/name"), "Monitor");
+ }
+ monitor_timeout--;
+ }
+ }
}
void
@@ -253,12 +259,19 @@ void
OSCGlobalObserver::send_gain_message (string path, boost::shared_ptr<Controllable> controllable)
{
if (gainmode) {
- float_message (path, gain_to_slider_position (controllable->get_value()));
+ float_message (string_compose ("%1fader", path), gain_to_slider_position (controllable->get_value()));
+ text_message (string_compose ("%1name", path), string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())));
+ if (path.find("master") != std::string::npos) {
+ master_timeout = 8;
+ } else {
+ monitor_timeout = 8;
+ }
+
} else {
if (controllable->get_value() < 1e-15) {
- float_message (path, -200);
+ float_message (string_compose ("%1gain",path), -200);
} else {
- float_message (path, accurate_coefficient_to_dB (controllable->get_value()));
+ float_message (string_compose ("%1gain",path), accurate_coefficient_to_dB (controllable->get_value()));
}
}
}
diff --git a/libs/surfaces/osc/osc_global_observer.h b/libs/surfaces/osc/osc_global_observer.h
index dabb5ba23a..9e0bef450a 100644
--- a/libs/surfaces/osc/osc_global_observer.h
+++ b/libs/surfaces/osc/osc_global_observer.h
@@ -58,6 +58,8 @@ class OSCGlobalObserver
framepos_t _last_frame;
uint32_t _heartbeat;
float _last_meter;
+ uint32_t master_timeout;
+ uint32_t monitor_timeout;
void send_change_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
void send_gain_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);