diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-30 14:32:27 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-30 14:32:27 +0000 |
commit | 28e3bc3ac719b7fac393d43631f5eb028d3b09da (patch) | |
tree | c74be3caf55cc2096dca42f4d747b5bcc0db6799 /libs | |
parent | cd58caa93b10ce218c50725c070f6a796e31b7bc (diff) |
MCP: metering changes from rodrigo, makes metering work correctly on the MC Pro (also checked on the nucleus)
git-svn-id: svn://localhost/ardour2/branches/3.0@12489 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 6 | ||||
-rw-r--r-- | libs/surfaces/mackie/meter.cc | 61 | ||||
-rw-r--r-- | libs/surfaces/mackie/meter.h | 6 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 8 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.cc | 8 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.h | 2 |
7 files changed, 85 insertions, 8 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 4eab4231cf..1efe904976 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -880,7 +880,11 @@ MackieControlProtocol::notify_transport_state_changed() update_global_button (Button::Stop, !session->transport_rolling()); update_global_button (Button::Rewind, session->transport_speed() < 0.0); update_global_button (Button::Ffwd, session->transport_speed() > 1.0); - + + for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) { + (*s)->notify_transport_state_changed (); + } + _transport_previously_rolling = session->transport_rolling(); } diff --git a/libs/surfaces/mackie/meter.cc b/libs/surfaces/mackie/meter.cc index 82aef2bef8..d4842aa5ca 100644 --- a/libs/surfaces/mackie/meter.cc +++ b/libs/surfaces/mackie/meter.cc @@ -22,6 +22,7 @@ #include "pbd/compose.h" #include "ardour/debug.h" +#include "mackie_control_protocol.h" #include "meter.h" #include "surface.h" #include "surface_port.h" @@ -40,6 +41,57 @@ Meter::factory (Surface& surface, int id, const char* name, Group& group) return m; } +void +Meter::update_transport_rolling(Surface& surface) +{ + bool transport_is_rolling = (surface.mcp().get_transport_speed () != 0.0f); + + if (_transport_is_rolling == transport_is_rolling) { + return; + } + if (transport_is_rolling) { + MidiByteArray enable_msg; + + // sysex header + enable_msg << surface.sysex_hdr(); + + // code for Channel Meter Enable Message + enable_msg << 0x20; + + // Channel identification + enable_msg << id(); + + // Enabling level meter on LCD, peak hold display on horizontal meter and signal LED + enable_msg << 0x07; + + // sysex trailer + enable_msg << MIDI::eox; + + surface.write (enable_msg); + + } else { + MidiByteArray disable_msg; + + // sysex header + disable_msg << surface.sysex_hdr(); + + // code for Channel Meter Enable Message + disable_msg << 0x20; + + // Channel identification + disable_msg << id(); + + // Disabling level meter on LCD, peak hold display on horizontal meter and signal LED + disable_msg << 0x00; + + // sysex trailer + disable_msg << MIDI::eox; + + surface.write (disable_msg); + } + _transport_is_rolling = transport_is_rolling; +} + void Meter::send_update (Surface& surface, float dB) { @@ -47,6 +99,10 @@ Meter::send_update (Surface& surface, float dB) // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB)); + if (!_transport_is_rolling) { + return; + } + if (dB < -70.0f) { def = 0.0f; } else if (dB < -60.0f) { @@ -89,10 +145,7 @@ Meter::send_update (Surface& surface, float dB) int segment = lrintf ((def/115.0) * 13.0); - if (last_segment_value_sent != segment) { - last_segment_value_sent = segment; - surface.write (MidiByteArray (2, 0xD0, (id()<<4) | segment)); - } + surface.write (MidiByteArray (2, 0xd0, (id()<<4) | segment)); } MidiByteArray diff --git a/libs/surfaces/mackie/meter.h b/libs/surfaces/mackie/meter.h index b94c7ac98a..fffba9599d 100644 --- a/libs/surfaces/mackie/meter.h +++ b/libs/surfaces/mackie/meter.h @@ -32,7 +32,6 @@ class Meter : public Control public: Meter (int id, std::string name, Group & group) : Control (id, name, group) - , last_segment_value_sent (-1) , overload_on (false) {} void send_update (Surface&, float dB); @@ -40,11 +39,12 @@ public: MidiByteArray zero(); static Control* factory (Surface&, int id, const char*, Group&); - - int last_segment_value_sent; + + void update_transport_rolling(Surface& surface); private: bool overload_on; + bool _transport_is_rolling; }; } diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index a80306c799..64ea8785cd 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -1066,3 +1066,11 @@ Strip::reset_saved_values () _last_gain_position_written = -1.0; } + +void +Strip::notify_transport_state_changed() +{ + if (_meter) { + _meter->update_transport_rolling (*_surface); + } +} diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index 99e51ae6e1..0e58b9ec2f 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -83,6 +83,8 @@ public: bool locked() const { return _controls_locked; } void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&); + + void notify_transport_state_changed(); private: Button* _solo; diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 0a5ea09e3e..ca8d3904e8 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -845,3 +845,11 @@ Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const } return false; } + +void +Surface::notify_transport_state_changed() +{ + for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) { + (*s)->notify_transport_state_changed (); + } +} diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index 705554da19..b3b931f2be 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -145,6 +145,8 @@ public: void next_jog_mode (); void set_jog_mode (Mackie::JogWheel::Mode); + + void notify_transport_state_changed(); protected: |