X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;h=5b60942bb17399a0da775e375632defad85e42ff;hb=129ace60e24aa7b5297563d389edbae1d70a3a80;hp=b555df4109ef66f132a90fb51bf1ae66a5ed7587;hpb=52e6bf873c4de5b255f16dcd124ca79fd33ab58f;p=ardour.git diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index b555df4109..5b60942bb1 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -38,11 +38,11 @@ MonitorSection::MonitorSection (Session* s) , _tearoff (0) , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // initial value is unity gain , gain_control (0) - , dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1) + , 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) + , 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) + , 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")) @@ -51,7 +51,10 @@ MonitorSection::MonitorSection (Session* s) , dim_all_button (_("dim")) , mono_button (_("mono")) , rude_solo_button (_("soloing")) - + , rude_iso_button (_("isolated")) + , rude_audition_button (_("auditioning")) + , exclusive_solo_button (_("Exclusive")) + , solo_mute_override_button (_("Solo/Mute")) { Glib::RefPtr act; @@ -64,14 +67,13 @@ MonitorSection::MonitorSection (Session* s) } set_session (s); - + VBox* spin_packer; Label* spin_label; /* Dim */ dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, false, 30, 30); - dim_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::dim_level_changed)); HBox* dim_packer = manage (new HBox); dim_packer->show (); @@ -91,10 +93,22 @@ MonitorSection::MonitorSection (Session* s) rude_solo_button.set_name ("TransportSoloAlert"); rude_solo_button.show (); - ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::solo_blink)); + rude_iso_button.set_name ("MonitorIsoAlert"); + rude_iso_button.show (); + + rude_audition_button.set_name ("TransportAuditioningAlert"); + rude_audition_button.show (); + + ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink)); + 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_model_box.set_spacing (6); solo_model_box.pack_start (solo_in_place_button, false, false); @@ -121,11 +135,9 @@ MonitorSection::MonitorSection (Session* s) act->connect_proxy (pfl_button); } - /* Solo Boost */ solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, false, 30, 30); - solo_boost_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::solo_boost_changed)); HBox* solo_packer = manage (new HBox); solo_packer->set_spacing (12); @@ -143,7 +155,6 @@ MonitorSection::MonitorSection (Session* s) /* Solo (SiP) cut */ solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30); - solo_cut_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::solo_cut_changed)); spin_label = manage (new Label (_("SiP Cut"))); spin_packer = manage (new VBox); @@ -154,9 +165,39 @@ MonitorSection::MonitorSection (Session* s) solo_packer->pack_start (*spin_packer, true, true); + exclusive_solo_button.set_name (X_("MonitorOptButton")); + ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time")); + + act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo")); + if (act) { + act->connect_proxy (exclusive_solo_button); + } + + solo_mute_override_button.set_name (X_("MonitorOptButton")); + 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) { + act->connect_proxy (solo_mute_override_button); + } + + 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 (12); - upper_packer.pack_start (rude_solo_button, false, false); + + 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 (*solo_opt_box, false, false); upper_packer.pack_start (*solo_packer, false, false); act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all")); @@ -197,7 +238,6 @@ MonitorSection::MonitorSection (Session* s) /* Gain */ gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, false, 80, 80); - gain_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::gain_value_changed)); spin_label = manage (new Label (_("Gain"))); spin_packer = manage (new VBox); @@ -231,6 +271,7 @@ MonitorSection::MonitorSection (Session* s) populate_buttons (); map_state (); + assign_controllables (); _tearoff = new TearOff (hpacker); @@ -241,7 +282,7 @@ MonitorSection::MonitorSection (Session* s) /* catch changes that affect us */ - Config->ParameterChanged.connect (config_connection, ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context()); + Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context()); } MonitorSection::~MonitorSection () @@ -270,16 +311,20 @@ MonitorSection::set_session (Session* s) if (_route) { /* session with control outs */ _monitor = _route->monitor_control (); + assign_controllables (); } else { /* session with no control outs */ _monitor.reset (); _route.reset (); } - + } else { /* no session */ _monitor.reset (); _route.reset (); + control_connections.drop_connections (); + rude_iso_button.set_active (false); + rude_solo_button.set_active (false); } /* both might be null */ @@ -400,6 +445,36 @@ MonitorSection::set_button_names () solo_button_label.set_text ("rec"); } +void +MonitorSection::toggle_exclusive_solo () +{ + 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 MonitorSection::dim_all () { @@ -526,6 +601,7 @@ MonitorSection::register_actions () { string action_name; string action_descr; + Glib::RefPtr act; monitor_actions = ActionGroup::create (X_("Monitor")); ActionManager::add_action_group (monitor_actions); @@ -539,6 +615,22 @@ MonitorSection::register_actions () ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", sigc::mem_fun (*this, &MonitorSection::dim_all)); + act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", + 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", "", + sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo)); + + tact = Glib::RefPtr::cast_dynamic(act); + tact->set_active (Config->get_solo_mute_override()); + + /* map from RC config */ + + + /* note the 1-based counting (for naming - backend uses 0-based) */ for (uint32_t chn = 1; chn <= 16; ++chn) { @@ -669,30 +761,6 @@ MonitorSection::setup_knob_images () } } -void -MonitorSection::gain_value_changed () -{ - if (_route) { - _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); - } -} - -void -MonitorSection::dim_level_changed () -{ - if (_monitor) { - _monitor->set_dim_level (dim_adjustment.get_value()); - } -} - -void -MonitorSection::solo_boost_changed () -{ - if (_monitor) { - _monitor->set_solo_boost_level (solo_boost_adjustment.get_value()); - } -} - bool MonitorSection::nonlinear_gain_printer (SpinButton* button) { @@ -760,13 +828,8 @@ MonitorSection::map_state () 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"); @@ -831,6 +894,32 @@ MonitorSection::map_state () } } +void +MonitorSection::do_blink (bool onoff) +{ + solo_blink (onoff); + audition_blink (onoff); +} + +void +MonitorSection::audition_blink (bool onoff) +{ + if (_session == 0) { + return; + } + + if (_session->is_auditioning()) { + if (onoff) { + rude_audition_button.set_state (STATE_ACTIVE); + } else { + rude_audition_button.set_state (STATE_NORMAL); + } + } else { + rude_audition_button.set_active (false); + rude_audition_button.set_state (STATE_NORMAL); + } +} + void MonitorSection::solo_blink (bool onoff) { @@ -844,9 +933,15 @@ MonitorSection::solo_blink (bool onoff) } else { rude_solo_button.set_state (STATE_NORMAL); } + + if (_session->soloing()) { + rude_iso_button.set_active (_session->solo_isolated()); + } + } else { // rude_solo_button.set_active (false); rude_solo_button.set_state (STATE_NORMAL); + rude_iso_button.set_active (false); } } @@ -864,6 +959,26 @@ MonitorSection::cancel_solo (GdkEventButton* ev) return true; } +bool +MonitorSection::cancel_isolate (GdkEventButton* ev) +{ + if (_session) { + boost::shared_ptr rl (_session->get_routes ()); + _session->set_solo_isolated (rl, false, Session::rt_cleanup, true); + } + + return true; +} + +bool +MonitorSection::cancel_audition (GdkEventButton* ev) +{ + if (_session) { + _session->cancel_audition(); + } + return true; +} + void MonitorSection::solo_cut_changed () { @@ -880,3 +995,53 @@ MonitorSection::parameter_changed (std::string name) solo_cut_adjustment.set_value (gain_to_slider_position (Config->get_solo_mute_gain())); } } + +void +MonitorSection::assign_controllables () +{ + boost::shared_ptr none; + + if (!gain_control) { + /* too early - GUI controls not set up yet */ + return; + } + + if (_route) { + gain_control->set_controllable (_route->gain_control()); + control_link (control_connections, _route->gain_control(), gain_adjustment); + } else { + gain_control->set_controllable (none); + } + + if (_monitor) { + + cut_all_button.set_controllable (_monitor->cut_control()); + cut_all_button.watch (); + dim_all_button.set_controllable (_monitor->dim_control()); + dim_all_button.watch (); + 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); + + } else { + + cut_all_button.set_controllable (none); + dim_all_button.set_controllable (none); + mono_button.set_controllable (none); + + dim_control->set_controllable (none); + solo_boost_control->set_controllable (none); + } +}