summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lentfer <jan.lentfer@web.de>2018-08-24 13:29:01 +0200
committerJan Lentfer <jan.lentfer@web.de>2018-08-25 22:51:31 +0200
commitfdbce2e8c89cc6a3e5ee3f9f06f7cc408c9ebbfb (patch)
treef7dfdabdbc48b2d854df0bc27833767353a827c7
parent03c5a35a8cab887eb040ad2c6d15c47e862d4543 (diff)
LCXL: add visual feedback for sec button functions
also add some little fixes in regard to fixing master fader on controller fader no 8
-rw-r--r--libs/surfaces/launch_control_xl/controllers.cc87
-rw-r--r--libs/surfaces/launch_control_xl/launch_control_xl.cc42
-rw-r--r--libs/surfaces/launch_control_xl/launch_control_xl.h12
3 files changed, 129 insertions, 12 deletions
diff --git a/libs/surfaces/launch_control_xl/controllers.cc b/libs/surfaces/launch_control_xl/controllers.cc
index 5749b58d48..1e33a5ac29 100644
--- a/libs/surfaces/launch_control_xl/controllers.cc
+++ b/libs/surfaces/launch_control_xl/controllers.cc
@@ -307,7 +307,10 @@ LaunchControlXL::button_track_focus(uint8_t n)
{
if (buttons_down.find(Device) != buttons_down.end()) {
DEBUG_TRACE (DEBUG::LaunchControlXL, "DEVICE BUTTON HOLD\n");
- stripable[n]->solo_isolate_control()->set_value (!stripable[n]->solo_isolate_control()->get_value(), PBD::Controllable::UseGroup);
+ if (stripable[n]->solo_isolate_control()) {
+ bool solo_isolate_active = stripable[n]->solo_isolate_control()->get_value();
+ stripable[n]->solo_isolate_control()->set_value (!solo_isolate_active, PBD::Controllable::UseGroup);
+ }
return;
}
@@ -483,6 +486,72 @@ LaunchControlXL::solo_mute_rec_changed(uint32_t n) {
}
void
+LaunchControlXL::solo_iso_changed(uint32_t n)
+{
+ if (!stripable[n]) {
+ return;
+ } else {
+ solo_iso_led_bank();
+ }
+}
+
+void
+LaunchControlXL::solo_iso_led_bank ()
+{
+ int stripable_counter = get_amount_of_tracks();
+
+ if (!(buttons_down.find(Device) != buttons_down.end())) {
+ return;
+ } else {
+ for (int y = 0; y < stripable_counter; ++y) {
+ TrackButton* b = focus_button_by_column(y);
+
+ if (stripable[y]->solo_isolate_control()->get_value()) {
+ b->set_color(RedFull);
+ } else {
+ b->set_color(Off);
+ }
+ write (b->state_msg());
+ }
+ LaunchControlXL::set_refresh_leds_flag(true);
+ }
+}
+
+#ifdef MIXBUS
+void
+LaunchControlXL::master_send_changed(uint32_t n)
+{
+ if (!stripable[n]) {
+ return;
+ } else {
+ master_send_led_bank();
+ }
+
+}
+
+void
+LaunchControlXL::master_send_led_bank ()
+{
+ if (!(buttons_down.find(Device) != buttons_down.end())) {
+ return;
+ } else {
+ int stripable_counter = LaunchControlXL::get_amount_of_tracks();
+
+ for (int n = 0; n < stripable_counter; ++n) {
+ TrackButton* b = control_button_by_column(n);
+ if (stripable[n]->master_send_enable_controllable()->get_value()) {
+ b->set_color(GreenFull);
+ } else {
+ b->set_color(Off);
+ }
+ write (b->state_msg());
+ }
+ LaunchControlXL::set_refresh_leds_flag(true);
+ }
+}
+# endif
+
+void
LaunchControlXL::button_track_control(uint8_t n) {
if (!stripable[n]) {
return;
@@ -491,10 +560,13 @@ LaunchControlXL::button_track_control(uint8_t n) {
if (buttons_down.find(Device) != buttons_down.end()) {
DEBUG_TRACE (DEBUG::LaunchControlXL, "DEVICE BUTTON HOLD\n");
#ifdef MIXBUS
- if (stripable[n] != master) {
+ if (stripable[n]->master_send_enable_controllable()) {
+ bool master_send_active = stripable[n]->master_send_enable_controllable()->get_value();
+
DEBUG_TRACE (DEBUG::LaunchControlXL, "MIXBUS Master Assign\n");
- stripable[n]->master_send_enable_controllable()->set_value (!stripable[n]->master_send_enable_controllable()->get_value(), PBD::Controllable::UseGroup);
+ stripable[n]->master_send_enable_controllable()->set_value (!master_send_active, PBD::Controllable::UseGroup);
}
+
#else
/* something useful for Ardour */
#endif
@@ -528,13 +600,13 @@ LaunchControlXL::button_track_mode(TrackMode state)
void
LaunchControlXL::button_select_left()
{
- switch_bank (max (0, bank_start - (7 + (fader8master() ? 1 : 0))));
+ switch_bank (max (0, bank_start - (7 + (fader8master() ? 0 : 1))));
}
void
LaunchControlXL::button_select_right()
{
- switch_bank (max (0, bank_start + 7 + (fader8master() ? 1 : 0)));
+ switch_bank (max (0, bank_start + 7 + (fader8master() ? 0 : 1)));
}
void
@@ -558,7 +630,10 @@ LaunchControlXL::button_device()
void
LaunchControlXL::button_device_long_press()
{
-
+ solo_iso_led_bank();
+#ifdef MIXBUS
+ master_send_led_bank();
+#endif
}
void
diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc
index fa402afd6c..2dfa2418d5 100644
--- a/libs/surfaces/launch_control_xl/launch_control_xl.cc
+++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc
@@ -37,6 +37,7 @@
#include "ardour/midi_track.h"
#include "ardour/midi_port.h"
#include "ardour/session.h"
+#include "ardour/solo_isolate_control.h"
#include "ardour/tempo.h"
#include "ardour/types_convert.h"
#include "ardour/vca_manager.h"
@@ -70,6 +71,7 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s)
, _track_mode(TrackMute)
, _template_number(8) // default template (factory 1)
, _fader8master (false)
+ , _refresh_leds_flag (false)
, bank_start (0)
, connection_state (ConnectionState (0))
, gui (0)
@@ -427,6 +429,9 @@ LaunchControlXL::handle_button_message(Button* button, MIDI::EventTwoBytes* ev)
DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("button depressed: %1\n", LaunchControlXL::button_name_by_id(button->id())));
buttons_down.erase(button->id());
button->timeout_connection.disconnect();
+ if (button == id_note_button_map[Device] && refresh_leds_flag()) {
+ switch_bank (bank_start);
+ }
}
set<ButtonID>::iterator c = consumed.find(button->id());
@@ -853,13 +858,9 @@ LaunchControlXL::switch_bank (uint32_t base)
boost::shared_ptr<Stripable> s[8];
uint32_t different = 0;
- uint8_t stripable_counter;
- if (fader8master ()) {
- stripable_counter = 7;
- } else {
- stripable_counter = 8;
- }
+
+ int stripable_counter = get_amount_of_tracks();
for (int n = 0; n < stripable_counter; ++n) {
s[n] = session->get_remote_nth_stripable (base+n, PresentationInfo::Flag (PresentationInfo::Route|PresentationInfo::VCA));
@@ -898,6 +899,12 @@ LaunchControlXL::switch_bank (uint32_t base)
stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripable_property_change, this, _1, n), lcxl);
stripable[n]->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_changed, this, n), lcxl);
stripable[n]->mute_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::mute_changed, this, n), lcxl);
+ stripable[n]->solo_isolate_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_iso_changed, this,n ), lcxl);
+#ifdef MIXBUS
+ if (stripable[n]->master_send_enable_controllable()) {
+ stripable[n]->master_send_enable_controllable()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::master_send_changed, this,n ), lcxl);
+ }
+#endif
if (stripable[n]->rec_enable_control()) {
stripable[n]->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::rec_changed, this, n), lcxl);
}
@@ -942,6 +949,29 @@ LaunchControlXL::set_fader8master (bool yn)
_fader8master = yn;
if (_fader8master) {
stripable[7] = master;
+ bank_start -= 1;
+ } else {
+ bank_start += 1;
}
+
switch_bank (bank_start);
}
+
+int
+LaunchControlXL::get_amount_of_tracks ()
+{
+ int no_of_tracks;
+ if (fader8master ()) {
+ no_of_tracks = 7;
+ } else {
+ no_of_tracks = 8;
+ }
+
+ return no_of_tracks;
+}
+
+void
+LaunchControlXL::set_refresh_leds_flag (bool yn)
+{
+ _refresh_leds_flag = yn;
+}
diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.h b/libs/surfaces/launch_control_xl/launch_control_xl.h
index 16c3d50f0a..c6695f30b7 100644
--- a/libs/surfaces/launch_control_xl/launch_control_xl.h
+++ b/libs/surfaces/launch_control_xl/launch_control_xl.h
@@ -336,6 +336,8 @@ public:
void *get_gui() const;
void tear_down_gui();
+ int get_amount_of_tracks();
+
int set_active(bool yn);
XMLNode &get_state();
int set_state(const XMLNode &node, int version);
@@ -357,6 +359,9 @@ public:
void set_fader8master (bool yn);
bool fader8master () const { return _fader8master; }
+ void set_refresh_leds_flag (bool yn);
+ bool refresh_leds_flag () const { return _refresh_leds_flag; }
+
TrackMode track_mode() const { return _track_mode; }
void set_track_mode(TrackMode mode);
@@ -368,6 +373,7 @@ private:
uint8_t _template_number;
bool _fader8master;
+ bool _refresh_leds_flag;
void do_request(LaunchControlRequest *);
@@ -514,6 +520,12 @@ private:
void solo_changed (uint32_t n) { solo_mute_rec_changed(n); }
void mute_changed (uint32_t n) { solo_mute_rec_changed(n); }
+ void solo_iso_changed (uint32_t n);
+ void solo_iso_led_bank ();
+#ifdef MIXBUS
+ void master_send_changed (uint32_t n);
+ void master_send_led_bank ();
+#endif
void rec_changed (uint32_t n) { solo_mute_rec_changed(n); }
void solo_mute_rec_changed (uint32_t n);