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 (_("SiP"), ArdourButton::led_default_elements)
44 , afl_button (_("AFL"), ArdourButton::led_default_elements)
45 , pfl_button (_("PFL"), ArdourButton::led_default_elements)
46 , exclusive_solo_button (ArdourButton::led_default_elements)
47 , solo_mute_override_button (ArdourButton::led_default_elements)
49 Glib::RefPtr<Action> act;
51 if (!monitor_actions) {
53 /* do some static stuff */
66 rude_solo_button.set_text (_("soloing"));
67 rude_solo_button.set_name ("rude solo");
68 rude_solo_button.show ();
70 rude_iso_button.set_text (_("isolated"));
71 rude_iso_button.set_name ("rude isolate");
72 rude_iso_button.show ();
74 rude_audition_button.set_text (_("auditioning"));
75 rude_audition_button.set_name ("rude audition");
76 rude_audition_button.show ();
78 ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
80 rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo));
81 UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
83 rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate));
84 UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
86 rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition));
87 UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
89 solo_in_place_button.set_name ("monitor section solo model");
90 afl_button.set_name ("monitor section solo model");
91 pfl_button.set_name ("monitor section solo model");
93 solo_model_box.set_spacing (6);
94 solo_model_box.pack_start (solo_in_place_button, true, false);
95 solo_model_box.pack_start (afl_button, true, false);
96 solo_model_box.pack_start (pfl_button, true, false);
98 solo_in_place_button.show ();
101 solo_model_box.show ();
103 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
104 ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place"));
106 solo_in_place_button.set_related_action (act);
109 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
110 ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen"));
112 afl_button.set_related_action (act);
115 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
116 ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen"));
118 pfl_button.set_related_action (act);
123 solo_boost_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
124 ARDOUR_UI::instance()->tooltips().set_tip (*solo_boost_control, _("Gain increase for soloed signals (0dB is normal)"));
126 HBox* solo_packer = manage (new HBox);
127 solo_packer->set_spacing (6);
128 solo_packer->show ();
130 spin_label = manage (new Label (_("Solo Boost")));
131 spin_packer = manage (new VBox);
132 spin_packer->show ();
133 spin_packer->set_spacing (6);
134 spin_packer->pack_start (*solo_boost_control, false, false);
135 spin_packer->pack_start (*spin_label, false, false);
137 solo_packer->pack_start (*spin_packer, true, false);
141 solo_cut_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.1, 0.5, true, 30, 30, true);
142 ARDOUR_UI::instance()->tooltips().set_tip (*solo_cut_control, _("Gain reduction non-soloed signals\nA value above -inf dB causes \"solo-in-front\""));
144 spin_label = manage (new Label (_("SiP Cut")));
145 spin_packer = manage (new VBox);
146 spin_packer->show ();
147 spin_packer->set_spacing (6);
148 spin_packer->pack_start (*solo_cut_control, false, false);
149 spin_packer->pack_start (*spin_label, false, false);
151 solo_packer->pack_start (*spin_packer, true, false);
155 dim_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
156 ARDOUR_UI::instance()->tooltips().set_tip (*dim_control, _("Gain reduction to use when dimming monitor outputs"));
158 HBox* dim_packer = manage (new HBox);
161 spin_label = manage (new Label (_("Dim")));
162 spin_packer = manage (new VBox);
163 spin_packer->show ();
164 spin_packer->set_spacing (6);
165 spin_packer->pack_start (*dim_control, false, false);
166 spin_packer->pack_start (*spin_label, false, false);
168 dim_packer->pack_start (*spin_packer, true, false);
170 exclusive_solo_button.set_text (_("excl. solo"));
171 exclusive_solo_button.set_name (X_("monitor solo exclusive"));
172 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
174 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
176 exclusive_solo_button.set_related_action (act);
179 solo_mute_override_button.set_text (_("solo ยป mute"));
180 solo_mute_override_button.set_name (X_("monitor solo override"));
181 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)"));
183 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
185 solo_mute_override_button.set_related_action (act);
188 HBox* solo_opt_box = manage (new HBox);
189 solo_opt_box->set_spacing (12);
190 solo_opt_box->set_homogeneous (true);
191 solo_opt_box->pack_start (exclusive_solo_button);
192 solo_opt_box->pack_start (solo_mute_override_button);
193 solo_opt_box->show ();
195 upper_packer.set_spacing (6);
197 Gtk::HBox* rude_box = manage (new HBox);
198 rude_box->pack_start (rude_solo_button, true, true);
199 rude_box->pack_start (rude_iso_button, true, true);
201 upper_packer.pack_start (*rude_box, false, false);
202 upper_packer.pack_start (rude_audition_button, false, false);
203 upper_packer.pack_start (solo_model_box, false, false, 12);
204 upper_packer.pack_start (*solo_opt_box, false, false);
205 upper_packer.pack_start (*solo_packer, false, false, 12);
207 cut_all_button.set_text (_("mute"));
208 cut_all_button.set_name ("monitor section cut");
209 cut_all_button.set_name (X_("monitor section cut"));
210 cut_all_button.set_size_request (-1,50);
211 cut_all_button.show ();
213 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
215 cut_all_button.set_related_action (act);
218 dim_all_button.set_text (_("dim"));
219 dim_all_button.set_name ("monitor section dim");
220 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
222 dim_all_button.set_related_action (act);
225 mono_button.set_text (_("mono"));
226 mono_button.set_name ("monitor section mono");
227 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
229 mono_button.set_related_action (act);
232 HBox* bbox = manage (new HBox);
234 bbox->set_spacing (12);
235 bbox->pack_start (mono_button, true, true);
236 bbox->pack_start (dim_all_button, true, true);
238 lower_packer.set_spacing (12);
239 lower_packer.pack_start (*bbox, false, false);
240 lower_packer.pack_start (cut_all_button, false, false);
244 gain_control = new VolumeController (big_knob_pixbuf, boost::shared_ptr<Controllable>(), 1.0, 0.01, 0.1, true, 80, 80, false);
246 spin_label = manage (new Label (_("Monitor")));
247 spin_packer = manage (new VBox);
248 spin_packer->show ();
249 spin_packer->set_spacing (6);
250 spin_packer->pack_start (*gain_control, false, false);
251 spin_packer->pack_start (*spin_label, false, false);
253 lower_packer.pack_start (*spin_packer, true, true);
255 channel_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
256 channel_table_scroller.set_size_request (-1, 150);
257 channel_table_scroller.set_shadow_type (Gtk::SHADOW_NONE);
258 channel_table_scroller.show ();
260 channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
261 channel_size_group->add_widget (channel_table_header);
262 channel_size_group->add_widget (channel_table);
264 channel_table_header.resize (1, 5);
265 Label* l1 = manage (new Label (X_("out")));
266 l1->set_name (X_("MonitorSectionLabel"));
267 channel_table_header.attach (*l1, 0, 1, 0, 1, EXPAND|FILL);
268 l1 = manage (new Label (X_("cut")));
269 l1->set_name (X_("MonitorSectionLabel"));
270 channel_table_header.attach (*l1, 1, 2, 0, 1, EXPAND|FILL);
271 l1 = manage (new Label (X_("dim")));
272 l1->set_name (X_("MonitorSectionLabel"));
273 channel_table_header.attach (*l1, 2, 3, 0, 1, EXPAND|FILL);
274 l1 = manage (new Label (X_("solo")));
275 l1->set_name (X_("MonitorSectionLabel"));
276 channel_table_header.attach (*l1, 3, 4, 0, 1, EXPAND|FILL);
277 l1 = manage (new Label (X_("inv")));
278 l1->set_name (X_("MonitorSectionLabel"));
279 channel_table_header.attach (*l1, 4, 5, 0, 1, EXPAND|FILL);
280 channel_table_header.show ();
282 table_hpacker.pack_start (channel_table, true, true);
284 /* note that we don't pack the table_hpacker till later
287 vpacker.set_border_width (6);
288 vpacker.set_spacing (12);
289 vpacker.pack_start (upper_packer, false, false);
290 vpacker.pack_start (*dim_packer, false, false);
291 vpacker.pack_start (channel_table_header, false, false);
292 vpacker.pack_start (channel_table_packer, false, false);
293 vpacker.pack_start (lower_packer, false, false);
295 hpacker.pack_start (vpacker, true, true);
297 gain_control->show_all ();
298 dim_control->show_all ();
299 solo_boost_control->show_all ();
301 channel_table.show ();
303 upper_packer.show ();
304 lower_packer.show ();
309 assign_controllables ();
311 _tearoff = new TearOff (hpacker);
313 /* if torn off, make this a normal window */
314 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
315 _tearoff->tearoff_window().set_title (X_("Monitor"));
316 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
318 /* catch changes that affect us */
320 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
323 MonitorSection::~MonitorSection ()
325 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
329 _channel_buttons.clear ();
333 delete solo_boost_control;
338 MonitorSection::set_session (Session* s)
340 AxisView::set_session (s);
344 _route = _session->monitor_out ();
347 /* session with monitor section */
348 _monitor = _route->monitor_control ();
349 assign_controllables ();
351 /* session with no monitor section */
356 if (channel_table_scroller.get_parent()) {
357 /* scroller is packed, so remove it */
358 channel_table_packer.remove (channel_table_scroller);
359 /* remove the table_hpacker from the scroller */
360 channel_table_scroller.remove ();
363 if (table_hpacker.get_parent ()) {
364 /* this occurs when the table hpacker is directly
365 packed, so remove it.
367 channel_table_packer.remove (table_hpacker);
370 if (_monitor->output_streams().n_audio() > 7) {
371 /* put the table into a scrolled window, and then put
372 * that into the channel vpacker, after the table header
374 channel_table_scroller.add (table_hpacker);
375 channel_table_packer.pack_start (channel_table_scroller, true, true);
376 channel_table_scroller.show ();
379 /* just put the channel table itself into the channel
380 * vpacker, after the table header
383 channel_table_packer.pack_start (table_hpacker, true, true);
384 channel_table_scroller.hide ();
387 table_hpacker.show ();
388 channel_table.show ();
395 control_connections.drop_connections ();
396 rude_iso_button.unset_active_state ();
397 rude_solo_button.unset_active_state ();
399 assign_controllables ();
403 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
405 cut.set_diameter (3);
406 dim.set_diameter (3);
407 solo.set_diameter (3);
408 invert.set_diameter (3);
410 cut.set_name (X_("monitor section cut"));
411 dim.set_name (X_("monitor section dim"));
412 solo.set_name (X_("monitor section solo"));
413 invert.set_name (X_("monitor section invert"));
415 cut.unset_flags (Gtk::CAN_FOCUS);
416 dim.unset_flags (Gtk::CAN_FOCUS);
417 solo.unset_flags (Gtk::CAN_FOCUS);
418 invert.unset_flags (Gtk::CAN_FOCUS);
422 MonitorSection::populate_buttons ()
428 Glib::RefPtr<Action> act;
429 uint32_t nchans = _monitor->output_streams().n_audio();
431 channel_table.resize (nchans, 5);
432 channel_table.set_col_spacings (6);
433 channel_table.set_row_spacings (6);
434 channel_table.set_homogeneous (true);
436 const uint32_t row_offset = 0;
438 for (uint32_t i = 0; i < nchans; ++i) {
451 snprintf (buf, sizeof (buf), "%d", i+1);
455 Label* label = manage (new Label (l));
456 channel_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL);
458 ChannelButtonSet* cbs = new ChannelButtonSet;
460 _channel_buttons.push_back (cbs);
462 channel_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL);
463 channel_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL);
464 channel_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL);
465 channel_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL);
467 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
468 act = ActionManager::get_action (X_("Monitor"), buf);
470 cbs->cut.set_related_action (act);
473 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
474 act = ActionManager::get_action (X_("Monitor"), buf);
476 cbs->dim.set_related_action (act);
479 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
480 act = ActionManager::get_action (X_("Monitor"), buf);
482 cbs->solo.set_related_action (act);
485 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
486 act = ActionManager::get_action (X_("Monitor"), buf);
488 cbs->invert.set_related_action (act);
492 channel_table.show_all ();
496 MonitorSection::toggle_exclusive_solo ()
502 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
504 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
505 Config->set_exclusive_solo (tact->get_active());
512 MonitorSection::toggle_mute_overrides_solo ()
518 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
520 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
521 Config->set_solo_mute_override (tact->get_active());
526 MonitorSection::dim_all ()
532 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
534 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
535 _monitor->set_dim_all (tact->get_active());
541 MonitorSection::cut_all ()
547 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
549 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
550 _monitor->set_cut_all (tact->get_active());
555 MonitorSection::mono ()
561 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
563 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
564 _monitor->set_mono (tact->get_active());
569 MonitorSection::cut_channel (uint32_t chn)
576 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
578 --chn; // 0-based in backend
580 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
582 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
583 _monitor->set_cut (chn, tact->get_active());
588 MonitorSection::dim_channel (uint32_t chn)
595 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
597 --chn; // 0-based in backend
599 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
601 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
602 _monitor->set_dim (chn, tact->get_active());
608 MonitorSection::solo_channel (uint32_t chn)
615 snprintf (buf, sizeof (buf), "monitor-solo-%u", chn);
617 --chn; // 0-based in backend
619 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
621 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
622 _monitor->set_solo (chn, tact->get_active());
628 MonitorSection::invert_channel (uint32_t chn)
635 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
637 --chn; // 0-based in backend
639 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
641 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
642 _monitor->set_polarity (chn, tact->get_active());
647 MonitorSection::register_actions ()
651 Glib::RefPtr<Action> act;
653 monitor_actions = ActionGroup::create (X_("Monitor"));
654 ActionManager::add_action_group (monitor_actions);
656 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", "Switch monitor to mono",
657 sigc::mem_fun (*this, &MonitorSection::mono));
659 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", "Cut monitor",
660 sigc::mem_fun (*this, &MonitorSection::cut_all));
662 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", "Dim monitor",
663 sigc::mem_fun (*this, &MonitorSection::dim_all));
665 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", "Toggle exclusive solo mode",
666 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
668 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
669 tact->set_active (Config->get_exclusive_solo());
671 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", "Toggle mute overrides solo mode",
672 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
674 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
675 tact->set_active (Config->get_solo_mute_override());
678 /* note the 1-based counting (for naming - backend uses 0-based) */
680 for (uint32_t chn = 1; chn <= 16; ++chn) {
682 action_name = string_compose (X_("monitor-cut-%1"), chn);
683 action_descr = string_compose (_("Cut monitor channel %1"), chn);
684 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
685 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
687 action_name = string_compose (X_("monitor-dim-%1"), chn);
688 action_descr = string_compose (_("Dim monitor channel %1"), chn+1);
689 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
690 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
692 action_name = string_compose (X_("monitor-solo-%1"), chn);
693 action_descr = string_compose (_("Solo monitor channel %1"), chn+1);
694 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
695 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
697 action_name = string_compose (X_("monitor-invert-%1"), chn);
698 action_descr = string_compose (_("Invert monitor channel %1"), chn+1);
699 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
700 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
705 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
706 RadioAction::Group solo_group;
708 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", "In-place solo",
709 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
710 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", "After Fade Listen (AFL) solo",
711 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
712 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", "Pre Fade Listen (PFL) solo",
713 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
715 ActionManager::add_action_group (solo_actions);
719 MonitorSection::solo_use_in_place ()
721 /* this is driven by a toggle on a radio group, and so is invoked twice,
722 once for the item that became inactive and once for the one that became
726 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
729 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
731 Config->set_solo_control_is_listen_control (!ract->get_active());
737 MonitorSection::solo_use_afl ()
739 /* this is driven by a toggle on a radio group, and so is invoked twice,
740 once for the item that became inactive and once for the one that became
744 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
746 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
748 if (ract->get_active()) {
749 Config->set_solo_control_is_listen_control (true);
750 Config->set_listen_position (AfterFaderListen);
757 MonitorSection::solo_use_pfl ()
759 /* this is driven by a toggle on a radio group, and so is invoked twice,
760 once for the item that became inactive and once for the one that became
764 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
766 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
768 if (ract->get_active()) {
769 Config->set_solo_control_is_listen_control (true);
770 Config->set_listen_position (PreFaderListen);
777 MonitorSection::setup_knob_images ()
781 uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob");
783 snprintf (buf, 16, "#%x", (c >> 8));
784 MotionFeedback::set_lamp_color (buf);
785 big_knob_pixbuf = MotionFeedback::render_pixbuf (80);
789 error << "No usable large knob image" << endmsg;
790 throw failed_constructor ();
793 if (!big_knob_pixbuf) {
794 error << "No usable large knob image" << endmsg;
795 throw failed_constructor ();
800 little_knob_pixbuf = MotionFeedback::render_pixbuf (30);
804 error << "No usable small knob image" << endmsg;
805 throw failed_constructor ();
808 if (!little_knob_pixbuf) {
809 error << "No usable small knob image" << endmsg;
810 throw failed_constructor ();
816 MonitorSection::update_solo_model ()
818 const char* action_name = 0;
819 Glib::RefPtr<Action> act;
821 if (Config->get_solo_control_is_listen_control()) {
822 switch (Config->get_listen_position()) {
823 case AfterFaderListen:
824 action_name = X_("solo-use-afl");
827 action_name = X_("solo-use-pfl");
831 action_name = X_("solo-use-in-place");
834 act = ActionManager::get_action (X_("Solo"), action_name);
837 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
839 /* because these are radio buttons, one of them will be
840 active no matter what. to trigger a change in the
841 action so that the view picks it up, toggle it.
843 if (ract->get_active()) {
844 ract->set_active (false);
846 ract->set_active (true);
853 MonitorSection::map_state ()
855 if (!_route || !_monitor) {
859 Glib::RefPtr<Action> act;
861 update_solo_model ();
863 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
865 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
867 tact->set_active (_monitor->cut_all());
871 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
873 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
875 tact->set_active (_monitor->dim_all());
879 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
881 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
883 tact->set_active (_monitor->mono());
887 uint32_t nchans = _monitor->output_streams().n_audio();
889 assert (nchans == _channel_buttons.size ());
891 for (uint32_t n = 0; n < nchans; ++n) {
893 char action_name[32];
895 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
896 act = ActionManager::get_action (X_("Monitor"), action_name);
898 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
900 tact->set_active (_monitor->cut (n));
904 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
905 act = ActionManager::get_action (X_("Monitor"), action_name);
907 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
909 tact->set_active (_monitor->dimmed (n));
913 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
914 act = ActionManager::get_action (X_("Monitor"), action_name);
916 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
918 tact->set_active (_monitor->soloed (n));
922 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
923 act = ActionManager::get_action (X_("Monitor"), action_name);
925 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
927 tact->set_active (_monitor->inverted (n));
934 MonitorSection::do_blink (bool onoff)
937 audition_blink (onoff);
941 MonitorSection::audition_blink (bool onoff)
947 if (_session->is_auditioning()) {
949 rude_audition_button.set_active_state (Gtkmm2ext::Active);
951 rude_audition_button.unset_active_state ();
954 rude_audition_button.unset_active_state ();
959 MonitorSection::solo_blink (bool onoff)
965 if (_session->soloing() || _session->listening()) {
967 rude_solo_button.set_active_state (Gtkmm2ext::Active);
969 rude_solo_button.unset_active_state ();
972 if (_session->soloing()) {
973 if (_session->solo_isolated()) {
974 rude_iso_button.set_active_state (Gtkmm2ext::Active);
979 // rude_solo_button.set_active (false);
980 rude_solo_button.unset_active_state ();
981 rude_iso_button.unset_active_state ();
986 MonitorSection::cancel_solo (GdkEventButton*)
989 if (_session->soloing()) {
990 _session->set_solo (_session->get_routes(), false);
991 } else if (_session->listening()) {
992 _session->set_listen (_session->get_routes(), false);
1000 MonitorSection::cancel_isolate (GdkEventButton*)
1003 boost::shared_ptr<RouteList> rl (_session->get_routes ());
1004 _session->set_solo_isolated (rl, false, Session::rt_cleanup, true);
1011 MonitorSection::cancel_audition (GdkEventButton*)
1014 _session->cancel_audition();
1020 MonitorSection::parameter_changed (std::string name)
1022 if (name == "solo-control-is-listen-control") {
1023 update_solo_model ();
1024 } else if (name == "listen-position") {
1025 update_solo_model ();
1030 MonitorSection::assign_controllables ()
1032 boost::shared_ptr<Controllable> none;
1034 if (!gain_control) {
1035 /* too early - GUI controls not set up yet */
1040 solo_cut_control->set_controllable (_session->solo_cut_control());
1042 solo_cut_control->set_controllable (none);
1046 gain_control->set_controllable (_route->gain_control());
1048 gain_control->set_controllable (none);
1053 cut_all_button.set_controllable (_monitor->cut_control());
1054 cut_all_button.watch ();
1055 dim_all_button.set_controllable (_monitor->dim_control());
1056 dim_all_button.watch ();
1057 mono_button.set_controllable (_monitor->mono_control());
1058 mono_button.watch ();
1060 dim_control->set_controllable (_monitor->dim_level_control ());
1061 solo_boost_control->set_controllable (_monitor->solo_boost_control ());
1065 cut_all_button.set_controllable (none);
1066 dim_all_button.set_controllable (none);
1067 mono_button.set_controllable (none);
1069 dim_control->set_controllable (none);
1070 solo_boost_control->set_controllable (none);
1075 MonitorSection::state_id() const
1077 return "monitor-section";