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_audition_button (_("auditioning"))
55 , exclusive_solo_button (_("Exclusive"))
56 , solo_mute_override_button (_("Solo/Mute"))
58 Glib::RefPtr<Action> act;
60 if (!monitor_actions) {
62 /* do some static stuff */
75 dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, false, 30, 30);
77 HBox* dim_packer = manage (new HBox);
80 spin_label = manage (new Label (_("Dim Cut")));
81 spin_packer = manage (new VBox);
83 spin_packer->set_spacing (6);
84 spin_packer->pack_start (*dim_control, false, false);
85 spin_packer->pack_start (*spin_label, false, false);
87 dim_packer->set_spacing (12);
88 dim_packer->pack_start (*spin_packer, true, true);
92 rude_solo_button.set_name ("TransportSoloAlert");
93 rude_solo_button.show ();
95 rude_audition_button.set_name ("TransportAuditioningAlert");
96 rude_audition_button.show ();
98 ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
100 rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false);
101 UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
103 rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition), false);
104 UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
106 solo_model_box.set_spacing (6);
107 solo_model_box.pack_start (solo_in_place_button, false, false);
108 solo_model_box.pack_start (afl_button, false, false);
109 solo_model_box.pack_start (pfl_button, false, false);
111 solo_in_place_button.show ();
114 solo_model_box.show ();
116 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
118 act->connect_proxy (solo_in_place_button);
121 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
123 act->connect_proxy (afl_button);
126 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
128 act->connect_proxy (pfl_button);
133 solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, false, 30, 30);
135 HBox* solo_packer = manage (new HBox);
136 solo_packer->set_spacing (12);
137 solo_packer->show ();
139 spin_label = manage (new Label (_("Solo Boost")));
140 spin_packer = manage (new VBox);
141 spin_packer->show ();
142 spin_packer->set_spacing (6);
143 spin_packer->pack_start (*solo_boost_control, false, false);
144 spin_packer->pack_start (*spin_label, false, false);
146 solo_packer->pack_start (*spin_packer, true, true);
150 solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30);
152 spin_label = manage (new Label (_("SiP Cut")));
153 spin_packer = manage (new VBox);
154 spin_packer->show ();
155 spin_packer->set_spacing (6);
156 spin_packer->pack_start (*solo_cut_control, false, false);
157 spin_packer->pack_start (*spin_label, false, false);
159 solo_packer->pack_start (*spin_packer, true, true);
161 exclusive_solo_button.set_name (X_("MonitorOptButton"));
162 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
164 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
166 act->connect_proxy (exclusive_solo_button);
169 solo_mute_override_button.set_name (X_("MonitorOptButton"));
170 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)"));
172 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
174 act->connect_proxy (solo_mute_override_button);
177 HBox* solo_opt_box = manage (new HBox);
178 solo_opt_box->set_spacing (12);
179 solo_opt_box->set_homogeneous (true);
180 solo_opt_box->pack_start (exclusive_solo_button);
181 solo_opt_box->pack_start (solo_mute_override_button);
182 solo_opt_box->show ();
184 upper_packer.set_spacing (12);
185 upper_packer.pack_start (rude_solo_button, false, false);
186 upper_packer.pack_start (rude_audition_button, false, false);
187 upper_packer.pack_start (solo_model_box, false, false);
188 upper_packer.pack_start (*solo_opt_box, false, false);
189 upper_packer.pack_start (*solo_packer, false, false);
191 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
193 act->connect_proxy (cut_all_button);
196 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
198 act->connect_proxy (dim_all_button);
201 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
203 act->connect_proxy (mono_button);
206 cut_all_button.set_name (X_("MonitorMuteButton"));
207 cut_all_button.unset_flags (Gtk::CAN_FOCUS);
208 cut_all_button.set_size_request (50,50);
209 cut_all_button.show ();
211 HBox* bbox = manage (new HBox);
213 bbox->set_spacing (12);
214 bbox->pack_start (mono_button, true, true);
215 bbox->pack_start (dim_all_button, true, true);
217 dim_all_button.set_name (X_("MonitorDimButton"));
218 dim_all_button.unset_flags (Gtk::CAN_FOCUS);
219 mono_button.set_name (X_("MonitorMonoButton"));
220 mono_button.unset_flags (Gtk::CAN_FOCUS);
222 lower_packer.set_spacing (12);
223 lower_packer.pack_start (*bbox, false, false);
224 lower_packer.pack_start (cut_all_button, false, false);
228 gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, false, 80, 80);
230 spin_label = manage (new Label (_("Gain")));
231 spin_packer = manage (new VBox);
232 spin_packer->show ();
233 spin_packer->set_spacing (6);
234 spin_packer->pack_start (*gain_control, false, false);
235 spin_packer->pack_start (*spin_label, false, false);
237 lower_packer.pack_start (*spin_packer, true, true);
239 vpacker.set_border_width (12);
240 vpacker.set_spacing (12);
241 vpacker.pack_start (upper_packer, false, false);
242 vpacker.pack_start (*dim_packer, false, false);
243 vpacker.pack_start (main_table, false, false);
244 vpacker.pack_start (lower_packer, false, false);
246 hpacker.set_border_width (12);
247 hpacker.set_spacing (12);
248 hpacker.pack_start (vpacker, true, true);
250 gain_control->show_all ();
251 dim_control->show_all ();
252 solo_boost_control->show_all ();
256 upper_packer.show ();
257 lower_packer.show ();
262 assign_controllables ();
264 _tearoff = new TearOff (hpacker);
266 /* if torn off, make this a normal window */
267 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
268 _tearoff->tearoff_window().set_title (X_("Monitor"));
269 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
271 /* catch changes that affect us */
273 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
276 MonitorSection::~MonitorSection ()
278 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
282 _channel_buttons.clear ();
286 delete solo_boost_control;
291 MonitorSection::set_session (Session* s)
293 AxisView::set_session (s);
297 _route = _session->monitor_out ();
300 /* session with control outs */
301 _monitor = _route->monitor_control ();
302 assign_controllables ();
304 /* session with no control outs */
314 control_connections.drop_connections ();
317 /* both might be null */
320 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
326 cut.set_name (X_("MonitorMuteButton"));
327 dim.set_name (X_("MonitorDimButton"));
328 solo.set_name (X_("MixerSoloButton"));
329 invert.set_name (X_("MonitorInvertButton"));
331 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false);
332 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false);
333 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false);
334 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false);
336 cut.unset_flags (Gtk::CAN_FOCUS);
337 dim.unset_flags (Gtk::CAN_FOCUS);
338 solo.unset_flags (Gtk::CAN_FOCUS);
339 invert.unset_flags (Gtk::CAN_FOCUS);
343 MonitorSection::populate_buttons ()
349 Glib::RefPtr<Action> act;
350 uint32_t nchans = _monitor->output_streams().n_audio();
352 main_table.resize (nchans+1, 5);
353 main_table.set_col_spacings (6);
354 main_table.set_row_spacings (6);
355 main_table.set_homogeneous (true);
357 Label* l1 = manage (new Label (X_("out")));
358 main_table.attach (*l1, 0, 1, 0, 1, SHRINK|FILL, SHRINK|FILL);
359 l1 = manage (new Label (X_("cut")));
360 main_table.attach (*l1, 1, 2, 0, 1, SHRINK|FILL, SHRINK|FILL);
361 l1 = manage (new Label (X_("dim")));
362 main_table.attach (*l1, 2, 3, 0, 1, SHRINK|FILL, SHRINK|FILL);
363 l1 = manage (new Label (X_("solo")));
364 main_table.attach (*l1, 3, 4, 0, 1, SHRINK|FILL, SHRINK|FILL);
365 l1 = manage (new Label (X_("inv")));
366 main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL);
368 const uint32_t row_offset = 1;
370 for (uint32_t i = 0; i < nchans; ++i) {
383 snprintf (buf, sizeof (buf), "%d", i+1);
387 Label* label = manage (new Label (l));
388 main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
390 ChannelButtonSet* cbs = new ChannelButtonSet;
392 _channel_buttons.push_back (cbs);
394 main_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
395 main_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
396 main_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
397 main_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
399 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
400 act = ActionManager::get_action (X_("Monitor"), buf);
402 act->connect_proxy (cbs->cut);
405 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
406 act = ActionManager::get_action (X_("Monitor"), buf);
408 act->connect_proxy (cbs->dim);
411 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
412 act = ActionManager::get_action (X_("Monitor"), buf);
414 act->connect_proxy (cbs->solo);
417 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
418 act = ActionManager::get_action (X_("Monitor"), buf);
420 act->connect_proxy (cbs->invert);
424 main_table.show_all ();
428 MonitorSection::set_button_names ()
430 rec_enable_button_label.set_text ("rec");
431 mute_button_label.set_text ("rec");
432 solo_button_label.set_text ("rec");
436 MonitorSection::toggle_exclusive_solo ()
442 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
444 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
445 Config->set_exclusive_solo (tact->get_active());
452 MonitorSection::toggle_mute_overrides_solo ()
458 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
460 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
461 Config->set_solo_mute_override (tact->get_active());
466 MonitorSection::dim_all ()
472 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
474 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
475 _monitor->set_dim_all (tact->get_active());
481 MonitorSection::cut_all ()
487 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
489 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
490 _monitor->set_cut_all (tact->get_active());
495 MonitorSection::mono ()
501 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
503 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
504 _monitor->set_mono (tact->get_active());
509 MonitorSection::cut_channel (uint32_t chn)
516 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
518 --chn; // 0-based in backend
520 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
522 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
523 _monitor->set_cut (chn, tact->get_active());
528 MonitorSection::dim_channel (uint32_t chn)
535 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
537 --chn; // 0-based in backend
539 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
541 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
542 _monitor->set_dim (chn, tact->get_active());
548 MonitorSection::solo_channel (uint32_t chn)
555 snprintf (buf, sizeof (buf), "monitor-solo-%u", chn);
557 --chn; // 0-based in backend
559 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
561 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
562 _monitor->set_solo (chn, tact->get_active());
568 MonitorSection::invert_channel (uint32_t chn)
575 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
577 --chn; // 0-based in backend
579 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
581 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
582 _monitor->set_polarity (chn, tact->get_active());
587 MonitorSection::register_actions ()
591 Glib::RefPtr<Action> act;
593 monitor_actions = ActionGroup::create (X_("Monitor"));
594 ActionManager::add_action_group (monitor_actions);
596 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "",
597 sigc::mem_fun (*this, &MonitorSection::mono));
599 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "",
600 sigc::mem_fun (*this, &MonitorSection::cut_all));
602 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "",
603 sigc::mem_fun (*this, &MonitorSection::dim_all));
605 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "",
606 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
608 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
609 tact->set_active (Config->get_exclusive_solo());
611 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "",
612 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
614 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
615 tact->set_active (Config->get_solo_mute_override());
617 /* map from RC config */
621 /* note the 1-based counting (for naming - backend uses 0-based) */
623 for (uint32_t chn = 1; chn <= 16; ++chn) {
625 /* for the time being, do not use the action description because it always
626 shows up in the buttons, which is undesirable.
629 action_name = string_compose (X_("monitor-cut-%1"), chn);
630 action_descr = string_compose (_("Cut Monitor Chn %1"), chn);
631 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
632 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
634 action_name = string_compose (X_("monitor-dim-%1"), chn);
635 action_descr = string_compose (_("Dim Monitor Chn %1"), chn+1);
636 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
637 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
639 action_name = string_compose (X_("monitor-solo-%1"), chn);
640 action_descr = string_compose (_("Solo Monitor Chn %1"), chn);
641 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
642 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
644 action_name = string_compose (X_("monitor-invert-%1"), chn);
645 action_descr = string_compose (_("Invert Monitor Chn %1"), chn);
646 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "",
647 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
652 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
653 RadioAction::Group solo_group;
655 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "",
656 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
657 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "",
658 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
659 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "",
660 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
662 ActionManager::add_action_group (solo_actions);
666 MonitorSection::solo_use_in_place ()
668 /* this is driven by a toggle on a radio group, and so is invoked twice,
669 once for the item that became inactive and once for the one that became
673 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
676 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
678 Config->set_solo_control_is_listen_control (!ract->get_active());
684 MonitorSection::solo_use_afl ()
686 /* this is driven by a toggle on a radio group, and so is invoked twice,
687 once for the item that became inactive and once for the one that became
691 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
693 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
695 if (ract->get_active()) {
696 Config->set_listen_position (AfterFaderListen);
697 Config->set_solo_control_is_listen_control (true);
704 MonitorSection::solo_use_pfl ()
706 /* this is driven by a toggle on a radio group, and so is invoked twice,
707 once for the item that became inactive and once for the one that became
711 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
713 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
715 if (ract->get_active()) {
716 Config->set_listen_position (PreFaderListen);
717 Config->set_solo_control_is_listen_control (true);
724 MonitorSection::setup_knob_images ()
728 big_knob_pixbuf = ::get_icon ("bigknob");
732 error << "No knob image found (or not loadable) at "
735 throw failed_constructor ();
740 little_knob_pixbuf = ::get_icon ("littleknob");
744 error << "No knob image found (or not loadable) at "
747 throw failed_constructor ();
752 MonitorSection::nonlinear_gain_printer (SpinButton* button)
754 double val = button->get_adjustment()->get_value();
756 snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (val)));
757 button->set_text (buf);
762 MonitorSection::linear_gain_printer (SpinButton* button)
764 double val = button->get_adjustment()->get_value();
766 snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (val));
767 button->set_text (buf);
772 MonitorSection::update_solo_model ()
774 const char* action_name;
775 Glib::RefPtr<Action> act;
777 if (Config->get_solo_control_is_listen_control()) {
778 switch (Config->get_listen_position()) {
779 case AfterFaderListen:
780 action_name = X_("solo-use-afl");
783 action_name = X_("solo-use-pfl");
787 action_name = X_("solo-use-in-place");
790 act = ActionManager::get_action (X_("Solo"), action_name);
792 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
794 ract->set_active (true);
800 MonitorSection::map_state ()
802 if (!_route || !_monitor) {
806 gain_control->get_adjustment()->set_value (gain_to_slider_position (_route->gain_control()->get_value()));
807 dim_control->get_adjustment()->set_value (_monitor->dim_level());
808 solo_boost_control->get_adjustment()->set_value (_monitor->solo_boost_level());
810 Glib::RefPtr<Action> act;
812 update_solo_model ();
814 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
816 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
818 tact->set_active (_monitor->cut_all());
822 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
824 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
826 tact->set_active (_monitor->dim_all());
830 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
832 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
834 tact->set_active (_monitor->mono());
838 uint32_t nchans = _monitor->output_streams().n_audio();
840 assert (nchans == _channel_buttons.size ());
842 for (uint32_t n = 0; n < nchans; ++n) {
844 char action_name[32];
846 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
847 act = ActionManager::get_action (X_("Monitor"), action_name);
849 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
851 tact->set_active (_monitor->cut (n));
855 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
856 act = ActionManager::get_action (X_("Monitor"), action_name);
858 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
860 tact->set_active (_monitor->dimmed (n));
864 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
865 act = ActionManager::get_action (X_("Monitor"), action_name);
867 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
869 tact->set_active (_monitor->soloed (n));
873 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
874 act = ActionManager::get_action (X_("Monitor"), action_name);
876 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
878 tact->set_active (_monitor->inverted (n));
885 MonitorSection::do_blink (bool onoff)
888 audition_blink (onoff);
892 MonitorSection::audition_blink (bool onoff)
898 if (_session->is_auditioning()) {
900 rude_audition_button.set_state (STATE_ACTIVE);
902 rude_audition_button.set_state (STATE_NORMAL);
905 rude_audition_button.set_active (false);
906 rude_audition_button.set_state (STATE_NORMAL);
911 MonitorSection::solo_blink (bool onoff)
917 if (_session->soloing() || _session->listening()) {
919 rude_solo_button.set_state (STATE_ACTIVE);
921 rude_solo_button.set_state (STATE_NORMAL);
924 // rude_solo_button.set_active (false);
925 rude_solo_button.set_state (STATE_NORMAL);
930 MonitorSection::cancel_solo (GdkEventButton* ev)
933 if (_session->soloing()) {
934 _session->set_solo (_session->get_routes(), false);
935 } else if (_session->listening()) {
936 _session->set_listen (_session->get_routes(), false);
944 MonitorSection::cancel_audition (GdkEventButton* ev)
947 _session->cancel_audition();
953 MonitorSection::solo_cut_changed ()
955 Config->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment.get_value()));
959 MonitorSection::parameter_changed (std::string name)
961 if (name == "solo-control-is-listen-control" ||
962 name == "listen-position") {
963 update_solo_model ();
964 } else if (name == "solo-mute-gain") {
965 solo_cut_adjustment.set_value (gain_to_slider_position (Config->get_solo_mute_gain()));
970 MonitorSection::assign_controllables ()
972 boost::shared_ptr<Controllable> none;
975 /* too early - GUI controls not set up yet */
980 gain_control->set_controllable (_route->gain_control());
981 control_link (control_connections, _route->gain_control(), gain_adjustment);
983 gain_control->set_controllable (none);
988 cut_all_button.set_controllable (_monitor->cut_control());
989 cut_all_button.watch ();
990 dim_all_button.set_controllable (_monitor->dim_control());
991 dim_all_button.watch ();
992 mono_button.set_controllable (_monitor->mono_control());
993 mono_button.watch ();
995 boost::shared_ptr<Controllable> c (_monitor->dim_level_control ());
997 dim_control->set_controllable (c);
998 dim_adjustment.set_lower (c->lower());
999 dim_adjustment.set_upper (c->upper());
1000 control_link (control_connections, c, dim_adjustment);
1002 c = _monitor->solo_boost_control ();
1003 solo_boost_control->set_controllable (c);
1004 solo_boost_adjustment.set_lower (c->lower());
1005 solo_boost_adjustment.set_upper (c->upper());
1006 control_link (control_connections, c, solo_boost_adjustment);
1010 cut_all_button.set_controllable (none);
1011 dim_all_button.set_controllable (none);
1012 mono_button.set_controllable (none);
1014 dim_control->set_controllable (none);
1015 solo_boost_control->set_controllable (none);