1 #include <gdkmm/pixbuf.h>
3 #include "pbd/compose.h"
6 #include "gtkmm2ext/bindable_button.h"
7 #include "gtkmm2ext/tearoff.h"
8 #include "gtkmm2ext/actions.h"
10 #include "ardour/dB.h"
11 #include "ardour/monitor_processor.h"
12 #include "ardour/route.h"
13 #include "ardour/utils.h"
15 #include "ardour_ui.h"
16 #include "gui_thread.h"
17 #include "monitor_section.h"
18 #include "public_editor.h"
20 #include "volume_controller.h"
24 using namespace ARDOUR;
26 using namespace Gtkmm2ext;
30 Glib::RefPtr<ActionGroup> MonitorSection::monitor_actions;
31 Glib::RefPtr<Gdk::Pixbuf> MonitorSection::big_knob_pixbuf;
32 Glib::RefPtr<Gdk::Pixbuf> MonitorSection::little_knob_pixbuf;
34 MonitorSection::MonitorSection (Session* s)
39 , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // initial value is unity gain
41 , dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1) // upper+lower will be reset to match model
43 , solo_boost_adjustment (1.0, 1.0, 3.0, 0.01, 0.1) // upper and lower will be reset to match model
44 , solo_boost_control (0)
45 , solo_cut_adjustment (0.0, 0.0, 1.0, 0.01, 0.1) // upper and lower will be reset to match model
46 , solo_cut_control (0)
47 , solo_in_place_button (solo_model_group, _("SiP"))
48 , afl_button (solo_model_group, _("AFL"))
49 , pfl_button (solo_model_group, _("PFL"))
50 , cut_all_button (_("MUTE"))
51 , dim_all_button (_("dim"))
52 , mono_button (_("mono"))
53 , rude_solo_button (_("soloing"))
54 , rude_iso_button (_("isolated"))
55 , rude_audition_button (_("auditioning"))
56 , exclusive_solo_button (_("Exclusive"))
57 , solo_mute_override_button (_("Solo/Mute"))
59 Glib::RefPtr<Action> act;
61 if (!monitor_actions) {
63 /* do some static stuff */
76 dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, false, 30, 30);
78 HBox* dim_packer = manage (new HBox);
81 spin_label = manage (new Label (_("Dim Cut")));
82 spin_packer = manage (new VBox);
84 spin_packer->set_spacing (6);
85 spin_packer->pack_start (*dim_control, false, false);
86 spin_packer->pack_start (*spin_label, false, false);
88 dim_packer->set_spacing (12);
89 dim_packer->pack_start (*spin_packer, true, true);
93 rude_solo_button.set_name ("TransportSoloAlert");
94 rude_solo_button.show ();
96 rude_iso_button.set_name ("MonitorIsoAlert");
97 rude_iso_button.show ();
99 rude_audition_button.set_name ("TransportAuditioningAlert");
100 rude_audition_button.show ();
102 ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
104 rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false);
105 UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
107 rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false);
108 UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
110 rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition), false);
111 UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
113 solo_model_box.set_spacing (6);
114 solo_model_box.pack_start (solo_in_place_button, false, false);
115 solo_model_box.pack_start (afl_button, false, false);
116 solo_model_box.pack_start (pfl_button, false, false);
118 solo_in_place_button.show ();
121 solo_model_box.show ();
123 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
125 act->connect_proxy (solo_in_place_button);
128 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
130 act->connect_proxy (afl_button);
133 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
135 act->connect_proxy (pfl_button);
140 solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, false, 30, 30);
142 HBox* solo_packer = manage (new HBox);
143 solo_packer->set_spacing (12);
144 solo_packer->show ();
146 spin_label = manage (new Label (_("Solo Boost")));
147 spin_packer = manage (new VBox);
148 spin_packer->show ();
149 spin_packer->set_spacing (6);
150 spin_packer->pack_start (*solo_boost_control, false, false);
151 spin_packer->pack_start (*spin_label, false, false);
153 solo_packer->pack_start (*spin_packer, true, true);
157 solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30);
159 spin_label = manage (new Label (_("SiP Cut")));
160 spin_packer = manage (new VBox);
161 spin_packer->show ();
162 spin_packer->set_spacing (6);
163 spin_packer->pack_start (*solo_cut_control, false, false);
164 spin_packer->pack_start (*spin_label, false, false);
166 solo_packer->pack_start (*spin_packer, true, true);
168 exclusive_solo_button.set_name (X_("MonitorOptButton"));
169 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
171 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
173 act->connect_proxy (exclusive_solo_button);
176 solo_mute_override_button.set_name (X_("MonitorOptButton"));
177 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)"));
179 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
181 act->connect_proxy (solo_mute_override_button);
184 HBox* solo_opt_box = manage (new HBox);
185 solo_opt_box->set_spacing (12);
186 solo_opt_box->set_homogeneous (true);
187 solo_opt_box->pack_start (exclusive_solo_button);
188 solo_opt_box->pack_start (solo_mute_override_button);
189 solo_opt_box->show ();
191 upper_packer.set_spacing (12);
193 Gtk::HBox* rude_box = manage (new HBox);
194 rude_box->pack_start (rude_solo_button, true, true);
195 rude_box->pack_start (rude_iso_button, true, true);
197 upper_packer.pack_start (*rude_box, false, false);
198 upper_packer.pack_start (rude_audition_button, false, false);
199 upper_packer.pack_start (solo_model_box, false, false);
200 upper_packer.pack_start (*solo_opt_box, false, false);
201 upper_packer.pack_start (*solo_packer, false, false);
203 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
205 act->connect_proxy (cut_all_button);
208 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
210 act->connect_proxy (dim_all_button);
213 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
215 act->connect_proxy (mono_button);
218 cut_all_button.set_name (X_("MonitorMuteButton"));
219 cut_all_button.unset_flags (Gtk::CAN_FOCUS);
220 cut_all_button.set_size_request (50,50);
221 cut_all_button.show ();
223 HBox* bbox = manage (new HBox);
225 bbox->set_spacing (12);
226 bbox->pack_start (mono_button, true, true);
227 bbox->pack_start (dim_all_button, true, true);
229 dim_all_button.set_name (X_("MonitorDimButton"));
230 dim_all_button.unset_flags (Gtk::CAN_FOCUS);
231 mono_button.set_name (X_("MonitorMonoButton"));
232 mono_button.unset_flags (Gtk::CAN_FOCUS);
234 lower_packer.set_spacing (12);
235 lower_packer.pack_start (*bbox, false, false);
236 lower_packer.pack_start (cut_all_button, false, false);
240 gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, false, 80, 80);
242 spin_label = manage (new Label (_("Gain")));
243 spin_packer = manage (new VBox);
244 spin_packer->show ();
245 spin_packer->set_spacing (6);
246 spin_packer->pack_start (*gain_control, false, false);
247 spin_packer->pack_start (*spin_label, false, false);
249 lower_packer.pack_start (*spin_packer, true, true);
251 vpacker.set_border_width (12);
252 vpacker.set_spacing (12);
253 vpacker.pack_start (upper_packer, false, false);
254 vpacker.pack_start (*dim_packer, false, false);
255 vpacker.pack_start (main_table, false, false);
256 vpacker.pack_start (lower_packer, false, false);
258 hpacker.set_border_width (12);
259 hpacker.set_spacing (12);
260 hpacker.pack_start (vpacker, true, true);
262 gain_control->show_all ();
263 dim_control->show_all ();
264 solo_boost_control->show_all ();
268 upper_packer.show ();
269 lower_packer.show ();
274 assign_controllables ();
276 _tearoff = new TearOff (hpacker);
278 /* if torn off, make this a normal window */
279 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
280 _tearoff->tearoff_window().set_title (X_("Monitor"));
281 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
283 /* catch changes that affect us */
285 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
288 MonitorSection::~MonitorSection ()
290 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
294 _channel_buttons.clear ();
298 delete solo_boost_control;
303 MonitorSection::set_session (Session* s)
305 AxisView::set_session (s);
309 _route = _session->monitor_out ();
312 /* session with control outs */
313 _monitor = _route->monitor_control ();
314 assign_controllables ();
316 /* session with no control outs */
325 control_connections.drop_connections ();
326 rude_iso_button.set_active (false);
327 rude_solo_button.set_active (false);
330 /* both might be null */
333 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
339 cut.set_name (X_("MonitorMuteButton"));
340 dim.set_name (X_("MonitorDimButton"));
341 solo.set_name (X_("MixerSoloButton"));
342 invert.set_name (X_("MonitorInvertButton"));
344 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false);
345 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false);
346 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false);
347 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false);
349 cut.unset_flags (Gtk::CAN_FOCUS);
350 dim.unset_flags (Gtk::CAN_FOCUS);
351 solo.unset_flags (Gtk::CAN_FOCUS);
352 invert.unset_flags (Gtk::CAN_FOCUS);
356 MonitorSection::populate_buttons ()
362 Glib::RefPtr<Action> act;
363 uint32_t nchans = _monitor->output_streams().n_audio();
365 main_table.resize (nchans+1, 5);
366 main_table.set_col_spacings (6);
367 main_table.set_row_spacings (6);
368 main_table.set_homogeneous (true);
370 Label* l1 = manage (new Label (X_("out")));
371 main_table.attach (*l1, 0, 1, 0, 1, SHRINK|FILL, SHRINK|FILL);
372 l1 = manage (new Label (X_("cut")));
373 main_table.attach (*l1, 1, 2, 0, 1, SHRINK|FILL, SHRINK|FILL);
374 l1 = manage (new Label (X_("dim")));
375 main_table.attach (*l1, 2, 3, 0, 1, SHRINK|FILL, SHRINK|FILL);
376 l1 = manage (new Label (X_("solo")));
377 main_table.attach (*l1, 3, 4, 0, 1, SHRINK|FILL, SHRINK|FILL);
378 l1 = manage (new Label (X_("inv")));
379 main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL);
381 const uint32_t row_offset = 1;
383 for (uint32_t i = 0; i < nchans; ++i) {
396 snprintf (buf, sizeof (buf), "%d", i+1);
400 Label* label = manage (new Label (l));
401 main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
403 ChannelButtonSet* cbs = new ChannelButtonSet;
405 _channel_buttons.push_back (cbs);
407 main_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
408 main_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
409 main_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
410 main_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
412 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
413 act = ActionManager::get_action (X_("Monitor"), buf);
415 act->connect_proxy (cbs->cut);
418 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
419 act = ActionManager::get_action (X_("Monitor"), buf);
421 act->connect_proxy (cbs->dim);
424 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
425 act = ActionManager::get_action (X_("Monitor"), buf);
427 act->connect_proxy (cbs->solo);
430 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
431 act = ActionManager::get_action (X_("Monitor"), buf);
433 act->connect_proxy (cbs->invert);
437 main_table.show_all ();
441 MonitorSection::set_button_names ()
443 rec_enable_button_label.set_text ("rec");
444 mute_button_label.set_text ("rec");
445 solo_button_label.set_text ("rec");
449 MonitorSection::toggle_exclusive_solo ()
455 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
457 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
458 Config->set_exclusive_solo (tact->get_active());
465 MonitorSection::toggle_mute_overrides_solo ()
471 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
473 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
474 Config->set_solo_mute_override (tact->get_active());
479 MonitorSection::dim_all ()
485 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
487 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
488 _monitor->set_dim_all (tact->get_active());
494 MonitorSection::cut_all ()
500 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
502 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
503 _monitor->set_cut_all (tact->get_active());
508 MonitorSection::mono ()
514 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
516 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
517 _monitor->set_mono (tact->get_active());
522 MonitorSection::cut_channel (uint32_t chn)
529 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
531 --chn; // 0-based in backend
533 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
535 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
536 _monitor->set_cut (chn, tact->get_active());
541 MonitorSection::dim_channel (uint32_t chn)
548 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
550 --chn; // 0-based in backend
552 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
554 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
555 _monitor->set_dim (chn, tact->get_active());
561 MonitorSection::solo_channel (uint32_t chn)
568 snprintf (buf, sizeof (buf), "monitor-solo-%u", chn);
570 --chn; // 0-based in backend
572 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
574 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
575 _monitor->set_solo (chn, tact->get_active());
581 MonitorSection::invert_channel (uint32_t chn)
588 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
590 --chn; // 0-based in backend
592 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
594 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
595 _monitor->set_polarity (chn, tact->get_active());
600 MonitorSection::register_actions ()
604 Glib::RefPtr<Action> act;
606 monitor_actions = ActionGroup::create (X_("Monitor"));
607 ActionManager::add_action_group (monitor_actions);
609 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "",
610 sigc::mem_fun (*this, &MonitorSection::mono));
612 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "",
613 sigc::mem_fun (*this, &MonitorSection::cut_all));
615 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "",
616 sigc::mem_fun (*this, &MonitorSection::dim_all));
618 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "",
619 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
621 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
622 tact->set_active (Config->get_exclusive_solo());
624 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "",
625 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
627 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
628 tact->set_active (Config->get_solo_mute_override());
630 /* map from RC config */
634 /* note the 1-based counting (for naming - backend uses 0-based) */
636 for (uint32_t chn = 1; chn <= 16; ++chn) {
638 /* for the time being, do not use the action description because it always
639 shows up in the buttons, which is undesirable.
642 action_name = string_compose (X_("monitor-cut-%1"), chn);
643 action_descr = string_compose (_("Cut Monitor Chn %1"), chn);
644 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
645 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
647 action_name = string_compose (X_("monitor-dim-%1"), chn);
648 action_descr = string_compose (_("Dim Monitor Chn %1"), chn+1);
649 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
650 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
652 action_name = string_compose (X_("monitor-solo-%1"), chn);
653 action_descr = string_compose (_("Solo Monitor Chn %1"), chn);
654 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
655 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
657 action_name = string_compose (X_("monitor-invert-%1"), chn);
658 action_descr = string_compose (_("Invert Monitor Chn %1"), chn);
659 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
660 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
665 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
666 RadioAction::Group solo_group;
668 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "",
669 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
670 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "",
671 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
672 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "",
673 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
675 ActionManager::add_action_group (solo_actions);
679 MonitorSection::solo_use_in_place ()
681 /* this is driven by a toggle on a radio group, and so is invoked twice,
682 once for the item that became inactive and once for the one that became
686 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
689 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
691 Config->set_solo_control_is_listen_control (!ract->get_active());
697 MonitorSection::solo_use_afl ()
699 /* this is driven by a toggle on a radio group, and so is invoked twice,
700 once for the item that became inactive and once for the one that became
704 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
706 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
708 if (ract->get_active()) {
709 Config->set_listen_position (AfterFaderListen);
710 Config->set_solo_control_is_listen_control (true);
717 MonitorSection::solo_use_pfl ()
719 /* this is driven by a toggle on a radio group, and so is invoked twice,
720 once for the item that became inactive and once for the one that became
724 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
726 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
728 if (ract->get_active()) {
729 Config->set_listen_position (PreFaderListen);
730 Config->set_solo_control_is_listen_control (true);
737 MonitorSection::setup_knob_images ()
741 big_knob_pixbuf = ::get_icon ("bigknob");
745 error << "No knob image found (or not loadable) at "
748 throw failed_constructor ();
753 little_knob_pixbuf = ::get_icon ("littleknob");
757 error << "No knob image found (or not loadable) at "
760 throw failed_constructor ();
765 MonitorSection::nonlinear_gain_printer (SpinButton* button)
767 double val = button->get_adjustment()->get_value();
769 snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (val)));
770 button->set_text (buf);
775 MonitorSection::linear_gain_printer (SpinButton* button)
777 double val = button->get_adjustment()->get_value();
779 snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (val));
780 button->set_text (buf);
785 MonitorSection::update_solo_model ()
787 const char* action_name;
788 Glib::RefPtr<Action> act;
790 if (Config->get_solo_control_is_listen_control()) {
791 switch (Config->get_listen_position()) {
792 case AfterFaderListen:
793 action_name = X_("solo-use-afl");
796 action_name = X_("solo-use-pfl");
800 action_name = X_("solo-use-in-place");
803 act = ActionManager::get_action (X_("Solo"), action_name);
805 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
807 ract->set_active (true);
813 MonitorSection::map_state ()
815 if (!_route || !_monitor) {
819 gain_control->get_adjustment()->set_value (gain_to_slider_position (_route->gain_control()->get_value()));
820 dim_control->get_adjustment()->set_value (_monitor->dim_level());
821 solo_boost_control->get_adjustment()->set_value (_monitor->solo_boost_level());
823 Glib::RefPtr<Action> act;
825 update_solo_model ();
827 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
829 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
831 tact->set_active (_monitor->cut_all());
835 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
837 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
839 tact->set_active (_monitor->dim_all());
843 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
845 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
847 tact->set_active (_monitor->mono());
851 uint32_t nchans = _monitor->output_streams().n_audio();
853 assert (nchans == _channel_buttons.size ());
855 for (uint32_t n = 0; n < nchans; ++n) {
857 char action_name[32];
859 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
860 act = ActionManager::get_action (X_("Monitor"), action_name);
862 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
864 tact->set_active (_monitor->cut (n));
868 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
869 act = ActionManager::get_action (X_("Monitor"), action_name);
871 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
873 tact->set_active (_monitor->dimmed (n));
877 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
878 act = ActionManager::get_action (X_("Monitor"), action_name);
880 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
882 tact->set_active (_monitor->soloed (n));
886 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
887 act = ActionManager::get_action (X_("Monitor"), action_name);
889 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
891 tact->set_active (_monitor->inverted (n));
898 MonitorSection::do_blink (bool onoff)
901 audition_blink (onoff);
905 MonitorSection::audition_blink (bool onoff)
911 if (_session->is_auditioning()) {
913 rude_audition_button.set_state (STATE_ACTIVE);
915 rude_audition_button.set_state (STATE_NORMAL);
918 rude_audition_button.set_active (false);
919 rude_audition_button.set_state (STATE_NORMAL);
924 MonitorSection::solo_blink (bool onoff)
930 if (_session->soloing() || _session->listening()) {
932 rude_solo_button.set_state (STATE_ACTIVE);
934 rude_solo_button.set_state (STATE_NORMAL);
937 if (_session->soloing()) {
938 rude_iso_button.set_active (_session->solo_isolated());
942 // rude_solo_button.set_active (false);
943 rude_solo_button.set_state (STATE_NORMAL);
944 rude_iso_button.set_active (false);
949 MonitorSection::cancel_solo (GdkEventButton* ev)
952 if (_session->soloing()) {
953 _session->set_solo (_session->get_routes(), false);
954 } else if (_session->listening()) {
955 _session->set_listen (_session->get_routes(), false);
963 MonitorSection::cancel_isolate (GdkEventButton* ev)
966 boost::shared_ptr<RouteList> rl (_session->get_routes ());
967 _session->set_solo_isolated (rl, false, Session::rt_cleanup, true);
974 MonitorSection::cancel_audition (GdkEventButton* ev)
977 _session->cancel_audition();
983 MonitorSection::solo_cut_changed ()
985 Config->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment.get_value()));
989 MonitorSection::parameter_changed (std::string name)
991 if (name == "solo-control-is-listen-control" ||
992 name == "listen-position") {
993 update_solo_model ();
994 } else if (name == "solo-mute-gain") {
995 solo_cut_adjustment.set_value (gain_to_slider_position (Config->get_solo_mute_gain()));
1000 MonitorSection::assign_controllables ()
1002 boost::shared_ptr<Controllable> none;
1004 if (!gain_control) {
1005 /* too early - GUI controls not set up yet */
1010 gain_control->set_controllable (_route->gain_control());
1011 control_link (control_connections, _route->gain_control(), gain_adjustment);
1013 gain_control->set_controllable (none);
1018 cut_all_button.set_controllable (_monitor->cut_control());
1019 cut_all_button.watch ();
1020 dim_all_button.set_controllable (_monitor->dim_control());
1021 dim_all_button.watch ();
1022 mono_button.set_controllable (_monitor->mono_control());
1023 mono_button.watch ();
1025 boost::shared_ptr<Controllable> c (_monitor->dim_level_control ());
1027 dim_control->set_controllable (c);
1028 dim_adjustment.set_lower (c->lower());
1029 dim_adjustment.set_upper (c->upper());
1030 control_link (control_connections, c, dim_adjustment);
1032 c = _monitor->solo_boost_control ();
1033 solo_boost_control->set_controllable (c);
1034 solo_boost_adjustment.set_lower (c->lower());
1035 solo_boost_adjustment.set_upper (c->upper());
1036 control_link (control_connections, c, solo_boost_adjustment);
1040 cut_all_button.set_controllable (none);
1041 dim_all_button.set_controllable (none);
1042 mono_button.set_controllable (none);
1044 dim_control->set_controllable (none);
1045 solo_boost_control->set_controllable (none);