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 , 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_in_place_button.set_name ("monitor section solo model");
93 afl_button.set_name ("monitor section solo model");
94 pfl_button.set_name ("monitor section solo model");
97 solo_model_group.add (solo_in_place_button);
98 solo_model_group.add (afl_button);
99 solo_model_group.add (afl_button);
102 solo_model_box.set_spacing (6);
103 solo_model_box.pack_start (solo_in_place_button, true, false);
104 solo_model_box.pack_start (afl_button, true, false);
105 solo_model_box.pack_start (pfl_button, true, false);
107 solo_in_place_button.show ();
110 solo_model_box.show ();
112 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
113 ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place"));
115 solo_in_place_button.set_related_action (act);
118 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
119 ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen"));
121 afl_button.set_related_action (act);
124 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
125 ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen"));
127 pfl_button.set_related_action (act);
132 solo_boost_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
133 ARDOUR_UI::instance()->tooltips().set_tip (*solo_boost_control, _("Gain increase for soloed signals (0dB is normal)"));
135 HBox* solo_packer = manage (new HBox);
136 solo_packer->set_spacing (6);
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, false);
150 solo_cut_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.1, 0.5, true, 30, 30, true);
151 ARDOUR_UI::instance()->tooltips().set_tip (*solo_cut_control, _("Gain reduction non-soloed signals\nA value above -inf dB causes \"solo-in-front\""));
153 spin_label = manage (new Label (_("SiP Cut")));
154 spin_packer = manage (new VBox);
155 spin_packer->show ();
156 spin_packer->set_spacing (6);
157 spin_packer->pack_start (*solo_cut_control, false, false);
158 spin_packer->pack_start (*spin_label, false, false);
160 solo_packer->pack_start (*spin_packer, true, false);
164 dim_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
165 ARDOUR_UI::instance()->tooltips().set_tip (*dim_control, _("Gain reduction to use when dimming monitor outputs"));
167 HBox* dim_packer = manage (new HBox);
170 spin_label = manage (new Label (_("Dim")));
171 spin_packer = manage (new VBox);
172 spin_packer->show ();
173 spin_packer->set_spacing (6);
174 spin_packer->pack_start (*dim_control, false, false);
175 spin_packer->pack_start (*spin_label, false, false);
177 dim_packer->pack_start (*spin_packer, true, false);
179 exclusive_solo_button.set_text (_("excl. solo"));
180 exclusive_solo_button.set_name (X_("monitor solo exclusive"));
181 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
183 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
185 exclusive_solo_button.set_related_action (act);
188 solo_mute_override_button.set_text (_("solo ยป mute"));
189 solo_mute_override_button.set_name (X_("monitor solo override"));
190 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)"));
192 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
194 solo_mute_override_button.set_related_action (act);
197 HBox* solo_opt_box = manage (new HBox);
198 solo_opt_box->set_spacing (12);
199 solo_opt_box->set_homogeneous (true);
200 solo_opt_box->pack_start (exclusive_solo_button);
201 solo_opt_box->pack_start (solo_mute_override_button);
202 solo_opt_box->show ();
204 upper_packer.set_spacing (6);
206 Gtk::HBox* rude_box = manage (new HBox);
207 rude_box->pack_start (rude_solo_button, true, true);
208 rude_box->pack_start (rude_iso_button, true, true);
210 upper_packer.pack_start (*rude_box, false, false);
211 upper_packer.pack_start (rude_audition_button, false, false);
212 upper_packer.pack_start (solo_model_box, false, false, 12);
213 upper_packer.pack_start (*solo_opt_box, false, false);
214 upper_packer.pack_start (*solo_packer, false, false, 12);
216 cut_all_button.set_text (_("mute"));
217 cut_all_button.set_name ("monitor section cut");
218 cut_all_button.set_name (X_("monitor section cut"));
219 cut_all_button.set_size_request (-1,50);
220 cut_all_button.show ();
222 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
224 cut_all_button.set_related_action (act);
227 dim_all_button.set_text (_("dim"));
228 dim_all_button.set_name ("monitor section dim");
229 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
231 dim_all_button.set_related_action (act);
234 mono_button.set_text (_("mono"));
235 mono_button.set_name ("monitor section mono");
236 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
238 mono_button.set_related_action (act);
241 HBox* bbox = manage (new HBox);
243 bbox->set_spacing (12);
244 bbox->pack_start (mono_button, true, true);
245 bbox->pack_start (dim_all_button, true, true);
247 lower_packer.set_spacing (12);
248 lower_packer.pack_start (*bbox, false, false);
249 lower_packer.pack_start (cut_all_button, false, false);
253 gain_control = new VolumeController (big_knob_pixbuf, boost::shared_ptr<Controllable>(), 1.0, 0.01, 0.1, true, 80, 80, false);
255 spin_label = manage (new Label (_("Monitor")));
256 spin_packer = manage (new VBox);
257 spin_packer->show ();
258 spin_packer->set_spacing (6);
259 spin_packer->pack_start (*gain_control, false, false);
260 spin_packer->pack_start (*spin_label, false, false);
262 lower_packer.pack_start (*spin_packer, true, true);
264 channel_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
265 channel_table_scroller.set_size_request (-1, 150);
266 channel_table_scroller.set_shadow_type (Gtk::SHADOW_NONE);
267 channel_table_scroller.show ();
269 channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
270 channel_size_group->add_widget (channel_table_header);
271 channel_size_group->add_widget (channel_table);
273 channel_table_header.resize (1, 5);
274 Label* l1 = manage (new Label (X_("out")));
275 l1->set_name (X_("MonitorSectionLabel"));
276 channel_table_header.attach (*l1, 0, 1, 0, 1, EXPAND|FILL);
277 l1 = manage (new Label (X_("cut")));
278 l1->set_name (X_("MonitorSectionLabel"));
279 channel_table_header.attach (*l1, 1, 2, 0, 1, EXPAND|FILL);
280 l1 = manage (new Label (X_("dim")));
281 l1->set_name (X_("MonitorSectionLabel"));
282 channel_table_header.attach (*l1, 2, 3, 0, 1, EXPAND|FILL);
283 l1 = manage (new Label (X_("solo")));
284 l1->set_name (X_("MonitorSectionLabel"));
285 channel_table_header.attach (*l1, 3, 4, 0, 1, EXPAND|FILL);
286 l1 = manage (new Label (X_("inv")));
287 l1->set_name (X_("MonitorSectionLabel"));
288 channel_table_header.attach (*l1, 4, 5, 0, 1, EXPAND|FILL);
289 channel_table_header.show ();
291 table_hpacker.pack_start (channel_table, true, true);
293 /* note that we don't pack the table_hpacker till later
296 vpacker.set_border_width (6);
297 vpacker.set_spacing (12);
298 vpacker.pack_start (upper_packer, false, false);
299 vpacker.pack_start (*dim_packer, false, false);
300 vpacker.pack_start (channel_table_header, false, false);
301 vpacker.pack_start (channel_table_packer, false, false);
302 vpacker.pack_start (lower_packer, false, false);
304 hpacker.pack_start (vpacker, true, true);
306 gain_control->show_all ();
307 dim_control->show_all ();
308 solo_boost_control->show_all ();
310 channel_table.show ();
312 upper_packer.show ();
313 lower_packer.show ();
318 assign_controllables ();
320 _tearoff = new TearOff (hpacker);
322 /* if torn off, make this a normal window */
323 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
324 _tearoff->tearoff_window().set_title (X_("Monitor"));
325 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
327 /* catch changes that affect us */
329 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
332 MonitorSection::~MonitorSection ()
334 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
338 _channel_buttons.clear ();
342 delete solo_boost_control;
347 MonitorSection::set_session (Session* s)
349 AxisView::set_session (s);
353 _route = _session->monitor_out ();
356 /* session with monitor section */
357 _monitor = _route->monitor_control ();
358 assign_controllables ();
360 /* session with no monitor section */
365 if (channel_table_scroller.get_parent()) {
366 /* scroller is packed, so remove it */
367 channel_table_packer.remove (channel_table_scroller);
368 /* remove the table_hpacker from the scroller */
369 channel_table_scroller.remove ();
372 if (table_hpacker.get_parent ()) {
373 /* this occurs when the table hpacker is directly
374 packed, so remove it.
376 channel_table_packer.remove (table_hpacker);
379 if (_monitor->output_streams().n_audio() > 7) {
380 /* put the table into a scrolled window, and then put
381 * that into the channel vpacker, after the table header
383 channel_table_scroller.add (table_hpacker);
384 channel_table_packer.pack_start (channel_table_scroller, true, true);
385 channel_table_scroller.show ();
388 /* just put the channel table itself into the channel
389 * vpacker, after the table header
392 channel_table_packer.pack_start (table_hpacker, true, true);
393 channel_table_scroller.hide ();
396 table_hpacker.show ();
397 channel_table.show ();
404 control_connections.drop_connections ();
405 rude_iso_button.unset_active_state ();
406 rude_solo_button.unset_active_state ();
408 assign_controllables ();
412 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
413 : cut (ArdourButton::just_led_default_elements)
414 , dim (ArdourButton::just_led_default_elements)
415 , solo (ArdourButton::just_led_default_elements)
416 , invert (ArdourButton::just_led_default_elements)
418 cut.set_diameter (3);
419 dim.set_diameter (3);
420 solo.set_diameter (3);
421 invert.set_diameter (3);
423 cut.set_name (X_("monitor section cut"));
424 dim.set_name (X_("monitor section dim"));
425 solo.set_name (X_("monitor section solo"));
426 invert.set_name (X_("monitor section invert"));
428 cut.unset_flags (Gtk::CAN_FOCUS);
429 dim.unset_flags (Gtk::CAN_FOCUS);
430 solo.unset_flags (Gtk::CAN_FOCUS);
431 invert.unset_flags (Gtk::CAN_FOCUS);
435 MonitorSection::populate_buttons ()
441 Glib::RefPtr<Action> act;
442 uint32_t nchans = _monitor->output_streams().n_audio();
444 channel_table.resize (nchans, 5);
445 channel_table.set_col_spacings (6);
446 channel_table.set_row_spacings (6);
447 channel_table.set_homogeneous (true);
449 const uint32_t row_offset = 0;
451 for (uint32_t i = 0; i < nchans; ++i) {
464 snprintf (buf, sizeof (buf), "%d", i+1);
468 Label* label = manage (new Label (l));
469 channel_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL);
471 ChannelButtonSet* cbs = new ChannelButtonSet;
473 _channel_buttons.push_back (cbs);
475 channel_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL);
476 channel_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL);
477 channel_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL);
478 channel_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL);
480 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
481 act = ActionManager::get_action (X_("Monitor"), buf);
483 cbs->cut.set_related_action (act);
486 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
487 act = ActionManager::get_action (X_("Monitor"), buf);
489 cbs->dim.set_related_action (act);
492 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
493 act = ActionManager::get_action (X_("Monitor"), buf);
495 cbs->solo.set_related_action (act);
498 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
499 act = ActionManager::get_action (X_("Monitor"), buf);
501 cbs->invert.set_related_action (act);
505 channel_table.show_all ();
509 MonitorSection::toggle_exclusive_solo ()
515 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
517 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
518 Config->set_exclusive_solo (tact->get_active());
525 MonitorSection::toggle_mute_overrides_solo ()
531 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
533 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
534 Config->set_solo_mute_override (tact->get_active());
539 MonitorSection::dim_all ()
545 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
547 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
548 _monitor->set_dim_all (tact->get_active());
554 MonitorSection::cut_all ()
560 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
562 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
563 _monitor->set_cut_all (tact->get_active());
568 MonitorSection::mono ()
574 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
576 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
577 _monitor->set_mono (tact->get_active());
582 MonitorSection::cut_channel (uint32_t chn)
589 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
591 --chn; // 0-based in backend
593 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
595 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
596 _monitor->set_cut (chn, tact->get_active());
601 MonitorSection::dim_channel (uint32_t chn)
608 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
610 --chn; // 0-based in backend
612 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
614 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
615 _monitor->set_dim (chn, tact->get_active());
621 MonitorSection::solo_channel (uint32_t chn)
628 snprintf (buf, sizeof (buf), "monitor-solo-%u", chn);
630 --chn; // 0-based in backend
632 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
634 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
635 _monitor->set_solo (chn, tact->get_active());
641 MonitorSection::invert_channel (uint32_t chn)
648 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
650 --chn; // 0-based in backend
652 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
654 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
655 _monitor->set_polarity (chn, tact->get_active());
660 MonitorSection::register_actions ()
664 Glib::RefPtr<Action> act;
666 monitor_actions = ActionGroup::create (X_("Monitor"));
667 ActionManager::add_action_group (monitor_actions);
669 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", "Switch monitor to mono",
670 sigc::mem_fun (*this, &MonitorSection::mono));
672 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", "Cut monitor",
673 sigc::mem_fun (*this, &MonitorSection::cut_all));
675 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", "Dim monitor",
676 sigc::mem_fun (*this, &MonitorSection::dim_all));
678 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", "Toggle exclusive solo mode",
679 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
681 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
682 tact->set_active (Config->get_exclusive_solo());
684 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", "Toggle mute overrides solo mode",
685 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
687 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
688 tact->set_active (Config->get_solo_mute_override());
691 /* note the 1-based counting (for naming - backend uses 0-based) */
693 for (uint32_t chn = 1; chn <= 16; ++chn) {
695 action_name = string_compose (X_("monitor-cut-%1"), chn);
696 action_descr = string_compose (_("Cut monitor channel %1"), chn);
697 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
698 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
700 action_name = string_compose (X_("monitor-dim-%1"), chn);
701 action_descr = string_compose (_("Dim monitor channel %1"), chn+1);
702 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
703 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
705 action_name = string_compose (X_("monitor-solo-%1"), chn);
706 action_descr = string_compose (_("Solo monitor channel %1"), chn+1);
707 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
708 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
710 action_name = string_compose (X_("monitor-invert-%1"), chn);
711 action_descr = string_compose (_("Invert monitor channel %1"), chn+1);
712 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
713 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
718 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
719 RadioAction::Group solo_group;
721 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", "In-place solo",
722 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
723 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", "After Fade Listen (AFL) solo",
724 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
725 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", "Pre Fade Listen (PFL) solo",
726 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
728 ActionManager::add_action_group (solo_actions);
732 MonitorSection::solo_use_in_place ()
734 /* this is driven by a toggle on a radio group, and so is invoked twice,
735 once for the item that became inactive and once for the one that became
739 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
742 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
744 Config->set_solo_control_is_listen_control (!ract->get_active());
750 MonitorSection::solo_use_afl ()
752 /* this is driven by a toggle on a radio group, and so is invoked twice,
753 once for the item that became inactive and once for the one that became
757 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
759 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
761 if (ract->get_active()) {
762 Config->set_solo_control_is_listen_control (true);
763 Config->set_listen_position (AfterFaderListen);
770 MonitorSection::solo_use_pfl ()
772 /* this is driven by a toggle on a radio group, and so is invoked twice,
773 once for the item that became inactive and once for the one that became
777 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
779 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
781 if (ract->get_active()) {
782 Config->set_solo_control_is_listen_control (true);
783 Config->set_listen_position (PreFaderListen);
790 MonitorSection::setup_knob_images ()
794 uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob");
796 snprintf (buf, 16, "#%x", (c >> 8));
797 MotionFeedback::set_lamp_color (buf);
798 big_knob_pixbuf = MotionFeedback::render_pixbuf (80);
802 error << "No usable large knob image" << endmsg;
803 throw failed_constructor ();
806 if (!big_knob_pixbuf) {
807 error << "No usable large knob image" << endmsg;
808 throw failed_constructor ();
813 little_knob_pixbuf = MotionFeedback::render_pixbuf (30);
817 error << "No usable small knob image" << endmsg;
818 throw failed_constructor ();
821 if (!little_knob_pixbuf) {
822 error << "No usable small knob image" << endmsg;
823 throw failed_constructor ();
829 MonitorSection::update_solo_model ()
831 const char* action_name = 0;
832 Glib::RefPtr<Action> act;
834 if (Config->get_solo_control_is_listen_control()) {
835 switch (Config->get_listen_position()) {
836 case AfterFaderListen:
837 action_name = X_("solo-use-afl");
840 action_name = X_("solo-use-pfl");
844 action_name = X_("solo-use-in-place");
847 act = ActionManager::get_action (X_("Solo"), action_name);
849 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
851 ract->set_active (true);
857 MonitorSection::map_state ()
859 if (!_route || !_monitor) {
863 Glib::RefPtr<Action> act;
865 update_solo_model ();
867 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
869 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
871 tact->set_active (_monitor->cut_all());
875 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
877 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
879 tact->set_active (_monitor->dim_all());
883 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
885 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
887 tact->set_active (_monitor->mono());
891 uint32_t nchans = _monitor->output_streams().n_audio();
893 assert (nchans == _channel_buttons.size ());
895 for (uint32_t n = 0; n < nchans; ++n) {
897 char action_name[32];
899 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
900 act = ActionManager::get_action (X_("Monitor"), action_name);
902 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
904 tact->set_active (_monitor->cut (n));
908 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
909 act = ActionManager::get_action (X_("Monitor"), action_name);
911 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
913 tact->set_active (_monitor->dimmed (n));
917 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
918 act = ActionManager::get_action (X_("Monitor"), action_name);
920 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
922 tact->set_active (_monitor->soloed (n));
926 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
927 act = ActionManager::get_action (X_("Monitor"), action_name);
929 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
931 tact->set_active (_monitor->inverted (n));
938 MonitorSection::do_blink (bool onoff)
941 audition_blink (onoff);
945 MonitorSection::audition_blink (bool onoff)
951 if (_session->is_auditioning()) {
953 rude_audition_button.set_active_state (Gtkmm2ext::Active);
955 rude_audition_button.unset_active_state ();
958 rude_audition_button.unset_active_state ();
963 MonitorSection::solo_blink (bool onoff)
969 if (_session->soloing() || _session->listening()) {
971 rude_solo_button.set_active_state (Gtkmm2ext::Active);
973 rude_solo_button.unset_active_state ();
976 if (_session->soloing()) {
977 if (_session->solo_isolated()) {
978 rude_iso_button.set_active_state (Gtkmm2ext::Active);
983 // rude_solo_button.set_active (false);
984 rude_solo_button.unset_active_state ();
985 rude_iso_button.unset_active_state ();
990 MonitorSection::cancel_solo (GdkEventButton*)
993 if (_session->soloing()) {
994 _session->set_solo (_session->get_routes(), false);
995 } else if (_session->listening()) {
996 _session->set_listen (_session->get_routes(), false);
1004 MonitorSection::cancel_isolate (GdkEventButton*)
1007 boost::shared_ptr<RouteList> rl (_session->get_routes ());
1008 _session->set_solo_isolated (rl, false, Session::rt_cleanup, true);
1015 MonitorSection::cancel_audition (GdkEventButton*)
1018 _session->cancel_audition();
1024 MonitorSection::parameter_changed (std::string name)
1026 if (name == "solo-control-is-listen-control") {
1027 update_solo_model ();
1028 } else if (name == "listen-position") {
1029 update_solo_model ();
1034 MonitorSection::assign_controllables ()
1036 boost::shared_ptr<Controllable> none;
1038 if (!gain_control) {
1039 /* too early - GUI controls not set up yet */
1044 solo_cut_control->set_controllable (_session->solo_cut_control());
1046 solo_cut_control->set_controllable (none);
1050 gain_control->set_controllable (_route->gain_control());
1052 gain_control->set_controllable (none);
1057 cut_all_button.set_controllable (_monitor->cut_control());
1058 cut_all_button.watch ();
1059 dim_all_button.set_controllable (_monitor->dim_control());
1060 dim_all_button.watch ();
1061 mono_button.set_controllable (_monitor->mono_control());
1062 mono_button.watch ();
1064 dim_control->set_controllable (_monitor->dim_level_control ());
1065 solo_boost_control->set_controllable (_monitor->solo_boost_control ());
1069 cut_all_button.set_controllable (none);
1070 dim_all_button.set_controllable (none);
1071 mono_button.set_controllable (none);
1073 dim_control->set_controllable (none);
1074 solo_boost_control->set_controllable (none);
1079 MonitorSection::state_id() const
1081 return "monitor-section";