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"
9 #include "gtkmm2ext/motionfeedback.h"
11 #include "ardour/dB.h"
12 #include "ardour/monitor_processor.h"
13 #include "ardour/route.h"
14 #include "ardour/utils.h"
16 #include "ardour_ui.h"
17 #include "gui_thread.h"
18 #include "monitor_section.h"
19 #include "public_editor.h"
20 #include "volume_controller.h"
25 using namespace ARDOUR;
27 using namespace Gtkmm2ext;
31 Glib::RefPtr<ActionGroup> MonitorSection::monitor_actions;
32 Glib::RefPtr<Gdk::Pixbuf> MonitorSection::big_knob_pixbuf;
33 Glib::RefPtr<Gdk::Pixbuf> MonitorSection::little_knob_pixbuf;
35 MonitorSection::MonitorSection (Session* s)
41 , solo_boost_control (0)
42 , solo_cut_control (0)
43 , solo_in_place_button (solo_model_group, _("SiP"))
44 , afl_button (solo_model_group, _("AFL"))
45 , pfl_button (solo_model_group, _("PFL"))
46 , cut_all_button (ArdourButton::led_default_elements)
47 , dim_all_button (ArdourButton::led_default_elements)
48 , mono_button (ArdourButton::led_default_elements)
49 , exclusive_solo_button (ArdourButton::led_default_elements)
50 , solo_mute_override_button (ArdourButton::led_default_elements)
52 Glib::RefPtr<Action> act;
54 if (!monitor_actions) {
56 /* do some static stuff */
69 rude_solo_button.set_text (_("soloing"));
70 rude_solo_button.set_name ("rude solo");
71 rude_solo_button.show ();
73 rude_iso_button.set_text (_("isolated"));
74 rude_iso_button.set_name ("rude isolate");
75 rude_iso_button.show ();
77 rude_audition_button.set_text (_("auditioning"));
78 rude_audition_button.set_name ("rude audition");
79 rude_audition_button.show ();
81 ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
83 rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo));
84 UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
86 rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate));
87 UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
89 rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition));
90 UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
92 solo_model_box.set_spacing (6);
93 solo_model_box.pack_start (solo_in_place_button, true, false);
94 solo_model_box.pack_start (afl_button, true, false);
95 solo_model_box.pack_start (pfl_button, true, false);
97 solo_in_place_button.show ();
100 solo_model_box.show ();
102 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
103 ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place"));
105 act->connect_proxy (solo_in_place_button);
108 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
109 ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen"));
111 act->connect_proxy (afl_button);
114 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
115 ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen"));
117 act->connect_proxy (pfl_button);
122 solo_boost_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
123 ARDOUR_UI::instance()->tooltips().set_tip (*solo_boost_control, _("Gain increase for soloed signals (0dB is normal)"));
125 HBox* solo_packer = manage (new HBox);
126 solo_packer->set_spacing (6);
127 solo_packer->show ();
129 spin_label = manage (new Label (_("Solo Boost")));
130 spin_packer = manage (new VBox);
131 spin_packer->show ();
132 spin_packer->set_spacing (6);
133 spin_packer->pack_start (*solo_boost_control, false, false);
134 spin_packer->pack_start (*spin_label, false, false);
136 solo_packer->pack_start (*spin_packer, true, false);
140 solo_cut_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.1, 0.5, true, 30, 30, true);
141 ARDOUR_UI::instance()->tooltips().set_tip (*solo_cut_control, _("Gain reduction non-soloed signals\nA value above -inf dB causes \"solo-in-front\""));
143 spin_label = manage (new Label (_("SiP Cut")));
144 spin_packer = manage (new VBox);
145 spin_packer->show ();
146 spin_packer->set_spacing (6);
147 spin_packer->pack_start (*solo_cut_control, false, false);
148 spin_packer->pack_start (*spin_label, false, false);
150 solo_packer->pack_start (*spin_packer, true, false);
154 dim_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
155 ARDOUR_UI::instance()->tooltips().set_tip (*dim_control, _("Gain reduction to use when dimming monitor outputs"));
157 HBox* dim_packer = manage (new HBox);
160 spin_label = manage (new Label (_("Dim")));
161 spin_packer = manage (new VBox);
162 spin_packer->show ();
163 spin_packer->set_spacing (6);
164 spin_packer->pack_start (*dim_control, false, false);
165 spin_packer->pack_start (*spin_label, false, false);
167 dim_packer->pack_start (*spin_packer, true, false);
169 exclusive_solo_button.set_text (_("excl. solo"));
170 exclusive_solo_button.set_name (X_("monitor solo exclusive"));
171 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
173 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
175 exclusive_solo_button.set_related_action (act);
178 solo_mute_override_button.set_text (_("solo ยป mute"));
179 solo_mute_override_button.set_name (X_("monitor solo override"));
180 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)"));
182 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
184 solo_mute_override_button.set_related_action (act);
187 HBox* solo_opt_box = manage (new HBox);
188 solo_opt_box->set_spacing (12);
189 solo_opt_box->set_homogeneous (true);
190 solo_opt_box->pack_start (exclusive_solo_button);
191 solo_opt_box->pack_start (solo_mute_override_button);
192 solo_opt_box->show ();
194 upper_packer.set_spacing (6);
196 Gtk::HBox* rude_box = manage (new HBox);
197 rude_box->pack_start (rude_solo_button, true, true);
198 rude_box->pack_start (rude_iso_button, true, true);
200 upper_packer.pack_start (*rude_box, false, false);
201 upper_packer.pack_start (rude_audition_button, false, false);
202 upper_packer.pack_start (solo_model_box, false, false, 12);
203 upper_packer.pack_start (*solo_opt_box, false, false);
204 upper_packer.pack_start (*solo_packer, false, false, 12);
206 cut_all_button.set_text (_("mute"));
207 cut_all_button.set_name ("monitor section cut");
208 cut_all_button.set_name (X_("monitor section cut"));
209 cut_all_button.set_size_request (-1,50);
210 cut_all_button.show ();
212 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
214 cut_all_button.set_related_action (act);
217 dim_all_button.set_text (_("dim"));
218 dim_all_button.set_name ("monitor section dim");
219 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
221 dim_all_button.set_related_action (act);
224 mono_button.set_text (_("mono"));
225 mono_button.set_name ("monitor section mono");
226 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
228 mono_button.set_related_action (act);
231 HBox* bbox = manage (new HBox);
233 bbox->set_spacing (12);
234 bbox->pack_start (mono_button, true, true);
235 bbox->pack_start (dim_all_button, true, true);
237 lower_packer.set_spacing (12);
238 lower_packer.pack_start (*bbox, false, false);
239 lower_packer.pack_start (cut_all_button, false, false);
243 gain_control = new VolumeController (big_knob_pixbuf, boost::shared_ptr<Controllable>(), 1.0, 0.01, 0.1, true, 80, 80, false);
245 spin_label = manage (new Label (_("Monitor")));
246 spin_packer = manage (new VBox);
247 spin_packer->show ();
248 spin_packer->set_spacing (6);
249 spin_packer->pack_start (*gain_control, false, false);
250 spin_packer->pack_start (*spin_label, false, false);
252 lower_packer.pack_start (*spin_packer, true, true);
254 channel_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
255 channel_table_scroller.set_size_request (-1, 150);
256 channel_table_scroller.set_shadow_type (Gtk::SHADOW_NONE);
257 channel_table_scroller.show ();
259 channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
260 channel_size_group->add_widget (channel_table_header);
261 channel_size_group->add_widget (channel_table);
263 channel_table_header.resize (1, 5);
264 Label* l1 = manage (new Label (X_("out")));
265 l1->set_name (X_("MonitorSectionLabel"));
266 channel_table_header.attach (*l1, 0, 1, 0, 1, EXPAND|FILL);
267 l1 = manage (new Label (X_("cut")));
268 l1->set_name (X_("MonitorSectionLabel"));
269 channel_table_header.attach (*l1, 1, 2, 0, 1, EXPAND|FILL);
270 l1 = manage (new Label (X_("dim")));
271 l1->set_name (X_("MonitorSectionLabel"));
272 channel_table_header.attach (*l1, 2, 3, 0, 1, EXPAND|FILL);
273 l1 = manage (new Label (X_("solo")));
274 l1->set_name (X_("MonitorSectionLabel"));
275 channel_table_header.attach (*l1, 3, 4, 0, 1, EXPAND|FILL);
276 l1 = manage (new Label (X_("inv")));
277 l1->set_name (X_("MonitorSectionLabel"));
278 channel_table_header.attach (*l1, 4, 5, 0, 1, EXPAND|FILL);
279 channel_table_header.show ();
281 table_hpacker.pack_start (channel_table, true, true);
283 /* note that we don't pack the table_hpacker till later
286 vpacker.set_border_width (6);
287 vpacker.set_spacing (12);
288 vpacker.pack_start (upper_packer, false, false);
289 vpacker.pack_start (*dim_packer, false, false);
290 vpacker.pack_start (channel_table_header, false, false);
291 vpacker.pack_start (channel_table_packer, false, false);
292 vpacker.pack_start (lower_packer, false, false);
294 hpacker.pack_start (vpacker, true, true);
296 gain_control->show_all ();
297 dim_control->show_all ();
298 solo_boost_control->show_all ();
300 channel_table.show ();
302 upper_packer.show ();
303 lower_packer.show ();
308 assign_controllables ();
310 _tearoff = new TearOff (hpacker);
312 /* if torn off, make this a normal window */
313 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
314 _tearoff->tearoff_window().set_title (X_("Monitor"));
315 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
317 /* catch changes that affect us */
319 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
322 MonitorSection::~MonitorSection ()
324 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
328 _channel_buttons.clear ();
332 delete solo_boost_control;
337 MonitorSection::set_session (Session* s)
339 AxisView::set_session (s);
343 _route = _session->monitor_out ();
346 /* session with monitor section */
347 _monitor = _route->monitor_control ();
348 assign_controllables ();
350 /* session with no monitor section */
355 if (channel_table_scroller.get_parent()) {
356 /* scroller is packed, so remove it */
357 channel_table_packer.remove (channel_table_scroller);
358 /* remove the table_hpacker from the scroller */
359 channel_table_scroller.remove ();
362 if (table_hpacker.get_parent ()) {
363 /* this occurs when the table hpacker is directly
364 packed, so remove it.
366 channel_table_packer.remove (table_hpacker);
369 if (_monitor->output_streams().n_audio() > 7) {
370 /* put the table into a scrolled window, and then put
371 * that into the channel vpacker, after the table header
373 channel_table_scroller.add (table_hpacker);
374 channel_table_packer.pack_start (channel_table_scroller, true, true);
375 channel_table_scroller.show ();
378 /* just put the channel table itself into the channel
379 * vpacker, after the table header
382 channel_table_packer.pack_start (table_hpacker, true, true);
383 channel_table_scroller.hide ();
386 table_hpacker.show ();
387 channel_table.show ();
394 control_connections.drop_connections ();
395 rude_iso_button.unset_active_state ();
396 rude_solo_button.unset_active_state ();
398 assign_controllables ();
402 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
403 : cut (ArdourButton::just_led_default_elements)
404 , dim (ArdourButton::just_led_default_elements)
405 , solo (ArdourButton::just_led_default_elements)
406 , invert (ArdourButton::just_led_default_elements)
408 cut.set_diameter (3);
409 dim.set_diameter (3);
410 solo.set_diameter (3);
411 invert.set_diameter (3);
413 cut.set_name (X_("monitor section cut"));
414 dim.set_name (X_("monitor section dim"));
415 solo.set_name (X_("monitor section solo"));
416 invert.set_name (X_("monitor section invert"));
418 cut.unset_flags (Gtk::CAN_FOCUS);
419 dim.unset_flags (Gtk::CAN_FOCUS);
420 solo.unset_flags (Gtk::CAN_FOCUS);
421 invert.unset_flags (Gtk::CAN_FOCUS);
425 MonitorSection::populate_buttons ()
431 Glib::RefPtr<Action> act;
432 uint32_t nchans = _monitor->output_streams().n_audio();
434 channel_table.resize (nchans, 5);
435 channel_table.set_col_spacings (6);
436 channel_table.set_row_spacings (6);
437 channel_table.set_homogeneous (true);
439 const uint32_t row_offset = 0;
441 for (uint32_t i = 0; i < nchans; ++i) {
454 snprintf (buf, sizeof (buf), "%d", i+1);
458 Label* label = manage (new Label (l));
459 channel_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL);
461 ChannelButtonSet* cbs = new ChannelButtonSet;
463 _channel_buttons.push_back (cbs);
465 channel_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL);
466 channel_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL);
467 channel_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL);
468 channel_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL);
470 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
471 act = ActionManager::get_action (X_("Monitor"), buf);
473 cbs->cut.set_related_action (act);
476 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
477 act = ActionManager::get_action (X_("Monitor"), buf);
479 cbs->dim.set_related_action (act);
482 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
483 act = ActionManager::get_action (X_("Monitor"), buf);
485 cbs->solo.set_related_action (act);
488 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
489 act = ActionManager::get_action (X_("Monitor"), buf);
491 cbs->invert.set_related_action (act);
495 channel_table.show_all ();
499 MonitorSection::set_button_names ()
501 rec_enable_button_label.set_text ("rec");
502 mute_button_label.set_text ("rec");
503 solo_button_label.set_text ("rec");
507 MonitorSection::toggle_exclusive_solo ()
513 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
515 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
516 Config->set_exclusive_solo (tact->get_active());
523 MonitorSection::toggle_mute_overrides_solo ()
529 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
531 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
532 Config->set_solo_mute_override (tact->get_active());
537 MonitorSection::dim_all ()
543 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
545 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
546 _monitor->set_dim_all (tact->get_active());
552 MonitorSection::cut_all ()
558 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
560 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
561 _monitor->set_cut_all (tact->get_active());
566 MonitorSection::mono ()
572 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
574 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
575 _monitor->set_mono (tact->get_active());
580 MonitorSection::cut_channel (uint32_t chn)
587 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
589 --chn; // 0-based in backend
591 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
593 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
594 _monitor->set_cut (chn, tact->get_active());
599 MonitorSection::dim_channel (uint32_t chn)
606 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
608 --chn; // 0-based in backend
610 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
612 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
613 _monitor->set_dim (chn, tact->get_active());
619 MonitorSection::solo_channel (uint32_t chn)
626 snprintf (buf, sizeof (buf), "monitor-solo-%u", chn);
628 --chn; // 0-based in backend
630 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
632 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
633 _monitor->set_solo (chn, tact->get_active());
639 MonitorSection::invert_channel (uint32_t chn)
646 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
648 --chn; // 0-based in backend
650 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
652 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
653 _monitor->set_polarity (chn, tact->get_active());
658 MonitorSection::register_actions ()
662 Glib::RefPtr<Action> act;
664 monitor_actions = ActionGroup::create (X_("Monitor"));
665 ActionManager::add_action_group (monitor_actions);
667 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", "Switch monitor to mono",
668 sigc::mem_fun (*this, &MonitorSection::mono));
670 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", "Cut monitor",
671 sigc::mem_fun (*this, &MonitorSection::cut_all));
673 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", "Dim monitor",
674 sigc::mem_fun (*this, &MonitorSection::dim_all));
676 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", "Toggle exclusive solo mode",
677 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
679 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
680 tact->set_active (Config->get_exclusive_solo());
682 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", "Toggle mute overrides solo mode",
683 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
685 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
686 tact->set_active (Config->get_solo_mute_override());
689 /* note the 1-based counting (for naming - backend uses 0-based) */
691 for (uint32_t chn = 1; chn <= 16; ++chn) {
693 action_name = string_compose (X_("monitor-cut-%1"), chn);
694 action_descr = string_compose (_("Cut monitor channel %1"), chn);
695 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
696 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
698 action_name = string_compose (X_("monitor-dim-%1"), chn);
699 action_descr = string_compose (_("Dim monitor channel %1"), chn+1);
700 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
701 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
703 action_name = string_compose (X_("monitor-solo-%1"), chn);
704 action_descr = string_compose (_("Solo monitor channel %1"), chn+1);
705 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
706 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
708 action_name = string_compose (X_("monitor-invert-%1"), chn);
709 action_descr = string_compose (_("Invert monitor channel %1"), chn+1);
710 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
711 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
716 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
717 RadioAction::Group solo_group;
719 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", "In-place solo",
720 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
721 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", "After Fade Listen (AFL) solo",
722 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
723 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", "Pre Fade Listen (PFL) solo",
724 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
726 ActionManager::add_action_group (solo_actions);
730 MonitorSection::solo_use_in_place ()
732 /* this is driven by a toggle on a radio group, and so is invoked twice,
733 once for the item that became inactive and once for the one that became
737 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
740 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
742 Config->set_solo_control_is_listen_control (!ract->get_active());
748 MonitorSection::solo_use_afl ()
750 /* this is driven by a toggle on a radio group, and so is invoked twice,
751 once for the item that became inactive and once for the one that became
755 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
757 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
759 if (ract->get_active()) {
760 Config->set_listen_position (AfterFaderListen);
761 Config->set_solo_control_is_listen_control (true);
768 MonitorSection::solo_use_pfl ()
770 /* this is driven by a toggle on a radio group, and so is invoked twice,
771 once for the item that became inactive and once for the one that became
775 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
777 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
779 if (ract->get_active()) {
780 Config->set_listen_position (PreFaderListen);
781 Config->set_solo_control_is_listen_control (true);
788 MonitorSection::setup_knob_images ()
792 uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob");
794 snprintf (buf, 16, "#%x", (c >> 8));
795 MotionFeedback::set_lamp_color (buf);
796 big_knob_pixbuf = MotionFeedback::render_pixbuf (80);
800 error << "No usable large knob image" << endmsg;
801 throw failed_constructor ();
804 if (!big_knob_pixbuf) {
805 error << "No usable large knob image" << endmsg;
806 throw failed_constructor ();
811 little_knob_pixbuf = MotionFeedback::render_pixbuf (30);
815 error << "No usable small knob image" << endmsg;
816 throw failed_constructor ();
819 if (!little_knob_pixbuf) {
820 error << "No usable small knob image" << endmsg;
821 throw failed_constructor ();
827 MonitorSection::update_solo_model ()
829 const char* action_name = 0;
830 Glib::RefPtr<Action> act;
832 if (Config->get_solo_control_is_listen_control()) {
833 switch (Config->get_listen_position()) {
834 case AfterFaderListen:
835 action_name = X_("solo-use-afl");
838 action_name = X_("solo-use-pfl");
842 action_name = X_("solo-use-in-place");
845 act = ActionManager::get_action (X_("Solo"), action_name);
847 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
849 ract->set_active (true);
855 MonitorSection::map_state ()
857 if (!_route || !_monitor) {
861 Glib::RefPtr<Action> act;
863 update_solo_model ();
865 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
867 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
869 tact->set_active (_monitor->cut_all());
873 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
875 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
877 tact->set_active (_monitor->dim_all());
881 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
883 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
885 tact->set_active (_monitor->mono());
889 uint32_t nchans = _monitor->output_streams().n_audio();
891 assert (nchans == _channel_buttons.size ());
893 for (uint32_t n = 0; n < nchans; ++n) {
895 char action_name[32];
897 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
898 act = ActionManager::get_action (X_("Monitor"), action_name);
900 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
902 tact->set_active (_monitor->cut (n));
906 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
907 act = ActionManager::get_action (X_("Monitor"), action_name);
909 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
911 tact->set_active (_monitor->dimmed (n));
915 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
916 act = ActionManager::get_action (X_("Monitor"), action_name);
918 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
920 tact->set_active (_monitor->soloed (n));
924 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
925 act = ActionManager::get_action (X_("Monitor"), action_name);
927 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
929 tact->set_active (_monitor->inverted (n));
936 MonitorSection::do_blink (bool onoff)
939 audition_blink (onoff);
943 MonitorSection::audition_blink (bool onoff)
949 if (_session->is_auditioning()) {
951 rude_audition_button.set_active_state (Gtkmm2ext::Active);
953 rude_audition_button.unset_active_state ();
956 rude_audition_button.unset_active_state ();
961 MonitorSection::solo_blink (bool onoff)
967 if (_session->soloing() || _session->listening()) {
969 rude_solo_button.set_active_state (Gtkmm2ext::Active);
971 rude_solo_button.unset_active_state ();
974 if (_session->soloing()) {
975 if (_session->solo_isolated()) {
976 rude_iso_button.set_active_state (Gtkmm2ext::Active);
981 // rude_solo_button.set_active (false);
982 rude_solo_button.unset_active_state ();
983 rude_iso_button.unset_active_state ();
988 MonitorSection::cancel_solo (GdkEventButton*)
991 if (_session->soloing()) {
992 _session->set_solo (_session->get_routes(), false);
993 } else if (_session->listening()) {
994 _session->set_listen (_session->get_routes(), false);
1002 MonitorSection::cancel_isolate (GdkEventButton*)
1005 boost::shared_ptr<RouteList> rl (_session->get_routes ());
1006 _session->set_solo_isolated (rl, false, Session::rt_cleanup, true);
1013 MonitorSection::cancel_audition (GdkEventButton*)
1016 _session->cancel_audition();
1022 MonitorSection::parameter_changed (std::string name)
1024 if (name == "solo-control-is-listen-control" ||
1025 name == "listen-position") {
1026 update_solo_model ();
1031 MonitorSection::assign_controllables ()
1033 boost::shared_ptr<Controllable> none;
1035 if (!gain_control) {
1036 /* too early - GUI controls not set up yet */
1041 solo_cut_control->set_controllable (_session->solo_cut_control());
1043 solo_cut_control->set_controllable (none);
1047 gain_control->set_controllable (_route->gain_control());
1049 gain_control->set_controllable (none);
1054 cut_all_button.set_controllable (_monitor->cut_control());
1055 cut_all_button.watch ();
1056 dim_all_button.set_controllable (_monitor->dim_control());
1057 dim_all_button.watch ();
1058 mono_button.set_controllable (_monitor->mono_control());
1059 mono_button.watch ();
1061 dim_control->set_controllable (_monitor->dim_level_control ());
1062 solo_boost_control->set_controllable (_monitor->solo_boost_control ());
1066 cut_all_button.set_controllable (none);
1067 dim_all_button.set_controllable (none);
1068 mono_button.set_controllable (none);
1070 dim_control->set_controllable (none);
1071 solo_boost_control->set_controllable (none);
1076 MonitorSection::state_id() const
1078 return "monitor-section";