diff --git a/libs/surfaces/launch_control_xl/gui.cc b/libs/surfaces/launch_control_xl/gui.cc index d64af1e677..dc5cc2901c 100644 --- a/libs/surfaces/launch_control_xl/gui.cc +++ b/libs/surfaces/launch_control_xl/gui.cc @@ -32,6 +32,7 @@ #include "ardour/audioengine.h" #include "ardour/filesystem_paths.h" #include "ardour/parameter_descriptor.h" +#include "ardour/debug.h" #include "launch_control_xl.h" #include "gui.h" @@ -101,6 +102,7 @@ LCXLGUI::LCXLGUI (LaunchControlXL& p) } Gtk::Label* l; + Gtk::Alignment* align; int row = 0; input_combo.pack_start (midi_port_columns.short_name); @@ -123,6 +125,20 @@ LCXLGUI::LCXLGUI (LaunchControlXL& p) table.attach (output_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0); row++; + /* User Settings */ + + fader8master_button.signal_clicked().connect (sigc::mem_fun (*this, &LCXLGUI::toggle_fader8master)); + + l = manage (new Gtk::Label (_("Fader 8 Master"))); + l->set_alignment (1.0, 0.5); + table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); + align = manage (new Alignment); + align->set (0.0, 0.5); + align->add (fader8master_button); + table.attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0),0,0); + fader8master_button.set_active(lcxl.use_fader8master); + row++; + hpacker.pack_start (table, true, true); set_spacing (12); @@ -266,3 +282,12 @@ LCXLGUI::active_port_changed (Gtk::ComboBox* combo, bool for_input) } } } + +void +LCXLGUI::toggle_fader8master () +{ + DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master WAS: %1\n", lcxl.use_fader8master)); + lcxl.use_fader8master = !(lcxl.use_fader8master); + DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master IS: %1\n", lcxl.use_fader8master)); + lcxl.set_fader8master(lcxl.use_fader8master); +} diff --git a/libs/surfaces/launch_control_xl/gui.h b/libs/surfaces/launch_control_xl/gui.h index 3ab2cb30b2..32c061aeea 100644 --- a/libs/surfaces/launch_control_xl/gui.h +++ b/libs/surfaces/launch_control_xl/gui.h @@ -49,6 +49,8 @@ public: LCXLGUI (LaunchControlXL&); ~LCXLGUI (); + void toggle_fader8master (); + private: LaunchControlXL& lcxl; PBD::ScopedConnectionList lcxl_connections; @@ -58,6 +60,7 @@ private: Gtk::ComboBox input_combo; Gtk::ComboBox output_combo; Gtk::Image image; + Gtk::CheckButton fader8master_button; void update_port_combos (); PBD::ScopedConnection connection_change_connection; diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc index 65588a7f79..0ea2f33f3c 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.cc +++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc @@ -81,9 +81,6 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s) /* master cannot be removed, so no need to connect to going-away signal */ master = session->master_out (); - /* the master bus will always be on the last channel on the lcxl */ - stripable[7] = master; - run_event_loop (); @@ -104,6 +101,8 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s) session->vca_manager().VCAAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripables_added, this), lcxl); switch_bank (bank_start); + + set_fader8master(use_fader8master); } LaunchControlXL::~LaunchControlXL () @@ -834,8 +833,15 @@ LaunchControlXL::switch_bank (uint32_t base) boost::shared_ptr s[8]; uint32_t different = 0; + int stripable_counter; - for (int n = 0; n < 7; ++n) { + if (LaunchControlXL::use_fader8master) { + stripable_counter = 7; + } else { + stripable_counter = 8; + } + + for (int n = 0; n < stripable_counter; ++n) { s[n] = session->get_remote_nth_stripable (base+n, PresentationInfo::Flag (PresentationInfo::Route|PresentationInfo::VCA)); if (s[n] != stripable[n]) { different++; @@ -854,7 +860,7 @@ LaunchControlXL::switch_bank (uint32_t base) stripable_connections.drop_connections (); - for (int n = 0; n < 7; ++n) { + for (int n = 0; n < stripable_counter; ++n) { stripable[n] = s[n]; } @@ -908,3 +914,12 @@ void LaunchControlXL::set_track_mode (TrackMode mode) { break; } } + +void +LaunchControlXL::set_fader8master (bool yn) +{ + if (yn) { + stripable[7] = master; + } + switch_bank(bank_start); +} diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.h b/libs/surfaces/launch_control_xl/launch_control_xl.h index 2487666829..ca1774a53a 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.h +++ b/libs/surfaces/launch_control_xl/launch_control_xl.h @@ -335,6 +335,8 @@ public: void *get_gui() const; void tear_down_gui(); + bool use_fader8master = false; + int set_active(bool yn); XMLNode &get_state(); int set_state(const XMLNode &node, int version); @@ -352,6 +354,7 @@ public: void write(const MidiByteArray &); void reset(uint8_t chan); + void set_fader8master (bool yn); TrackMode track_mode() const { return _track_mode; } void set_track_mode(TrackMode mode);