mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 20:56:28 +01:00
MCP: Patch from Rodrigo that:
* implements Metering on/off through Button::Read as per Seablade's suggestion. I choose this button as it's the "Show meters" button in Traktion;
* removes redundant code from Meter::update_transport_rolling();
* renames Meter::update_transport_rolling() to Meter::notify_metering_state_changed();
* renamed Surface::notify_transport_state_changed() to Surface::notify_metering_state_changed();
* renamed Strip::notify_transport_state_changed() to Strip::notify_metering_state_changed();
* created MackieControlProtocol::notify_metering_state_changed() and made MackieControlProtocol::notify_transport_state_changed() use it;
* implemented turning off of timecode display and two char display in Surface::zero_all ();
* implemented master fader zeroing in Surface::zero_all ();
* calling Surfaces->zero_all() at MackieControlProtocol destructor;
* implemented restore of 2nd LCD line content after metering being active.
git-svn-id: svn://localhost/ardour2/branches/3.0@12520 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
bc3aea6f93
commit
ba5e71b50f
9 changed files with 80 additions and 73 deletions
|
|
@ -107,6 +107,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||||
, _modifier_state (0)
|
, _modifier_state (0)
|
||||||
, _ipmidi_base (MIDI::IPMIDIPort::lowest_ipmidi_port_default)
|
, _ipmidi_base (MIDI::IPMIDIPort::lowest_ipmidi_port_default)
|
||||||
, needs_ipmidi_restart (false)
|
, needs_ipmidi_restart (false)
|
||||||
|
, _metering_active (true)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
|
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
|
||||||
|
|
||||||
|
|
@ -123,7 +124,11 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||||
MackieControlProtocol::~MackieControlProtocol()
|
MackieControlProtocol::~MackieControlProtocol()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol\n");
|
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol\n");
|
||||||
|
|
||||||
|
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||||
|
(*s)->zero_all ();
|
||||||
|
}
|
||||||
|
|
||||||
drop_connections ();
|
drop_connections ();
|
||||||
tear_down_gui ();
|
tear_down_gui ();
|
||||||
|
|
||||||
|
|
@ -880,14 +885,20 @@ MackieControlProtocol::notify_transport_state_changed()
|
||||||
update_global_button (Button::Stop, !session->transport_rolling());
|
update_global_button (Button::Stop, !session->transport_rolling());
|
||||||
update_global_button (Button::Rewind, session->transport_speed() < 0.0);
|
update_global_button (Button::Rewind, session->transport_speed() < 0.0);
|
||||||
update_global_button (Button::Ffwd, session->transport_speed() > 1.0);
|
update_global_button (Button::Ffwd, session->transport_speed() > 1.0);
|
||||||
|
|
||||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
notify_metering_state_changed ();
|
||||||
(*s)->notify_transport_state_changed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
_transport_previously_rolling = session->transport_rolling();
|
_transport_previously_rolling = session->transport_rolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MackieControlProtocol::notify_metering_state_changed()
|
||||||
|
{
|
||||||
|
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||||
|
(*s)->notify_metering_state_changed ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MackieControlProtocol::notify_record_state_changed ()
|
MackieControlProtocol::notify_record_state_changed ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ class MackieControlProtocol
|
||||||
bool flip_mode () const { return _flip_mode; }
|
bool flip_mode () const { return _flip_mode; }
|
||||||
ViewMode view_mode () const { return _view_mode; }
|
ViewMode view_mode () const { return _view_mode; }
|
||||||
bool zoom_mode () const { return _zoom_mode; }
|
bool zoom_mode () const { return _zoom_mode; }
|
||||||
|
bool metering_active () const { return _metering_active; }
|
||||||
|
|
||||||
void set_view_mode (ViewMode);
|
void set_view_mode (ViewMode);
|
||||||
void set_flip_mode (bool);
|
void set_flip_mode (bool);
|
||||||
|
|
@ -164,6 +165,7 @@ class MackieControlProtocol
|
||||||
void notify_record_state_changed();
|
void notify_record_state_changed();
|
||||||
void notify_transport_state_changed();
|
void notify_transport_state_changed();
|
||||||
void notify_loop_state_changed();
|
void notify_loop_state_changed();
|
||||||
|
void notify_metering_state_changed();
|
||||||
// mainly to pick up punch-in and punch-out
|
// mainly to pick up punch-in and punch-out
|
||||||
void notify_parameter_changed(std::string const &);
|
void notify_parameter_changed(std::string const &);
|
||||||
void notify_solo_active_changed(bool);
|
void notify_solo_active_changed(bool);
|
||||||
|
|
@ -171,7 +173,7 @@ class MackieControlProtocol
|
||||||
/// Turn timecode on and beats off, or vice versa, depending
|
/// Turn timecode on and beats off, or vice versa, depending
|
||||||
/// on state of _timecode_type
|
/// on state of _timecode_type
|
||||||
void update_timecode_beats_led();
|
void update_timecode_beats_led();
|
||||||
|
|
||||||
/// this is called to generate the midi to send in response to a button press.
|
/// this is called to generate the midi to send in response to a button press.
|
||||||
void update_led(Mackie::Surface&, Mackie::Button & button, Mackie::LedState);
|
void update_led(Mackie::Surface&, Mackie::Button & button, Mackie::LedState);
|
||||||
|
|
||||||
|
|
@ -286,6 +288,7 @@ class MackieControlProtocol
|
||||||
ButtonMap button_map;
|
ButtonMap button_map;
|
||||||
int16_t _ipmidi_base;
|
int16_t _ipmidi_base;
|
||||||
bool needs_ipmidi_restart;
|
bool needs_ipmidi_restart;
|
||||||
|
bool _metering_active;
|
||||||
|
|
||||||
ARDOUR::RouteNotificationList _last_selected_routes;
|
ARDOUR::RouteNotificationList _last_selected_routes;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1009,12 +1009,14 @@ MackieControlProtocol::snapshot_release (Mackie::Button&)
|
||||||
Mackie::LedState
|
Mackie::LedState
|
||||||
MackieControlProtocol::read_press (Mackie::Button&)
|
MackieControlProtocol::read_press (Mackie::Button&)
|
||||||
{
|
{
|
||||||
return none;
|
_metering_active = !_metering_active;
|
||||||
|
notify_metering_state_changed ();
|
||||||
|
return _metering_active;
|
||||||
}
|
}
|
||||||
Mackie::LedState
|
Mackie::LedState
|
||||||
MackieControlProtocol::read_release (Mackie::Button&)
|
MackieControlProtocol::read_release (Mackie::Button&)
|
||||||
{
|
{
|
||||||
return none;
|
return _metering_active;
|
||||||
}
|
}
|
||||||
Mackie::LedState
|
Mackie::LedState
|
||||||
MackieControlProtocol::write_press (Mackie::Button&)
|
MackieControlProtocol::write_press (Mackie::Button&)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
#include "ardour/debug.h"
|
#include "ardour/debug.h"
|
||||||
|
|
||||||
#include "mackie_control_protocol.h"
|
|
||||||
#include "meter.h"
|
#include "meter.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "surface_port.h"
|
#include "surface_port.h"
|
||||||
|
|
@ -42,54 +41,26 @@ Meter::factory (Surface& surface, int id, const char* name, Group& group)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Meter::update_transport_rolling(Surface& surface)
|
Meter::notify_metering_state_changed(Surface& surface, bool transport_is_rolling, bool metering_active)
|
||||||
{
|
{
|
||||||
bool transport_is_rolling = (surface.mcp().get_transport_speed () != 0.0f);
|
MidiByteArray msg;
|
||||||
|
|
||||||
if (_transport_is_rolling == transport_is_rolling) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (transport_is_rolling) {
|
|
||||||
MidiByteArray enable_msg;
|
|
||||||
|
|
||||||
// sysex header
|
// sysex header
|
||||||
enable_msg << surface.sysex_hdr();
|
msg << surface.sysex_hdr();
|
||||||
|
|
||||||
// code for Channel Meter Enable Message
|
// code for Channel Meter Enable Message
|
||||||
enable_msg << 0x20;
|
msg << 0x20;
|
||||||
|
|
||||||
// Channel identification
|
// Channel identification
|
||||||
enable_msg << id();
|
msg << id();
|
||||||
|
|
||||||
// Enabling level meter on LCD, peak hold display on horizontal meter and signal LED
|
// Enable (0x07) / Disable (0x00) level meter on LCD, peak hold display on horizontal meter and signal LED
|
||||||
enable_msg << 0x07;
|
msg << ((transport_is_rolling && metering_active) ? 0x07 : 0x00);
|
||||||
|
|
||||||
// sysex trailer
|
// sysex trailer
|
||||||
enable_msg << MIDI::eox;
|
msg << MIDI::eox;
|
||||||
|
|
||||||
surface.write (enable_msg);
|
surface.write (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
|
void
|
||||||
|
|
@ -99,10 +70,6 @@ Meter::send_update (Surface& surface, float dB)
|
||||||
|
|
||||||
// DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB));
|
// DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB));
|
||||||
|
|
||||||
if (!_transport_is_rolling) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dB < -70.0f) {
|
if (dB < -70.0f) {
|
||||||
def = 0.0f;
|
def = 0.0f;
|
||||||
} else if (dB < -60.0f) {
|
} else if (dB < -60.0f) {
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,10 @@ public:
|
||||||
|
|
||||||
static Control* factory (Surface&, int id, const char*, Group&);
|
static Control* factory (Surface&, int id, const char*, Group&);
|
||||||
|
|
||||||
void update_transport_rolling(Surface& surface);
|
void notify_metering_state_changed(Surface& surface, bool transport_is_rolling, bool metering_active);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool overload_on;
|
bool overload_on;
|
||||||
bool _transport_is_rolling;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::
|
||||||
, _index (index)
|
, _index (index)
|
||||||
, _surface (&s)
|
, _surface (&s)
|
||||||
, _controls_locked (false)
|
, _controls_locked (false)
|
||||||
|
, _transport_is_rolling (false)
|
||||||
|
, _metering_active (true)
|
||||||
, _reset_display_at (0)
|
, _reset_display_at (0)
|
||||||
, _last_gain_position_written (-1.0)
|
, _last_gain_position_written (-1.0)
|
||||||
, _last_pan_azi_position_written (-1.0)
|
, _last_pan_azi_position_written (-1.0)
|
||||||
|
|
@ -690,7 +692,7 @@ Strip::update_automation ()
|
||||||
void
|
void
|
||||||
Strip::update_meter ()
|
Strip::update_meter ()
|
||||||
{
|
{
|
||||||
if (_meter) {
|
if (_meter && _transport_is_rolling && _metering_active) {
|
||||||
float dB = const_cast<PeakMeter&> (_route->peak_meter()).peak_power (0);
|
float dB = const_cast<PeakMeter&> (_route->peak_meter()).peak_power (0);
|
||||||
_meter->send_update (*_surface, dB);
|
_meter->send_update (*_surface, dB);
|
||||||
}
|
}
|
||||||
|
|
@ -1068,9 +1070,26 @@ Strip::reset_saved_values ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Strip::notify_transport_state_changed()
|
Strip::notify_metering_state_changed()
|
||||||
{
|
{
|
||||||
if (_meter) {
|
if (!_route || !_meter) {
|
||||||
_meter->update_transport_rolling (*_surface);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool transport_is_rolling = (_surface->mcp().get_transport_speed () != 0.0f);
|
||||||
|
bool metering_active = _surface->mcp().metering_active ();
|
||||||
|
|
||||||
|
if ((_transport_is_rolling == transport_is_rolling) && (_metering_active == metering_active)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_meter->notify_metering_state_changed (*_surface, transport_is_rolling, metering_active);
|
||||||
|
|
||||||
|
if (!transport_is_rolling || !metering_active) {
|
||||||
|
notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name));
|
||||||
|
notify_panner_azi_changed (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_transport_is_rolling = transport_is_rolling;
|
||||||
|
_metering_active = metering_active;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
|
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
|
||||||
|
|
||||||
void notify_transport_state_changed();
|
void notify_metering_state_changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Button* _solo;
|
Button* _solo;
|
||||||
|
|
@ -99,6 +99,8 @@ private:
|
||||||
int _index;
|
int _index;
|
||||||
Surface* _surface;
|
Surface* _surface;
|
||||||
bool _controls_locked;
|
bool _controls_locked;
|
||||||
|
bool _transport_is_rolling;
|
||||||
|
bool _metering_active;
|
||||||
uint64_t _reset_display_at;
|
uint64_t _reset_display_at;
|
||||||
boost::shared_ptr<ARDOUR::Route> _route;
|
boost::shared_ptr<ARDOUR::Route> _route;
|
||||||
PBD::ScopedConnectionList route_connections;
|
PBD::ScopedConnectionList route_connections;
|
||||||
|
|
|
||||||
|
|
@ -573,8 +573,18 @@ Surface::nth_strip (uint32_t n) const
|
||||||
void
|
void
|
||||||
Surface::zero_all ()
|
Surface::zero_all ()
|
||||||
{
|
{
|
||||||
// TODO turn off Timecode displays
|
if (_mcp.device_info().has_timecode_display ()) {
|
||||||
|
display_timecode (string (10, '0'), string (10, ' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mcp.device_info().has_two_character_display()) {
|
||||||
|
show_two_char_display (string (2, ' '), string (2, '.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mcp.device_info().has_master_fader ()) {
|
||||||
|
_port->write (_master_fader->zero ());
|
||||||
|
}
|
||||||
|
|
||||||
// zero all strips
|
// zero all strips
|
||||||
for (Strips::iterator it = strips.begin(); it != strips.end(); ++it) {
|
for (Strips::iterator it = strips.begin(); it != strips.end(); ++it) {
|
||||||
(*it)->zero();
|
(*it)->zero();
|
||||||
|
|
@ -591,7 +601,7 @@ Surface::zero_controls ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off global buttons and leds
|
// turn off global buttons and leds
|
||||||
// global buttons are only ever on mcu_port, so we don't have
|
// global buttons are only ever on mcu_port, so we don't have
|
||||||
// to figure out which port.
|
// to figure out which port.
|
||||||
|
|
||||||
for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) {
|
for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) {
|
||||||
|
|
@ -601,12 +611,6 @@ Surface::zero_controls ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_number == 0 && _mcp.device_info().has_two_character_display()) {
|
|
||||||
// any hardware-specific stuff
|
|
||||||
// clear 2-char display
|
|
||||||
show_two_char_display (" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// and the led ring for the master strip
|
// and the led ring for the master strip
|
||||||
blank_jog_ring ();
|
blank_jog_ring ();
|
||||||
}
|
}
|
||||||
|
|
@ -847,9 +851,9 @@ Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Surface::notify_transport_state_changed()
|
Surface::notify_metering_state_changed()
|
||||||
{
|
{
|
||||||
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
|
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||||
(*s)->notify_transport_state_changed ();
|
(*s)->notify_metering_state_changed ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public:
|
||||||
void next_jog_mode ();
|
void next_jog_mode ();
|
||||||
void set_jog_mode (Mackie::JogWheel::Mode);
|
void set_jog_mode (Mackie::JogWheel::Mode);
|
||||||
|
|
||||||
void notify_transport_state_changed();
|
void notify_metering_state_changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue