X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;h=8173e8833dcc124fd6c7cb26148c1fd0ae9cc1ba;hb=3b079064e62facf91a35d2307709fc00feb0bb19;hp=15840fc2803465a3cc052962e2db38ffeee36c25;hpb=100d7c0f82602f6225537342f6df7dee12479e9d;p=ardour.git diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 15840fc280..8173e8833d 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -6,6 +6,7 @@ #include "gtkmm2ext/bindable_button.h" #include "gtkmm2ext/tearoff.h" #include "gtkmm2ext/actions.h" +#include "gtkmm2ext/motionfeedback.h" #include "ardour/dB.h" #include "ardour/monitor_processor.h" @@ -13,7 +14,9 @@ #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" @@ -33,14 +36,15 @@ MonitorSection::MonitorSection (Session* s) : AxisView (s) , RouteUI (s) , main_table (2, 3) - , meter (s) , _tearoff (0) - , gain_adjustment (1.0, 0.0, 1.0, 0.01, 0.1) + , 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, 2.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) // 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")) @@ -48,7 +52,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; @@ -60,47 +67,19 @@ MonitorSection::MonitorSection (Session* s) } - _route = _session->control_out (); - - if (!_route) { - throw failed_constructor (); - } - - _monitor = _route->monitor_control (); - - if (!_monitor) { - throw failed_constructor (); - } - - VBox* sub_knob_packer = manage (new VBox); - sub_knob_packer->set_spacing (12); + set_session (s); VBox* spin_packer; Label* spin_label; - gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, true); - gain_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::gain_value_changed)); - gain_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::nonlinear_gain_printer), - &gain_control->spinner())); + /* Dim */ - spin_label = manage (new Label (_("Gain (dB)"))); - spin_packer = manage (new VBox); - spin_packer->show (); - spin_packer->set_spacing (6); - spin_packer->pack_start (*gain_control, false, false); - spin_packer->pack_start (*spin_label, false, false); - - sub_knob_packer->pack_start (*spin_packer, false, false); - - dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, true, 30, 30); - dim_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::dim_level_changed)); - dim_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::linear_gain_printer), - &dim_control->spinner())); + 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 (dB)"))); + spin_label = manage (new Label (_("Dim Cut"))); spin_packer = manage (new VBox); spin_packer->show (); spin_packer->set_spacing (6); @@ -108,64 +87,29 @@ MonitorSection::MonitorSection (Session* s) spin_packer->pack_start (*spin_label, false, false); dim_packer->set_spacing (12); - dim_packer->pack_start (*spin_packer, false, false); - - VBox* keep_dim_under_vertical_size_control = manage (new VBox); - keep_dim_under_vertical_size_control->pack_start (dim_all_button, true, false); - keep_dim_under_vertical_size_control->show (); - dim_all_button.set_size_request (40,40); - dim_all_button.show (); - - dim_packer->pack_start (*keep_dim_under_vertical_size_control, false, false); - sub_knob_packer->pack_start (*dim_packer, false, true); - - solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, true, 30, 30); - solo_boost_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::solo_boost_changed)); - solo_boost_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::linear_gain_printer), - &solo_boost_control->spinner())); - - HBox* solo_packer = manage (new HBox); - solo_packer->show (); + dim_packer->pack_start (*spin_packer, true, true); - spin_label = manage (new Label (_("Solo Boost (dB)"))); - spin_packer = manage (new VBox); - spin_packer->show (); - spin_packer->set_spacing (6); - spin_packer->pack_start (*solo_boost_control, false, false); - spin_packer->pack_start (*spin_label, false, false); - - VBox* keep_rude_solo_under_vertical_size_control = manage (new VBox); - keep_rude_solo_under_vertical_size_control->show (); - keep_rude_solo_under_vertical_size_control->pack_start (rude_solo_button, true, false); - - solo_packer->set_spacing (12); - solo_packer->pack_start (*spin_packer, false, false); - solo_packer->pack_start (*keep_rude_solo_under_vertical_size_control, true, false); + /* Rude Solo */ rude_solo_button.set_name ("TransportSoloAlert"); rude_solo_button.show (); - ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::solo_blink)); - rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo)); - UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything")); + rude_iso_button.set_name ("MonitorIsoAlert"); + rude_iso_button.show (); - sub_knob_packer->pack_start (*solo_packer, false, true); + rude_audition_button.set_name ("TransportAuditioningAlert"); + rude_audition_button.show (); - knob_packer.pack_start (*sub_knob_packer, false, true); + ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink)); - sub_knob_packer->show (); - knob_packer.show (); - gain_control->show_all (); - dim_control->show_all (); - solo_boost_control->show_all (); + 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")); - meter.set_meter (&_route->peak_meter()); - meter.setup_meters (300, 5); - - table_knob_packer.pack_start (main_table, true, true); - table_knob_packer.pack_start (knob_packer, false, false); + 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")); - table_knob_packer.show (); + 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); @@ -192,7 +136,70 @@ 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); + + HBox* solo_packer = manage (new HBox); + solo_packer->set_spacing (12); + 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->pack_start (*solo_boost_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + solo_packer->pack_start (*spin_packer, true, true); + + /* Solo (SiP) cut */ + + solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30); + + spin_label = manage (new Label (_("SiP Cut"))); + spin_packer = manage (new VBox); + spin_packer->show (); + spin_packer->set_spacing (6); + spin_packer->pack_start (*solo_cut_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + 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); + + 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")); if (act) { @@ -209,57 +216,152 @@ MonitorSection::MonitorSection (Session* s) 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 (); + HBox* bbox = manage (new HBox); + + bbox->set_spacing (12); + 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 (mono_button, false, false); + 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); + spin_packer->show (); + spin_packer->set_spacing (6); + spin_packer->pack_start (*gain_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + lower_packer.pack_start (*spin_packer, true, true); + vpacker.set_border_width (12); vpacker.set_spacing (12); vpacker.pack_start (upper_packer, false, false); - vpacker.pack_start (table_knob_packer, false, false); + vpacker.pack_start (*dim_packer, false, false); + vpacker.pack_start (main_table, false, false); vpacker.pack_start (lower_packer, false, false); - VBox* keep_meter_under_control = manage (new VBox); - keep_meter_under_control->pack_start (meter, false, false); - keep_meter_under_control->show (); - hpacker.set_border_width (12); hpacker.set_spacing (12); - hpacker.pack_start (*keep_meter_under_control, false, false); hpacker.pack_start (vpacker, true, true); + gain_control->show_all (); + dim_control->show_all (); + solo_boost_control->show_all (); + main_table.show (); hpacker.show (); upper_packer.show (); lower_packer.show (); vpacker.show (); - meter.show_all (); populate_buttons (); map_state (); + assign_controllables (); _tearoff = new TearOff (hpacker); + /* if torn off, make this a normal window */ _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); _tearoff->tearoff_window().set_title (X_("Monitor")); + _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false); + + /* catch changes that affect us */ + + Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context()); } MonitorSection::~MonitorSection () { + for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) { + delete *i; + } + + _channel_buttons.clear (); + delete gain_control; delete dim_control; delete solo_boost_control; delete _tearoff; } +void +MonitorSection::set_session (Session* s) +{ + AxisView::set_session (s); + + if (_session) { + + _route = _session->monitor_out (); + + 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 */ +} + +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); +} + void MonitorSection::populate_buttons () { + if (!_monitor) { + return; + } + Glib::RefPtr act; - uint32_t nchans = _route->monitor_control()->output_streams().n_audio(); + uint32_t nchans = _monitor->output_streams().n_audio(); main_table.resize (nchans+1, 5); main_table.set_col_spacings (6); @@ -277,41 +379,7 @@ MonitorSection::populate_buttons () l1 = manage (new Label (X_("inv"))); main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL); -#if 0 - /* the "all" buttons for cut & dim */ - - Label *la = manage (new Label (X_("all"))); - main_table.attach (*la, 0, 1, 1, 2, SHRINK|FILL, SHRINK|FILL); - - - /* cut all */ - - BindableToggleButton* ca = manage (new BindableToggleButton (X_(""))); - ca->set_name (X_("MixerMuteButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (ca->gobj()), false); - main_table.attach (*ca, 1, 2, 1, 2, SHRINK|FILL, SHRINK|FILL); - - act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all")); - if (act) { - act->connect_proxy (*ca); - } - - /* dim all */ - - BindableToggleButton* da = manage (new BindableToggleButton (X_(""))); - da->set_name (X_("MixerMuteButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (da->gobj()), false); - main_table.attach (*da, 2, 3, 1, 2, SHRINK|FILL, SHRINK|FILL); - - act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all")); - if (act) { - act->connect_proxy (*da); - } - - uint32_t row_offset = 2; -#else - uint32_t row_offset = 1; -#endif + const uint32_t row_offset = 1; for (uint32_t i = 0; i < nchans; ++i) { @@ -330,61 +398,41 @@ MonitorSection::populate_buttons () l = buf; } - Label* c1 = manage (new Label (l)); - main_table.attach (*c1, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - - /* Cut */ + Label* label = manage (new Label (l)); + main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - BindableToggleButton* c2 = manage (new BindableToggleButton (X_(""))); - c2->set_name (X_("MixerMuteButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); - main_table.attach (*c2, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|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); + snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (*c2); + act->connect_proxy (cbs->cut); } - /* Dim */ - - BindableToggleButton* c3 = manage (new BindableToggleButton (X_(""))); - c3->set_name (X_("MixerMuteButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); - main_table.attach (*c3, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (*c3); + act->connect_proxy (cbs->dim); } - /* Solo */ - - BindableToggleButton* c4 = manage (new BindableToggleButton (X_(""))); - c4->set_name (X_("MixerSoloButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); - main_table.attach (*c4, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (*c4); + act->connect_proxy (cbs->solo); } - /* Invert (Polarity/Phase) */ - - BindableToggleButton* c5 = manage (new BindableToggleButton (X_(""))); - c5->set_name (X_("MixerPhaseInvertButton")); - gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); - main_table.attach (*c5, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); - snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1); act = ActionManager::get_action (X_("Monitor"), buf); if (act) { - act->connect_proxy (*c5); + act->connect_proxy (cbs->invert); } - } main_table.show_all (); @@ -398,15 +446,43 @@ MonitorSection::set_button_names () solo_button_label.set_text ("rec"); } -Widget& -MonitorSection::pack_widget () const +void +MonitorSection::toggle_exclusive_solo () { - return *_tearoff; + 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 () { + if (!_monitor) { + return; + } + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -418,6 +494,10 @@ MonitorSection::dim_all () void MonitorSection::cut_all () { + if (!_monitor) { + return; + } + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -428,6 +508,10 @@ MonitorSection::cut_all () void MonitorSection::mono () { + if (!_monitor) { + return; + } + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -438,6 +522,10 @@ MonitorSection::mono () void MonitorSection::cut_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-cut-%u", chn); @@ -453,6 +541,10 @@ MonitorSection::cut_channel (uint32_t chn) void MonitorSection::dim_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-dim-%u", chn); @@ -469,6 +561,10 @@ MonitorSection::dim_channel (uint32_t chn) void MonitorSection::solo_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-solo-%u", chn); @@ -485,17 +581,20 @@ MonitorSection::solo_channel (uint32_t chn) void MonitorSection::invert_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; + snprintf (buf, sizeof (buf), "monitor-invert-%u", chn); --chn; // 0-based in backend - snprintf (buf, sizeof (buf), "monitor-invert-%u", chn); Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); _monitor->set_polarity (chn, tact->get_active()); - } - + } } void @@ -503,6 +602,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); @@ -516,7 +616,23 @@ MonitorSection::register_actions () ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", sigc::mem_fun (*this, &MonitorSection::dim_all)); - /* note the 1-based counting for naming vs. 0-based for action */ + 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) { @@ -618,56 +734,39 @@ MonitorSection::solo_use_pfl () } } -void -MonitorSection::fast_update () -{ - meter.update_meters (); -} - void MonitorSection::setup_knob_images () { try { - big_knob_pixbuf = ::get_icon ("knob"); - + 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 (); } -} - -void -MonitorSection::gain_value_changed () -{ - _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); -} -void -MonitorSection::dim_level_changed () -{ - _monitor->set_dim_level (dim_adjustment.get_value()); -} - -void -MonitorSection::solo_boost_changed () -{ - _monitor->set_solo_boost_level (solo_boost_adjustment.get_value()); + if (!little_knob_pixbuf) { + error << "No usable small knob image" << endmsg; + throw failed_constructor (); + } + } bool @@ -691,13 +790,10 @@ MonitorSection::linear_gain_printer (SpinButton* button) } void -MonitorSection::map_state () +MonitorSection::update_solo_model () { - 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()); - - const char *action_name; + const char* action_name; + Glib::RefPtr act; if (Config->get_solo_control_is_listen_control()) { switch (Config->get_listen_position()) { @@ -705,14 +801,14 @@ MonitorSection::map_state () action_name = X_("solo-use-afl"); break; case PreFaderListen: - action_name = X_("solo-use-afl"); + action_name = X_("solo-use-pfl"); break; } } else { action_name = X_("solo-use-in-place"); } - - Glib::RefPtr act = ActionManager::get_action (X_("Solo"), action_name); + + act = ActionManager::get_action (X_("Solo"), action_name); if (act) { Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); if (ract) { @@ -721,6 +817,117 @@ MonitorSection::map_state () } } +void +MonitorSection::map_state () +{ + if (!_route || !_monitor) { + 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) { + tact->set_active (_monitor->cut_all()); + } + } + + act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->dim_all()); + } + } + + act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->mono()); + } + } + + uint32_t nchans = _monitor->output_streams().n_audio(); + + assert (nchans == _channel_buttons.size ()); + + for (uint32_t n = 0; n < nchans; ++n) { + + char action_name[32]; + + snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1); + act = ActionManager::get_action (X_("Monitor"), action_name); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->cut (n)); + } + } + + snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1); + act = ActionManager::get_action (X_("Monitor"), action_name); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->dimmed (n)); + } + } + + snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1); + act = ActionManager::get_action (X_("Monitor"), action_name); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->soloed (n)); + } + } + + snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1); + act = ActionManager::get_action (X_("Monitor"), action_name); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact) { + tact->set_active (_monitor->inverted (n)); + } + } + } +} + +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) { @@ -734,18 +941,115 @@ 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_active (false); rude_solo_button.set_state (STATE_NORMAL); + rude_iso_button.set_active (false); } } bool -MonitorSection::cancel_solo (GdkEventButton* ev) +MonitorSection::cancel_solo (GdkEventButton*) +{ + if (_session) { + if (_session->soloing()) { + _session->set_solo (_session->get_routes(), false); + } else if (_session->listening()) { + _session->set_listen (_session->get_routes(), false); + } + } + + return true; +} + +bool +MonitorSection::cancel_isolate (GdkEventButton*) { - if (_session && _session->soloing()) { - _session->set_solo (_session->get_routes(), false); + 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*) +{ + if (_session) { + _session->cancel_audition(); + } + return true; +} + +void +MonitorSection::solo_cut_changed () +{ + Config->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment.get_value())); +} + +void +MonitorSection::parameter_changed (std::string name) +{ + if (name == "solo-control-is-listen-control" || + 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())); + } +} + +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); + } +}