X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;h=6d2fdbb677981e5d0f4a93a1247ae65f67529ccd;hb=ae1200716f749050d115558a984f3d4cdeb709b0;hp=95b9e5c6a5b972f2a9a6f907949b82b06f7239c4;hpb=bf6de6da77ca8fdeda6e92ae5adffd0a9f14da1c;p=ardour.git diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 95b9e5c6a5..6d2fdbb677 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -1,3 +1,22 @@ +/* + Copyright (C) 2012 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + #include #include "pbd/compose.h" @@ -6,22 +25,25 @@ #include "gtkmm2ext/bindable_button.h" #include "gtkmm2ext/tearoff.h" #include "gtkmm2ext/actions.h" +#include "gtkmm2ext/motionfeedback.h" + +#include +#include -#include "ardour/dB.h" #include "ardour/monitor_processor.h" #include "ardour/route.h" -#include "ardour/utils.h" #include "ardour_ui.h" #include "gui_thread.h" #include "monitor_section.h" #include "public_editor.h" -#include "utils.h" #include "volume_controller.h" +#include "utils.h" #include "i18n.h" using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace Gtk; using namespace Gtkmm2ext; using namespace PBD; @@ -34,26 +56,27 @@ Glib::RefPtr MonitorSection::little_knob_pixbuf; MonitorSection::MonitorSection (Session* s) : AxisView (s) , RouteUI (s) - , main_table (2, 3) , _tearoff (0) - , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // initial value is unity gain + , channel_table_viewport (*channel_table_scroller.get_hadjustment(), + *channel_table_scroller.get_vadjustment ()) , gain_control (0) - , dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1) // upper+lower will be reset to match model , dim_control (0) - , solo_boost_adjustment (1.0, 1.0, 3.0, 0.01, 0.1) // upper and lower will be reset to match model , solo_boost_control (0) - , solo_cut_adjustment (0.0, 0.0, 1.0, 0.01, 0.1) // upper and lower will be reset to match model , solo_cut_control (0) - , solo_in_place_button (solo_model_group, _("SiP")) - , afl_button (solo_model_group, _("AFL")) - , pfl_button (solo_model_group, _("PFL")) - , cut_all_button (_("MUTE")) - , dim_all_button (_("dim")) - , mono_button (_("mono")) - , rude_solo_button (_("soloing")) - , rude_audition_button (_("auditioning")) - , exclusive_solo_button (_("Exclusive solo")) + , gain_display (0) + , dim_display (0) + , solo_boost_display (0) + , solo_cut_display (0) + , solo_in_place_button (_("SiP"), ArdourButton::led_default_elements) + , afl_button (_("AFL"), ArdourButton::led_default_elements) + , pfl_button (_("PFL"), ArdourButton::led_default_elements) + , exclusive_solo_button (ArdourButton::led_default_elements) + , solo_mute_override_button (ArdourButton::led_default_elements) + , _inhibit_solo_model_update (false) { + + using namespace Menu_Helpers; + Glib::RefPtr act; if (!monitor_actions) { @@ -63,35 +86,24 @@ MonitorSection::MonitorSection (Session* s) register_actions (); } - + set_session (s); VBox* spin_packer; Label* spin_label; - /* Dim */ - - dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, false, 30, 30); - - HBox* dim_packer = manage (new HBox); - dim_packer->show (); - - spin_label = manage (new Label (_("Dim Cut"))); - spin_packer = manage (new VBox); - spin_packer->show (); - spin_packer->set_spacing (6); - spin_packer->pack_start (*dim_control, false, false); - spin_packer->pack_start (*spin_label, false, false); - - dim_packer->set_spacing (12); - dim_packer->pack_start (*spin_packer, true, true); - /* Rude Solo */ - rude_solo_button.set_name ("TransportSoloAlert"); + rude_solo_button.set_text (_("Soloing")); + rude_solo_button.set_name ("rude solo"); rude_solo_button.show (); - rude_audition_button.set_name ("TransportAuditioningAlert"); + rude_iso_button.set_text (_("Isolated")); + rude_iso_button.set_name ("rude isolate"); + rude_iso_button.show (); + + rude_audition_button.set_text (_("Auditioning")); + rude_audition_button.set_name ("rude audition"); rude_audition_button.show (); ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink)); @@ -99,13 +111,20 @@ MonitorSection::MonitorSection (Session* s) rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false); UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything")); + rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false); + UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything")); + rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition), false); UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition")); + solo_in_place_button.set_name ("monitor section solo model"); + afl_button.set_name ("monitor section solo model"); + pfl_button.set_name ("monitor section solo model"); + solo_model_box.set_spacing (6); - solo_model_box.pack_start (solo_in_place_button, false, false); - solo_model_box.pack_start (afl_button, false, false); - solo_model_box.pack_start (pfl_button, false, false); + solo_model_box.pack_start (solo_in_place_button, true, false); + solo_model_box.pack_start (afl_button, true, false); + solo_model_box.pack_start (pfl_button, true, false); solo_in_place_button.show (); afl_button.show (); @@ -113,79 +132,168 @@ MonitorSection::MonitorSection (Session* s) solo_model_box.show (); act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place")); + ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place")); if (act) { - act->connect_proxy (solo_in_place_button); - } + solo_in_place_button.set_related_action (act); + } act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); + ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen")); if (act) { - act->connect_proxy (afl_button); - } + afl_button.set_related_action (act); + } act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl")); + ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen")); if (act) { - act->connect_proxy (pfl_button); - } - + pfl_button.set_related_action (act); + } /* Solo Boost */ - solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, false, 30, 30); - + solo_boost_control = new ArdourKnob (); + solo_boost_control->set_name("monitor knob"); + solo_boost_control->set_size_request(40,40); + ARDOUR_UI::instance()->tooltips().set_tip (*solo_boost_control, _("Gain increase for soloed signals (0dB is normal)")); + + solo_boost_display = new ArdourDisplay (); + solo_boost_display->set_name("monitor section cut"); + solo_boost_display->set_size_request(80,20); + solo_boost_display->add_controllable_preset("0dB", 0.0); + solo_boost_display->add_controllable_preset("3 dB", 3.0); + solo_boost_display->add_controllable_preset("6 dB", 6.0); + solo_boost_display->add_controllable_preset("10 dB", 10.0); + HBox* solo_packer = manage (new HBox); - solo_packer->set_spacing (12); + solo_packer->set_spacing (6); solo_packer->show (); spin_label = manage (new Label (_("Solo Boost"))); spin_packer = manage (new VBox); spin_packer->show (); - spin_packer->set_spacing (6); + spin_packer->set_spacing (3); + spin_packer->pack_start (*spin_label, false, false); spin_packer->pack_start (*solo_boost_control, false, false); - spin_packer->pack_start (*spin_label, false, false); + spin_packer->pack_start (*solo_boost_display, false, false); - solo_packer->pack_start (*spin_packer, true, true); + solo_packer->pack_start (*spin_packer, true, false); /* Solo (SiP) cut */ - solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30); - + solo_cut_control = new ArdourKnob (); + solo_cut_control->set_name ("monitor knob"); + solo_cut_control->set_size_request (40,40); + ARDOUR_UI::instance()->tooltips().set_tip (*solo_cut_control, _("Gain reduction non-soloed signals\nA value above -inf dB causes \"solo-in-front\"")); + + solo_cut_display = new ArdourDisplay (); + solo_cut_display->set_name("monitor section cut"); + solo_cut_display->set_size_request(80,20); + solo_cut_display->add_controllable_preset("0dB", 0.0); + solo_cut_display->add_controllable_preset("-6 dB", -6.0); + solo_cut_display->add_controllable_preset("-12 dB", -12.0); + solo_cut_display->add_controllable_preset("-20 dB", -20.0); + solo_cut_display->add_controllable_preset("OFF", -1200.0); + spin_label = manage (new Label (_("SiP Cut"))); spin_packer = manage (new VBox); spin_packer->show (); - spin_packer->set_spacing (6); + spin_packer->set_spacing (3); + spin_packer->pack_start (*spin_label, false, false); spin_packer->pack_start (*solo_cut_control, false, false); - spin_packer->pack_start (*spin_label, false, false); + spin_packer->pack_start (*solo_cut_display, false, false); + + solo_packer->pack_start (*spin_packer, true, false); + + /* Dim */ + + dim_control = new ArdourKnob (); + dim_control->set_name ("monitor knob"); + dim_control->set_size_request (40,40); + ARDOUR_UI::instance()->tooltips().set_tip (*dim_control, _("Gain reduction to use when dimming monitor outputs")); + + dim_display = new ArdourDisplay (); + dim_display->set_name("monitor section cut"); + dim_display->set_size_request(80,20); + dim_display->add_controllable_preset("0dB", 0.0); + dim_display->add_controllable_preset("-3 dB", -3.0); + dim_display->add_controllable_preset("-6 dB", -6.0); + dim_display->add_controllable_preset("-12 dB", -12.0); + dim_display->add_controllable_preset("-20 dB", -20.0); + + HBox* dim_packer = manage (new HBox); + dim_packer->show (); + + spin_label = manage (new Label (_("Dim"))); + spin_packer = manage (new VBox); + spin_packer->show (); + spin_packer->set_spacing (3); + spin_packer->pack_start (*spin_label, false, false); + spin_packer->pack_start (*dim_control, false, false); + spin_packer->pack_start (*dim_display, false, false); - solo_packer->pack_start (*spin_packer, true, true); + dim_packer->pack_start (*spin_packer, true, false); - exclusive_solo_button.set_name (X_("MonitorCutButton")); + exclusive_solo_button.set_text (_("Excl. Solo")); + exclusive_solo_button.set_name (X_("monitor solo exclusive")); + ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time")); - upper_packer.set_spacing (12); - upper_packer.pack_start (rude_solo_button, false, false); + act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo")); + if (act) { + exclusive_solo_button.set_related_action (act); + } + + solo_mute_override_button.set_text (_("Solo » Mute")); + solo_mute_override_button.set_name (X_("monitor solo override")); + ARDOUR_UI::instance()->set_tip (&solo_mute_override_button, _("If enabled, solo will override mute\n(a soloed & muted track or bus will be audible)")); + + act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo")); + if (act) { + solo_mute_override_button.set_related_action (act); + } + + HBox* solo_opt_box = manage (new HBox); + solo_opt_box->set_spacing (12); + solo_opt_box->set_homogeneous (true); + solo_opt_box->pack_start (exclusive_solo_button); + solo_opt_box->pack_start (solo_mute_override_button); + solo_opt_box->show (); + + upper_packer.set_spacing (6); + + Gtk::HBox* rude_box = manage (new HBox); + rude_box->pack_start (rude_solo_button, true, true); + rude_box->pack_start (rude_iso_button, true, true); + + upper_packer.pack_start (*rude_box, false, false); upper_packer.pack_start (rude_audition_button, false, false); - upper_packer.pack_start (solo_model_box, false, false); - upper_packer.pack_start (exclusive_solo_button, false, false); - upper_packer.pack_start (*solo_packer, false, false); + upper_packer.pack_start (solo_model_box, false, false, 12); + upper_packer.pack_start (*solo_opt_box, false, false); + upper_packer.pack_start (*solo_packer, false, false, 12); + + cut_all_button.set_text (_("Mute")); + cut_all_button.set_name ("monitor section cut"); + cut_all_button.set_name (X_("monitor section cut")); + cut_all_button.set_size_request (-1,50); + cut_all_button.show (); act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all")); if (act) { - act->connect_proxy (cut_all_button); - } + cut_all_button.set_related_action (act); + } + dim_all_button.set_text (_("Dim")); + dim_all_button.set_name ("monitor section dim"); act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all")); if (act) { - act->connect_proxy (dim_all_button); - } + dim_all_button.set_related_action (act); + } + mono_button.set_text (_("Mono")); + mono_button.set_name ("monitor section mono"); act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono")); if (act) { - act->connect_proxy (mono_button); - } - - cut_all_button.set_name (X_("MonitorMuteButton")); - cut_all_button.unset_flags (Gtk::CAN_FOCUS); - cut_all_button.set_size_request (50,50); - cut_all_button.show (); + mono_button.set_related_action (act); + } HBox* bbox = manage (new HBox); @@ -193,44 +301,93 @@ MonitorSection::MonitorSection (Session* s) bbox->pack_start (mono_button, true, true); bbox->pack_start (dim_all_button, true, true); - dim_all_button.set_name (X_("MonitorDimButton")); - dim_all_button.unset_flags (Gtk::CAN_FOCUS); - mono_button.set_name (X_("MonitorMonoButton")); - mono_button.unset_flags (Gtk::CAN_FOCUS); - lower_packer.set_spacing (12); lower_packer.pack_start (*bbox, false, false); lower_packer.pack_start (cut_all_button, false, false); /* Gain */ - gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, false, 80, 80); - - spin_label = manage (new Label (_("Gain"))); - spin_packer = manage (new VBox); + gain_control = new ArdourKnob (); + gain_control->set_name("monitor knob"); + gain_control->set_size_request(80,80); + + gain_display = new ArdourDisplay (); + gain_display->set_name("monitor section cut"); + gain_display->set_size_request(40,20); + gain_display->add_controllable_preset("0dB", 0.0); + gain_display->add_controllable_preset("-3 dB", -3.0); + gain_display->add_controllable_preset("-6 dB", -6.0); + gain_display->add_controllable_preset("-12 dB", -12.0); + gain_display->add_controllable_preset("-20 dB", -20.0); + gain_display->add_controllable_preset("-30 dB", -30.0); + + spin_label = manage (new Label (_("Monitor"))); + spin_packer = manage (new VBox); spin_packer->show (); - spin_packer->set_spacing (6); - spin_packer->pack_start (*gain_control, false, false); + spin_packer->set_spacing (3); spin_packer->pack_start (*spin_label, false, false); + spin_packer->pack_start (*gain_control, false, false); + spin_packer->pack_start (*gain_display, false, false); lower_packer.pack_start (*spin_packer, true, true); - vpacker.set_border_width (12); + channel_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + channel_table_scroller.set_size_request (-1, 150); + channel_table_scroller.set_shadow_type (Gtk::SHADOW_NONE); + channel_table_scroller.show (); + channel_table_scroller.add (channel_table_viewport); + + channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); + channel_size_group->add_widget (channel_table_header); + channel_size_group->add_widget (channel_table); + + channel_table_header.resize (1, 5); + + Label* l1 = manage (new Label (X_(" "))); + l1->set_name (X_("MonitorSectionLabel")); + channel_table_header.attach (*l1, 0, 1, 0, 1, EXPAND|FILL); + + l1 = manage (new Label (X_("Mute"))); + l1->set_name (X_("MonitorSectionLabel")); + channel_table_header.attach (*l1, 1, 2, 0, 1, EXPAND|FILL); + + l1 = manage (new Label (X_("Dim"))); + l1->set_name (X_("MonitorSectionLabel")); + channel_table_header.attach (*l1, 2, 3, 0, 1, EXPAND|FILL); + + l1 = manage (new Label (X_("Solo"))); + l1->set_name (X_("MonitorSectionLabel")); + channel_table_header.attach (*l1, 3, 4, 0, 1, EXPAND|FILL); + + l1 = manage (new Label (X_("Inv"))); + l1->set_name (X_("MonitorSectionLabel")); + channel_table_header.attach (*l1, 4, 5, 0, 1, EXPAND|FILL); + + channel_table_header.show (); + + table_hpacker.pack_start (channel_table, true, true); + + /* note that we don't pack the table_hpacker till later + */ + + vpacker.set_border_width (6); vpacker.set_spacing (12); vpacker.pack_start (upper_packer, false, false); vpacker.pack_start (*dim_packer, false, false); - vpacker.pack_start (main_table, false, false); + vpacker.pack_start (channel_table_header, false, false); + vpacker.pack_start (channel_table_packer, false, false); vpacker.pack_start (lower_packer, false, false); - hpacker.set_border_width (12); - hpacker.set_spacing (12); hpacker.pack_start (vpacker, true, true); gain_control->show_all (); + gain_display->show_all (); dim_control->show_all (); + dim_display->show_all(); solo_boost_control->show_all (); + solo_boost_display->show_all(); - main_table.show (); + channel_table.show (); hpacker.show (); upper_packer.show (); lower_packer.show (); @@ -249,7 +406,7 @@ MonitorSection::MonitorSection (Session* s) /* catch changes that affect us */ - Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context()); + Config->ParameterChanged.connect (config_connection, invalidator (*this), boost::bind (&MonitorSection::parameter_changed, this, _1), gui_context()); } MonitorSection::~MonitorSection () @@ -261,8 +418,13 @@ MonitorSection::~MonitorSection () _channel_buttons.clear (); delete gain_control; + delete gain_display; delete dim_control; + delete dim_display; delete solo_boost_control; + delete solo_boost_display; + delete solo_cut_control; + delete solo_cut_display; delete _tearoff; } @@ -276,49 +438,77 @@ MonitorSection::set_session (Session* s) _route = _session->monitor_out (); if (_route) { - /* session with control outs */ + /* session with monitor section */ _monitor = _route->monitor_control (); assign_controllables (); - } else { - /* session with no control outs */ + } else { + /* session with no monitor section */ _monitor.reset (); _route.reset (); } - - + + if (channel_table_scroller.get_parent()) { + /* scroller is packed, so remove it */ + channel_table_packer.remove (channel_table_scroller); + } + + if (table_hpacker.get_parent () == &channel_table_packer) { + /* this occurs when the table hpacker is directly + packed, so remove it. + */ + channel_table_packer.remove (table_hpacker); + } else if (table_hpacker.get_parent()) { + channel_table_viewport.remove (); + } + + if (_monitor->output_streams().n_audio() > 7) { + /* put the table into a scrolled window, and then put + * that into the channel vpacker, after the table header + */ + channel_table_viewport.add (table_hpacker); + channel_table_packer.pack_start (channel_table_scroller, true, true); + channel_table_viewport.show (); + channel_table_scroller.show (); + + } else { + /* just put the channel table itself into the channel + * vpacker, after the table header + */ + + channel_table_packer.pack_start (table_hpacker, true, true); + channel_table_scroller.hide (); + } + + table_hpacker.show (); + channel_table.show (); + } else { /* no session */ + _monitor.reset (); _route.reset (); control_connections.drop_connections (); - } + rude_iso_button.unset_active_state (); + rude_solo_button.unset_active_state (); - /* both might be null */ + assign_controllables (); + } } MonitorSection::ChannelButtonSet::ChannelButtonSet () - : cut (X_("")) - , dim (X_("")) - , solo (X_("")) - , invert (X_("")) { - cut.set_name (X_("MonitorMuteButton")); - dim.set_name (X_("MonitorDimButton")); - solo.set_name (X_("MixerSoloButton")); - invert.set_name (X_("MonitorInvertButton")); - - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false); - - cut.unset_flags (Gtk::CAN_FOCUS); - dim.unset_flags (Gtk::CAN_FOCUS); - solo.unset_flags (Gtk::CAN_FOCUS); - invert.unset_flags (Gtk::CAN_FOCUS); + cut.set_name (X_("monitor section cut")); + dim.set_name (X_("monitor section dim")); + solo.set_name (X_("monitor section solo")); + invert.set_name (X_("monitor section invert")); + + cut.unset_flags (Gtk::CAN_FOCUS); + dim.unset_flags (Gtk::CAN_FOCUS); + solo.unset_flags (Gtk::CAN_FOCUS); + invert.unset_flags (Gtk::CAN_FOCUS); } -void + void MonitorSection::populate_buttons () { if (!_monitor) { @@ -327,27 +517,16 @@ MonitorSection::populate_buttons () Glib::RefPtr act; uint32_t nchans = _monitor->output_streams().n_audio(); - - main_table.resize (nchans+1, 5); - main_table.set_col_spacings (6); - main_table.set_row_spacings (6); - main_table.set_homogeneous (true); - - Label* l1 = manage (new Label (X_("out"))); - main_table.attach (*l1, 0, 1, 0, 1, SHRINK|FILL, SHRINK|FILL); - l1 = manage (new Label (X_("cut"))); - main_table.attach (*l1, 1, 2, 0, 1, SHRINK|FILL, SHRINK|FILL); - l1 = manage (new Label (X_("dim"))); - main_table.attach (*l1, 2, 3, 0, 1, SHRINK|FILL, SHRINK|FILL); - l1 = manage (new Label (X_("solo"))); - main_table.attach (*l1, 3, 4, 0, 1, SHRINK|FILL, SHRINK|FILL); - l1 = manage (new Label (X_("inv"))); - main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL); - - const uint32_t row_offset = 1; + + channel_table.resize (nchans, 5); + channel_table.set_col_spacings (6); + channel_table.set_row_spacings (6); + channel_table.set_homogeneous (true); + + const uint32_t row_offset = 0; for (uint32_t i = 0; i < nchans; ++i) { - + string l; char buf[64]; @@ -364,51 +543,73 @@ MonitorSection::populate_buttons () } Label* label = manage (new Label (l)); - main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + channel_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL); ChannelButtonSet* cbs = new ChannelButtonSet; _channel_buttons.push_back (cbs); - main_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - main_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - main_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - main_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - + channel_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL); + channel_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL); + channel_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL); + channel_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL); + snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (cbs->cut); - } + cbs->cut.set_related_action (act); + } snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (cbs->dim); + cbs->dim.set_related_action (act); } snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (cbs->solo); + cbs->solo.set_related_action (act); } snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (cbs->invert); + cbs->invert.set_related_action (act); } } - main_table.show_all (); + channel_table.show_all (); } -void -MonitorSection::set_button_names () +void +MonitorSection::toggle_exclusive_solo () { - rec_enable_button_label.set_text ("rec"); - mute_button_label.set_text ("rec"); - solo_button_label.set_text ("rec"); + if (!_monitor) { + return; + } + + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + Config->set_exclusive_solo (tact->get_active()); + } + +} + + +void +MonitorSection::toggle_mute_overrides_solo () +{ + if (!_monitor) { + return; + } + + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + Config->set_solo_mute_override (tact->get_active()); + } } void @@ -437,7 +638,7 @@ MonitorSection::cut_all () if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); _monitor->set_cut_all (tact->get_active()); - } + } } void @@ -529,7 +730,7 @@ MonitorSection::invert_channel (uint32_t chn) if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); _monitor->set_polarity (chn, tact->get_active()); - } + } } void @@ -537,45 +738,55 @@ MonitorSection::register_actions () { string action_name; string action_descr; + Glib::RefPtr act; monitor_actions = ActionGroup::create (X_("Monitor")); ActionManager::add_action_group (monitor_actions); - ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", + ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", _("Switch monitor to mono"), sigc::mem_fun (*this, &MonitorSection::mono)); - ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", + ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", _("Cut monitor"), sigc::mem_fun (*this, &MonitorSection::cut_all)); - ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", + ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", _("Dim monitor"), sigc::mem_fun (*this, &MonitorSection::dim_all)); + act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", _("Toggle exclusive solo mode"), + sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo)); + + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + tact->set_active (Config->get_exclusive_solo()); + + act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", _("Toggle mute overrides solo mode"), + sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo)); + + tact = Glib::RefPtr::cast_dynamic(act); + tact->set_active (Config->get_solo_mute_override()); + + /* note the 1-based counting (for naming - backend uses 0-based) */ for (uint32_t chn = 1; chn <= 16; ++chn) { - /* for the time being, do not use the action description because it always - shows up in the buttons, which is undesirable. - */ - action_name = string_compose (X_("monitor-cut-%1"), chn); - action_descr = string_compose (_("Cut Monitor Chn %1"), chn); - ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + action_descr = string_compose (_("Cut monitor channel %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn)); action_name = string_compose (X_("monitor-dim-%1"), chn); - action_descr = string_compose (_("Dim Monitor Chn %1"), chn+1); - ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + action_descr = string_compose (_("Dim monitor channel %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn)); action_name = string_compose (X_("monitor-solo-%1"), chn); - action_descr = string_compose (_("Solo Monitor Chn %1"), chn); - ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + action_descr = string_compose (_("Solo monitor channel %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn)); action_name = string_compose (X_("monitor-invert-%1"), chn); - action_descr = string_compose (_("Invert Monitor Chn %1"), chn); - ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + action_descr = string_compose (_("Invert monitor channel %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn)); } @@ -584,11 +795,11 @@ MonitorSection::register_actions () Glib::RefPtr solo_actions = ActionGroup::create (X_("Solo")); RadioAction::Group solo_group; - ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", + ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", _("In-place solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_in_place)); - ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", + ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", _("After Fade Listen (AFL) solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_afl)); - ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", + ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", _("Pre Fade Listen (PFL) solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_pfl)); ActionManager::add_action_group (solo_actions); @@ -607,7 +818,16 @@ MonitorSection::solo_use_in_place () if (act) { Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); if (ract) { + if (!ract->get_active ()) { + /* We are turning SiP off, which means that AFL or PFL will be turned on + shortly; don't update the solo model in the mean time, as if the currently + configured listen position is not the one that is about to be turned on, + things will go wrong. + */ + _inhibit_solo_model_update = true; + } Config->set_solo_control_is_listen_control (!ract->get_active()); + _inhibit_solo_model_update = false; } } } @@ -619,14 +839,14 @@ MonitorSection::solo_use_afl () once for the item that became inactive and once for the one that became active. */ - + Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); if (act) { Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); if (ract) { if (ract->get_active()) { - Config->set_listen_position (AfterFaderListen); Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (AfterFaderListen); } } } @@ -640,13 +860,13 @@ MonitorSection::solo_use_pfl () active. */ - Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); + Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl")); if (act) { Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); if (ract) { if (ract->get_active()) { - Config->set_listen_position (PreFaderListen); Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (PreFaderListen); } } } @@ -655,55 +875,50 @@ MonitorSection::solo_use_pfl () void MonitorSection::setup_knob_images () { + try { - - big_knob_pixbuf = ::get_icon ("bigknob"); - + uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob"); + char buf[16]; + snprintf (buf, 16, "#%x", (c >> 8)); + MotionFeedback::set_lamp_color (buf); + big_knob_pixbuf = MotionFeedback::render_pixbuf (80); + } catch (...) { - - error << "No knob image found (or not loadable) at " - << " .... " - << endmsg; + + error << "No usable large knob image" << endmsg; throw failed_constructor (); } - + + if (!big_knob_pixbuf) { + error << "No usable large knob image" << endmsg; + throw failed_constructor (); + } + try { - - little_knob_pixbuf = ::get_icon ("littleknob"); - + + little_knob_pixbuf = MotionFeedback::render_pixbuf (30); + } catch (...) { - - error << "No knob image found (or not loadable) at " - << " .... " - << endmsg; + + error << "No usable small knob image" << endmsg; throw failed_constructor (); } -} -bool -MonitorSection::nonlinear_gain_printer (SpinButton* button) -{ - double val = button->get_adjustment()->get_value(); - char buf[16]; - snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (val))); - button->set_text (buf); - return true; -} + if (!little_knob_pixbuf) { + error << "No usable small knob image" << endmsg; + throw failed_constructor (); + } -bool -MonitorSection::linear_gain_printer (SpinButton* button) -{ - double val = button->get_adjustment()->get_value(); - char buf[16]; - snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (val)); - button->set_text (buf); - return true; } void MonitorSection::update_solo_model () { - const char* action_name; + if (_inhibit_solo_model_update) { + return; + } + + const char* action_name = 0; Glib::RefPtr act; if (Config->get_solo_control_is_listen_control()) { @@ -721,10 +936,19 @@ MonitorSection::update_solo_model () act = ActionManager::get_action (X_("Solo"), action_name); if (act) { + Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); if (ract) { + /* because these are radio buttons, one of them will be + active no matter what. to trigger a change in the + action so that the view picks it up, toggle it. + */ + if (ract->get_active()) { + ract->set_active (false); + } ract->set_active (true); } + } } @@ -735,25 +959,16 @@ MonitorSection::map_state () return; } - gain_control->get_adjustment()->set_value (gain_to_slider_position (_route->gain_control()->get_value())); - dim_control->get_adjustment()->set_value (_monitor->dim_level()); - solo_boost_control->get_adjustment()->set_value (_monitor->solo_boost_level()); - Glib::RefPtr act; update_solo_model (); - + act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); if (tact) { - cerr << "Set monitor cut all action to " << _monitor->cut_all () << endl; tact->set_active (_monitor->cut_all()); - } else { - cerr << " no global cut action\n"; } - } else { - cerr << " no global cut action2\n"; } act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); @@ -763,7 +978,7 @@ MonitorSection::map_state () tact->set_active (_monitor->dim_all()); } } - + act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -780,7 +995,7 @@ MonitorSection::map_state () char action_name[32]; - snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1); + snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n); act = ActionManager::get_action (X_("Monitor"), action_name); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -789,7 +1004,7 @@ MonitorSection::map_state () } } - snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1); + snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n); act = ActionManager::get_action (X_("Monitor"), action_name); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -798,7 +1013,7 @@ MonitorSection::map_state () } } - snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1); + snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n); act = ActionManager::get_action (X_("Monitor"), action_name); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -807,7 +1022,7 @@ MonitorSection::map_state () } } - snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1); + snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n); act = ActionManager::get_action (X_("Monitor"), action_name); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -833,14 +1048,9 @@ MonitorSection::audition_blink (bool onoff) } if (_session->is_auditioning()) { - if (onoff) { - rude_audition_button.set_state (STATE_ACTIVE); - } else { - rude_audition_button.set_state (STATE_NORMAL); - } + rude_audition_button.set_active (onoff); } else { rude_audition_button.set_active (false); - rude_audition_button.set_state (STATE_NORMAL); } } @@ -852,19 +1062,22 @@ MonitorSection::solo_blink (bool onoff) } if (_session->soloing() || _session->listening()) { - if (onoff) { - rude_solo_button.set_state (STATE_ACTIVE); - } else { - rude_solo_button.set_state (STATE_NORMAL); + rude_solo_button.set_active (onoff); + + if (_session->soloing()) { + if (_session->solo_isolated()) { + rude_iso_button.set_active (false); + } } + } else { - // rude_solo_button.set_active (false); - rude_solo_button.set_state (STATE_NORMAL); + rude_solo_button.set_active (false); + rude_iso_button.set_active (false); } } bool -MonitorSection::cancel_solo (GdkEventButton* ev) +MonitorSection::cancel_solo (GdkEventButton*) { if (_session) { if (_session->soloing()) { @@ -878,28 +1091,32 @@ MonitorSection::cancel_solo (GdkEventButton* ev) } bool -MonitorSection::cancel_audition (GdkEventButton* ev) +MonitorSection::cancel_isolate (GdkEventButton*) { - if (_session) { - _session->cancel_audition(); - } + if (_session) { + boost::shared_ptr rl (_session->get_routes ()); + _session->set_solo_isolated (rl, false, Session::rt_cleanup, true); + } + return true; } -void -MonitorSection::solo_cut_changed () +bool +MonitorSection::cancel_audition (GdkEventButton*) { - Config->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment.get_value())); + if (_session) { + _session->cancel_audition(); + } + return true; } void MonitorSection::parameter_changed (std::string name) { - if (name == "solo-control-is-listen-control" || - name == "listen-position") { + if (name == "solo-control-is-listen-control") { + update_solo_model (); + } else if (name == "listen-position") { update_solo_model (); - } else if (name == "solo-mute-gain") { - solo_cut_adjustment.set_value (gain_to_slider_position (Config->get_solo_mute_gain())); } } @@ -913,9 +1130,17 @@ MonitorSection::assign_controllables () return; } + if (_session) { + solo_cut_control->set_controllable (_session->solo_cut_control()); + solo_cut_display->set_controllable (_session->solo_cut_control()); + } else { + solo_cut_control->set_controllable (none); + solo_cut_display->set_controllable (none); + } + if (_route) { gain_control->set_controllable (_route->gain_control()); - control_link (control_connections, _route->gain_control(), gain_adjustment); + gain_display->set_controllable (_route->gain_control()); } else { gain_control->set_controllable (none); } @@ -929,18 +1154,10 @@ MonitorSection::assign_controllables () mono_button.set_controllable (_monitor->mono_control()); mono_button.watch (); - boost::shared_ptr c (_monitor->dim_level_control ()); - - dim_control->set_controllable (c); - dim_adjustment.set_lower (c->lower()); - dim_adjustment.set_upper (c->upper()); - control_link (control_connections, c, dim_adjustment); - - c = _monitor->solo_boost_control (); - solo_boost_control->set_controllable (c); - solo_boost_adjustment.set_lower (c->lower()); - solo_boost_adjustment.set_upper (c->upper()); - control_link (control_connections, c, solo_boost_adjustment); + dim_control->set_controllable (_monitor->dim_level_control ()); + dim_display->set_controllable (_monitor->dim_level_control ()); + solo_boost_control->set_controllable (_monitor->solo_boost_control ()); + solo_boost_display->set_controllable (_monitor->solo_boost_control ()); } else { @@ -949,6 +1166,14 @@ MonitorSection::assign_controllables () mono_button.set_controllable (none); dim_control->set_controllable (none); + dim_display->set_controllable (none); solo_boost_control->set_controllable (none); + solo_boost_display->set_controllable (none); } } + +string +MonitorSection::state_id() const +{ + return "monitor-section"; +}