From e22a0eb1dbf9f2fe4046907e022dd36364caf6b2 Mon Sep 17 00:00:00 2001 From: Hoger Dehnhardt Date: Tue, 30 May 2023 08:22:25 +0200 Subject: [PATCH] add options to swap mute and solo and to create mapping stops --- libs/surfaces/console1/c1_gui.cc | 159 +++++++++++------- libs/surfaces/console1/c1_gui.h | 9 +- libs/surfaces/console1/c1_operations.cc | 44 ++--- .../surfaces/console1/c1_plugin_operations.cc | 2 +- libs/surfaces/console1/console1.cc | 81 ++++++--- libs/surfaces/console1/console1.h | 10 +- 6 files changed, 193 insertions(+), 112 deletions(-) diff --git a/libs/surfaces/console1/c1_gui.cc b/libs/surfaces/console1/c1_gui.cc index d45811beaa..845471b16f 100644 --- a/libs/surfaces/console1/c1_gui.cc +++ b/libs/surfaces/console1/c1_gui.cc @@ -16,28 +16,26 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "c1_gui.h" + #include #include #include -#include "pbd/unwind.h" -#include "pbd/strsplit.h" #include "pbd/file_utils.h" +#include "pbd/i18n.h" +#include "pbd/strsplit.h" +#include "pbd/unwind.h" +#include "ardour/audioengine.h" +#include "ardour/debug.h" +#include "ardour/filesystem_paths.h" +#include "ardour/parameter_descriptor.h" +#include "console1.h" #include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/utils.h" -#include "ardour/audioengine.h" -#include "ardour/filesystem_paths.h" -#include "ardour/parameter_descriptor.h" -#include "ardour/debug.h" - -#include "console1.h" -#include "c1_gui.h" - -#include "pbd/i18n.h" - using namespace PBD; using namespace ARDOUR; using namespace ArdourSurface; @@ -49,9 +47,9 @@ void* Console1::get_gui () const { if (!gui) { - const_cast(this)->build_gui (); + const_cast (this)->build_gui (); } - static_cast(gui)->show_all(); + static_cast (gui)->show_all (); return gui; } @@ -59,9 +57,9 @@ void Console1::tear_down_gui () { if (gui) { - Gtk::Widget *w = static_cast(gui)->get_parent(); + Gtk::Widget* w = static_cast (gui)->get_parent (); if (w) { - w->hide(); + w->hide (); delete w; } } @@ -78,10 +76,11 @@ Console1::build_gui () /*--------------------*/ C1GUI::C1GUI (Console1& p) - : c1 (p) - , table (2, 5) - , action_table (5, 4) - , ignore_active_change (false) + : c1 (p) + , table (6, 4) + , swap_solo_mute_cb () + , create_plugin_stubs_btn () + , ignore_active_change (false) { set_border_width (12); @@ -92,36 +91,62 @@ C1GUI::C1GUI (Console1& p) std::string data_file_path; string name = "console1.png"; - Searchpath spath(ARDOUR::ardour_data_search_path()); + Searchpath spath (ARDOUR::ardour_data_search_path ()); spath.add_subdirectory_to_paths ("icons"); find_file (spath, name, data_file_path); - if (!data_file_path.empty()) { + if (!data_file_path.empty ()) { image.set (data_file_path); hpacker.pack_start (image, false, false); } Gtk::Label* l; - Gtk::Alignment* align; int row = 0; input_combo.pack_start (midi_port_columns.short_name); output_combo.pack_start (midi_port_columns.short_name); - input_combo.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &C1GUI::active_port_changed), &input_combo, true)); - output_combo.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &C1GUI::active_port_changed), &output_combo, false)); + input_combo.signal_changed ().connect ( + sigc::bind (sigc::mem_fun (*this, &C1GUI::active_port_changed), &input_combo, true)); + output_combo.signal_changed ().connect ( + sigc::bind (sigc::mem_fun (*this, &C1GUI::active_port_changed), &output_combo, false)); + + // swap_solo_mute (_ ("Swap Solo and Mute")); + swap_solo_mute_cb.set_tooltip_text ( + _ ("If checked Ardour the mute and solo buttons are swept so they have the same order as in the GUI.")); + swap_solo_mute_cb.set_active (p.swap_solo_mute); + swap_solo_mute_cb.signal_toggled ().connect (sigc::mem_fun (*this, &C1GUI::set_swap_solo_mute)); + + // create_plugin_stubs (_ ("Create Plugin Mapping Stubs")); + create_plugin_stubs_btn.set_tooltip_text (_ ("If checked a mapping stub is created for every unknown plugin.")); + create_plugin_stubs_btn.set_active (p.create_mapping_stubs); + create_plugin_stubs_btn.signal_toggled ().connect (sigc::mem_fun (*this, &C1GUI::set_create_mapping_stubs)); l = manage (new Gtk::Label); - l->set_markup (string_compose ("%1", _("Incoming MIDI on:"))); + l->set_markup (string_compose ("%1", _ ("Incoming MIDI on:"))); l->set_alignment (1.0, 0.5); - table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0)); - table.attach (input_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0); + table.attach (*l, 0, 1, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0)); + table.attach (input_combo, 1, 2, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0), 0, 0); row++; l = manage (new Gtk::Label); - l->set_markup (string_compose ("%1", _("Outgoing MIDI on:"))); + l->set_markup (string_compose ("%1", _ ("Outgoing MIDI on:"))); l->set_alignment (1.0, 0.5); - table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0)); - table.attach (output_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0); + table.attach (*l, 0, 1, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0)); + table.attach (output_combo, 1, 2, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0), 0, 0); + row++; + + l = manage (new Gtk::Label); + l->set_markup (string_compose ("%1", _ ("Swap Solo and Mute:"))); + l->set_alignment (1.0, 0.5); + table.attach (*l, 0, 1, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0)); + table.attach (swap_solo_mute_cb, 1, 2, row, row + 1); + row++; + + l = manage (new Gtk::Label); + l->set_markup (string_compose ("%1", _ ("Create Plugin Mapping Stubs:"))); + l->set_alignment (1.0, 0.5); + table.attach (*l, 0, 1, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0)); + table.attach (create_plugin_stubs_btn, 1, 2, row, row + 1); row++; hpacker.pack_start (table, true, true); @@ -136,13 +161,26 @@ C1GUI::C1GUI (Console1& p) /* catch future changes to connection state */ - ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context()); - ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context()); - c1.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context()); + ARDOUR::AudioEngine::instance ()->PortRegisteredOrUnregistered.connect ( + _port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context ()); + ARDOUR::AudioEngine::instance ()->PortPrettyNameChanged.connect ( + _port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context ()); + c1.ConnectionChange.connect ( + _port_connections, invalidator (*this), boost::bind (&C1GUI::connection_handler, this), gui_context ()); } -C1GUI::~C1GUI () +C1GUI::~C1GUI () {} + +void +C1GUI::set_swap_solo_mute () { + c1.swap_solo_mute = !c1.swap_solo_mute; +} + +void +C1GUI::set_create_mapping_stubs () +{ + c1.create_mapping_stubs = !c1.create_mapping_stubs; } void @@ -164,8 +202,10 @@ C1GUI::update_port_combos () vector midi_inputs; vector midi_outputs; - ARDOUR::AudioEngine::instance()->get_ports ("", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsOutput|ARDOUR::IsTerminal), midi_inputs); - ARDOUR::AudioEngine::instance()->get_ports ("", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsInput|ARDOUR::IsTerminal), midi_outputs); + ARDOUR::AudioEngine::instance ()->get_ports ( + "", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsOutput | ARDOUR::IsTerminal), midi_inputs); + ARDOUR::AudioEngine::instance ()->get_ports ( + "", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsInput | ARDOUR::IsTerminal), midi_outputs); Glib::RefPtr input = build_midi_port_list (midi_inputs, true); Glib::RefPtr output = build_midi_port_list (midi_outputs, false); @@ -176,15 +216,14 @@ C1GUI::update_port_combos () input_combo.set_model (input); output_combo.set_model (output); - Gtk::TreeModel::Children children = input->children(); + Gtk::TreeModel::Children children = input->children (); Gtk::TreeModel::Children::iterator i; - i = children.begin(); + i = children.begin (); ++i; /* skip "Disconnected" */ - - for (n = 1; i != children.end(); ++i, ++n) { + for (n = 1; i != children.end (); ++i, ++n) { string port_name = (*i)[midi_port_columns.full_name]; - if (c1.input_port()->connected_to (port_name)) { + if (c1.input_port ()->connected_to (port_name)) { input_combo.set_active (n); input_found = true; break; @@ -195,13 +234,13 @@ C1GUI::update_port_combos () input_combo.set_active (0); /* disconnected */ } - children = output->children(); - i = children.begin(); + children = output->children (); + i = children.begin (); ++i; /* skip "Disconnected" */ - for (n = 1; i != children.end(); ++i, ++n) { + for (n = 1; i != children.end (); ++i, ++n) { string port_name = (*i)[midi_port_columns.full_name]; - if (c1.output_port()->connected_to (port_name)) { + if (c1.output_port ()->connected_to (port_name)) { output_combo.set_active (n); output_found = true; break; @@ -214,19 +253,19 @@ C1GUI::update_port_combos () } Glib::RefPtr -C1GUI::build_midi_port_list (vector const & ports, bool for_input) +C1GUI::build_midi_port_list (vector const& ports, bool for_input) { Glib::RefPtr store = ListStore::create (midi_port_columns); TreeModel::Row row; row = *store->append (); - row[midi_port_columns.full_name] = string(); - row[midi_port_columns.short_name] = _("Disconnected"); + row[midi_port_columns.full_name] = string (); + row[midi_port_columns.short_name] = _ ("Disconnected"); - for (vector::const_iterator p = ports.begin(); p != ports.end(); ++p) { + for (vector::const_iterator p = ports.begin (); p != ports.end (); ++p) { row = *store->append (); row[midi_port_columns.full_name] = *p; - std::string pn = ARDOUR::AudioEngine::instance()->get_pretty_name_by_name (*p); + std::string pn = ARDOUR::AudioEngine::instance ()->get_pretty_name_by_name (*p); if (pn.empty ()) { pn = (*p).substr ((*p).find (':') + 1); } @@ -246,25 +285,25 @@ C1GUI::active_port_changed (Gtk::ComboBox* combo, bool for_input) TreeModel::iterator active = combo->get_active (); string new_port = (*active)[midi_port_columns.full_name]; - if (new_port.empty()) { + if (new_port.empty ()) { if (for_input) { - c1.input_port()->disconnect_all (); + c1.input_port ()->disconnect_all (); } else { - c1.output_port()->disconnect_all (); + c1.output_port ()->disconnect_all (); } return; } if (for_input) { - if (!c1.input_port()->connected_to (new_port)) { - c1.input_port()->disconnect_all (); - c1.input_port()->connect (new_port); + if (!c1.input_port ()->connected_to (new_port)) { + c1.input_port ()->disconnect_all (); + c1.input_port ()->connect (new_port); } } else { - if (!c1.output_port()->connected_to (new_port)) { - c1.output_port()->disconnect_all (); - c1.output_port()->connect (new_port); + if (!c1.output_port ()->connected_to (new_port)) { + c1.output_port ()->disconnect_all (); + c1.output_port ()->connect (new_port); } } } diff --git a/libs/surfaces/console1/c1_gui.h b/libs/surfaces/console1/c1_gui.h index afd3e0f9c5..eda7430e36 100644 --- a/libs/surfaces/console1/c1_gui.h +++ b/libs/surfaces/console1/c1_gui.h @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -52,10 +53,11 @@ private: PBD::ScopedConnectionList lcxl_connections; Gtk::VBox hpacker; Gtk::Table table; - Gtk::Table action_table; Gtk::ComboBox input_combo; Gtk::ComboBox output_combo; - Gtk::Image image; + Gtk::Image image; + Gtk::CheckButton swap_solo_mute_cb; + Gtk::CheckButton create_plugin_stubs_btn; void update_port_combos (); PBD::ScopedConnection connection_change_connection; @@ -77,6 +79,9 @@ private: Glib::RefPtr build_midi_port_list (std::vector const & ports, bool for_input); void active_port_changed (Gtk::ComboBox*,bool for_input); + void set_swap_solo_mute (); + void set_create_mapping_stubs (); + }; } diff --git a/libs/surfaces/console1/c1_operations.cc b/libs/surfaces/console1/c1_operations.cc index 9f374be9e9..e7e4c55e96 100644 --- a/libs/surfaces/console1/c1_operations.cc +++ b/libs/surfaces/console1/c1_operations.cc @@ -43,11 +43,13 @@ Console1::bank (bool up) if ((current_bank + 1) * bank_size < list_size) { changed = true; ++current_bank; + current_strippable_index = 0; } } else { if (current_bank > 0) { changed = true; --current_bank; + current_strippable_index = bank_size - 1; } } if (changed) { @@ -134,7 +136,7 @@ void Console1::select (const uint32_t i) { uint32_t strip_index = current_bank * bank_size + i; - DEBUG_TRACE (DEBUG::Console1, string_compose ("select( %1 ) : idx %2\n", i, strip_index)); + DEBUG_TRACE (DEBUG::Console1, string_compose ("select( %1 / %2 ) : idx %3\n", current_bank, i, strip_index)); select_rid_by_index (strip_index); } @@ -581,19 +583,19 @@ Console1::map_mute () DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute ...\n"); if (_current_stripable) { if (_current_stripable->mute_control ()->muted ()) { - get_button (MUTE)->set_led_state (true); + get_button (swap_solo_mute ? SOLO : MUTE)->set_led_state (true); } else if (_current_stripable->mute_control ()->muted_by_others_soloing () || _current_stripable->mute_control ()->muted_by_masters ()) { DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute start blinking\n"); - start_blinking (MUTE); + start_blinking (swap_solo_mute ? SOLO : MUTE); } else { DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking\n"); - stop_blinking (MUTE); + stop_blinking (swap_solo_mute ? SOLO : MUTE); } } else { DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking 2\n"); - stop_blinking (MUTE); + stop_blinking (swap_solo_mute ? SOLO : MUTE); } } @@ -612,7 +614,7 @@ Console1::map_phase () { DEBUG_TRACE (DEBUG::Console1, "map_phase \n"); ControllerButton* controllerButton = get_button (PHASE_INV); - if (_current_stripable) { + if (_current_stripable && _current_stripable->phase_control ()) { uint32_t channels = _current_stripable->phase_control ()->size (); uint32_t inverted = 0; for (uint32_t i = 0; i < channels; ++i) { @@ -681,9 +683,9 @@ Console1::map_plugin_state (bool plugin_state) } map_stripable_state (); } else { - // I don't plan shift functionality with plugins... + // I don't plan shift functionality with plugins... shift (0); - // map all plugin related operations + // map all plugin related operations } } @@ -692,7 +694,7 @@ Console1::map_solo () { DEBUG_TRACE (DEBUG::Console1, "map_solo()\n"); try { - ControllerButton* controllerButton = get_button (SOLO); + ControllerButton* controllerButton = get_button (swap_solo_mute ? MUTE : SOLO); if (_current_stripable) { controllerButton->set_led_state (_current_stripable->solo_control ()->soloed ()); } else { @@ -723,8 +725,8 @@ Console1::map_filter () try { get_button (ControllerID::FILTER_TO_COMPRESSORS) ->set_led_state (_current_stripable->filter_enable_controllable (true) - ? _current_stripable->filter_enable_controllable (true)->get_value () - : false); + ? _current_stripable->filter_enable_controllable (true)->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } @@ -759,8 +761,8 @@ Console1::map_gate () try { get_button (ControllerID::SHAPE) ->set_led_state (_current_stripable->gate_enable_controllable () - ? _current_stripable->gate_enable_controllable ()->get_value () - : false); + ? _current_stripable->gate_enable_controllable ()->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } @@ -775,8 +777,8 @@ Console1::map_gate_scf () DEBUG_TRACE (DEBUG::Console1, string_compose ("map_gate_scf() - shift: %1\n", shift_state)); get_button (ControllerID::HARD_GATE) ->set_led_state (_current_stripable->gate_key_filter_enable_controllable () - ? _current_stripable->gate_key_filter_enable_controllable ()->get_value () - : false); + ? _current_stripable->gate_key_filter_enable_controllable ()->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } @@ -791,8 +793,8 @@ Console1::map_gate_listen () DEBUG_TRACE (DEBUG::Console1, string_compose ("map_gate_listen() - shift: %1\n", shift_state)); get_button (ControllerID::HARD_GATE) ->set_led_state (_current_stripable->gate_key_listen_controllable () - ? _current_stripable->gate_key_listen_controllable ()->get_value () - : false); + ? _current_stripable->gate_key_listen_controllable ()->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } @@ -894,8 +896,8 @@ Console1::map_eq () return; try { get_button (EQ)->set_led_state (_current_stripable->eq_enable_controllable () - ? _current_stripable->eq_enable_controllable ()->get_value () - : false); + ? _current_stripable->eq_enable_controllable ()->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } @@ -1012,8 +1014,8 @@ Console1::map_comp () try { get_button (ControllerID::COMP) ->set_led_state (_current_stripable->comp_enable_controllable () - ? _current_stripable->comp_enable_controllable ()->get_value () - : false); + ? _current_stripable->comp_enable_controllable ()->get_value () + : false); } catch (ControlNotFoundException& e) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); } diff --git a/libs/surfaces/console1/c1_plugin_operations.cc b/libs/surfaces/console1/c1_plugin_operations.cc index 5641cb3f64..f565df0dfe 100644 --- a/libs/surfaces/console1/c1_plugin_operations.cc +++ b/libs/surfaces/console1/c1_plugin_operations.cc @@ -338,7 +338,7 @@ Console1::spill_plugins (const int32_t plugin_index) PluginMappingMap::iterator pmmit = pluginMappingMap.find (plugin->unique_id ()); mapping_found = (pmmit != pluginMappingMap.end ()); - if (!mapping_found) { + if (!mapping_found && create_mapping_stubs ) { create_mapping (proc, plugin); return true; } diff --git a/libs/surfaces/console1/console1.cc b/libs/surfaces/console1/console1.cc index 8c9c1741fe..70cfec6087 100644 --- a/libs/surfaces/console1/console1.cc +++ b/libs/surfaces/console1/console1.cc @@ -16,12 +16,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "console1.h" #include #include -#include #include +#include #include "pbd/abstract_ui.cc" // instantiate template #include "pbd/controllable.h" @@ -38,8 +39,6 @@ #include "ardour/stripable.h" #include "ardour/track.h" #include "ardour/vca_manager.h" - -#include "console1.h" #include "c1_control.h" #include "c1_gui.h" @@ -139,6 +138,27 @@ Console1::input_port_name () const #endif } +XMLNode& +Console1::get_state () const +{ + XMLNode& node = MIDISurface::get_state (); + node.set_property ("swap-solo-mute", swap_solo_mute); + node.set_property ("create-mapping-stubs", create_mapping_stubs); + return node; +} + +int +Console1::set_state (const XMLNode& node, int version) +{ + MIDISurface::set_state (node, version); + std::string tmp; + node.get_property ("swap-solo-mute", tmp); + swap_solo_mute = (tmp == "1"); + node.get_property ("create-mapping-stubs", tmp); + create_mapping_stubs = (tmp == "1"); + return 0; +} + std::string Console1::output_port_name () const { @@ -192,10 +212,10 @@ Console1::connect_session_signals () DEBUG_TRACE (DEBUG::Console1, "connect_session_signals\n"); // receive routes added session->RouteAdded.connect ( - session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::create_strip_invetory, this), this); + session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::create_strip_inventory, this), this); // receive VCAs added session->vca_manager ().VCAAdded.connect ( - session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::create_strip_invetory, this), this); + session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::create_strip_inventory, this), this); // receive record state toggled // session->RecordStateChanged.connect(session_connections, @@ -241,18 +261,18 @@ void Console1::notify_session_loaded () { DEBUG_TRACE (DEBUG::Console1, "************** Session Loaded() ********************\n"); - create_strip_invetory (); + create_strip_inventory (); connect_internal_signals (); if (session) { DEBUG_TRACE (DEBUG::Console1, "session available\n"); uint32_t i = 0; - while (!first_selected_stripable () && i < 10 ) { + while (!first_selected_stripable () && i < 10) { DEBUG_TRACE (DEBUG::Console1, "no stripable selected\n"); std::this_thread::sleep_for (std::chrono::milliseconds (1000)); ++i; } - if( i < 11) - stripable_selection_changed (); + if (i < 11) + stripable_selection_changed (); } } @@ -289,10 +309,13 @@ Console1::setup_controls () new ControllerButton ( this, ControllerID::PAGE_DOWN, boost::function (boost::bind (&Console1::bank, this, false))); - new ControllerButton ( - this, ControllerID::MUTE, boost::function (boost::bind (&Console1::mute, this, _1))); - new ControllerButton ( - this, ControllerID::SOLO, boost::function (boost::bind (&Console1::solo, this, _1))); + new ControllerButton (this, + swap_solo_mute ? ControllerID::SOLO : ControllerID::MUTE, + boost::function (boost::bind (&Console1::mute, this, _1))); + new ControllerButton (this, + swap_solo_mute ? ControllerID::MUTE : ControllerID::SOLO, + boost::function (boost::bind (&Console1::solo, this, _1))); + new ControllerButton ( this, ControllerID::PHASE_INV, boost::function (boost::bind (&Console1::phase, this, _1))); @@ -523,6 +546,7 @@ Console1::stripable_selection_changed () void Console1::drop_current_stripable () { + DEBUG_TRACE (DEBUG::Console1, "drop_current_stripable \n"); if (_current_stripable) { if (_current_stripable == session->monitor_out ()) { set_current_stripable (session->master_out ()); @@ -576,14 +600,20 @@ Console1::set_current_stripable (std::shared_ptr r) _current_stripable->DropReferences.connect ( stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::drop_current_stripable, this), this); - _current_stripable->mute_control ()->Changed.connect ( - stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_mute, this), this); + if (_current_stripable->mute_control ()) { + _current_stripable->mute_control ()->Changed.connect ( + stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_mute, this), this); + } - _current_stripable->solo_control ()->Changed.connect ( - stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_solo, this), this); + if (_current_stripable->solo_control ()) { + _current_stripable->solo_control ()->Changed.connect ( + stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_solo, this), this); + } - _current_stripable->phase_control ()->Changed.connect ( - stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_phase, this), this); + if (_current_stripable->phase_control ()) { + _current_stripable->phase_control ()->Changed.connect ( + stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::map_phase, this), this); + } // Rec Enabled std::shared_ptr t = std::dynamic_pointer_cast (_current_stripable); @@ -1091,16 +1121,17 @@ Console1::midi_to_control (Controllable controllable, uint32_t val, uint32_t max } void -Console1::create_strip_invetory () +Console1::create_strip_inventory () { - DEBUG_TRACE (DEBUG::Console1, "create_strip_invetory()\n"); - StripableList sl; + DEBUG_TRACE (DEBUG::Console1, "create_strip_inventory()\n"); + // StripableList sl; boost::optional master_order; strip_inventory.clear (); - session->get_stripables (sl); + StripableList sl = session->get_stripables (); uint32_t index = 0; for (const auto& s : sl) { PresentationInfo pi = s->presentation_info (); + DEBUG_TRACE (DEBUG::Console1, string_compose ("%1: ", s->name ())); if (pi.flags () & ARDOUR::PresentationInfo::Hidden) { DEBUG_TRACE (DEBUG::Console1, string_compose ("strip hidden: index %1, order %2\n", index, pi.order ())); continue; @@ -1113,7 +1144,7 @@ Console1::create_strip_invetory () } if (pi.flags () & ARDOUR::PresentationInfo::MonitorOut) { DEBUG_TRACE (DEBUG::Console1, - string_compose ("monitor strip found at index %1, order %2\n", index, pi.order ())); + string_compose ("monitor strip found at index %1, order %2 - ignoring\n", index, pi.order ())); continue; } strip_inventory.insert (std::make_pair (index, pi.order ())); @@ -1124,7 +1155,7 @@ Console1::create_strip_invetory () strip_inventory.insert (std::make_pair (index, master_order.value ())); } DEBUG_TRACE (DEBUG::Console1, - string_compose ("create_strip_invetory - inventory size %1\n", strip_inventory.size ())); + string_compose ("create_strip_inventory - inventory size %1\n", strip_inventory.size ())); } order_t diff --git a/libs/surfaces/console1/console1.h b/libs/surfaces/console1/console1.h index f813ef7f3e..84a9fbf960 100644 --- a/libs/surfaces/console1/console1.h +++ b/libs/surfaces/console1/console1.h @@ -105,8 +105,12 @@ class Console1 : public MIDISurface std::string input_port_name () const override; std::string output_port_name () const override; - /*XMLNode& get_state () const; - int set_state (const XMLNode&, int version);*/ + XMLNode& get_state () const override; + int set_state (const XMLNode&, int version) override; + + bool swap_solo_mute; + bool create_mapping_stubs; + PBD::Signal0 ConnectionChange; /* Timer Events */ @@ -326,7 +330,7 @@ class Console1 : public MIDISurface StripInventoryMap strip_inventory; - void create_strip_invetory (); + void create_strip_inventory (); order_t get_inventory_order_by_index (const uint32_t index); uint32_t get_index_by_inventory_order (order_t order);