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)
42 , solo_boost_control (0)
43 , solo_cut_control (0)
44 , solo_in_place_button (solo_model_group, _("SiP"))
45 , afl_button (solo_model_group, _("AFL"))
46 , pfl_button (solo_model_group, _("PFL"))
47 , cut_all_button (ArdourButton::led_default_elements)
48 , dim_all_button (ArdourButton::led_default_elements)
49 , mono_button (ArdourButton::led_default_elements)
50 , exclusive_solo_button (ArdourButton::led_default_elements)
51 , solo_mute_override_button (ArdourButton::led_default_elements)
53 Glib::RefPtr<Action> act;
55 if (!monitor_actions) {
57 /* do some static stuff */
70 dim_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
72 HBox* dim_packer = manage (new HBox);
75 spin_label = manage (new Label (_("Dim")));
76 spin_packer = manage (new VBox);
78 spin_packer->set_spacing (6);
79 spin_packer->pack_start (*dim_control, false, false);
80 spin_packer->pack_start (*spin_label, false, false);
82 dim_packer->set_spacing (12);
83 dim_packer->pack_start (*spin_packer, true, false);
87 rude_solo_button.set_text (_("soloing"));
88 rude_solo_button.set_name ("rude solo");
89 rude_solo_button.show ();
91 rude_iso_button.set_text (_("isolated"));
92 rude_iso_button.set_name ("rude isolate");
93 rude_iso_button.show ();
95 rude_audition_button.set_text (_("auditioning"));
96 rude_audition_button.set_name ("rude audition");
97 rude_audition_button.show ();
99 ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
101 rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo));
102 UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
104 rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate));
105 UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
107 rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition));
108 UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
110 solo_model_box.set_spacing (6);
111 solo_model_box.pack_start (solo_in_place_button, false, false);
112 solo_model_box.pack_start (afl_button, false, false);
113 solo_model_box.pack_start (pfl_button, false, false);
115 solo_in_place_button.show ();
118 solo_model_box.show ();
120 act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
122 act->connect_proxy (solo_in_place_button);
125 act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
127 act->connect_proxy (afl_button);
130 act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
132 act->connect_proxy (pfl_button);
137 solo_boost_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.01, 0.1, true, 30, 30, true);
139 HBox* solo_packer = manage (new HBox);
140 solo_packer->set_spacing (12);
141 solo_packer->show ();
143 spin_label = manage (new Label (_("Solo Boost")));
144 spin_packer = manage (new VBox);
145 spin_packer->show ();
146 spin_packer->set_spacing (6);
147 spin_packer->pack_start (*solo_boost_control, false, false);
148 spin_packer->pack_start (*spin_label, false, false);
150 solo_packer->pack_start (*spin_packer, false, true);
154 solo_cut_control = new VolumeController (little_knob_pixbuf, boost::shared_ptr<Controllable>(), 0.0, 0.1, 0.5, true, 30, 30, true);
156 spin_label = manage (new Label (_("SiP Cut")));
157 spin_packer = manage (new VBox);
158 spin_packer->show ();
159 spin_packer->set_spacing (6);
160 spin_packer->pack_start (*solo_cut_control, false, false);
161 spin_packer->pack_start (*spin_label, false, false);
163 solo_packer->pack_start (*spin_packer, false, true);
165 exclusive_solo_button.set_text (_("Exclusive"));
166 exclusive_solo_button.set_name (X_("monitor solo exclusive"));
167 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
169 act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
171 exclusive_solo_button.set_related_action (act);
174 solo_mute_override_button.set_text (_("Solo/Mute"));
175 solo_mute_override_button.set_name (X_("monitor solo override"));
176 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)"));
178 act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
180 solo_mute_override_button.set_related_action (act);
183 HBox* solo_opt_box = manage (new HBox);
184 solo_opt_box->set_spacing (12);
185 solo_opt_box->set_homogeneous (true);
186 solo_opt_box->pack_start (exclusive_solo_button);
187 solo_opt_box->pack_start (solo_mute_override_button);
188 solo_opt_box->show ();
190 upper_packer.set_spacing (12);
192 Gtk::HBox* rude_box = manage (new HBox);
193 rude_box->pack_start (rude_solo_button, true, true);
194 rude_box->pack_start (rude_iso_button, true, true);
196 upper_packer.pack_start (*rude_box, false, false);
197 upper_packer.pack_start (rude_audition_button, false, false);
198 upper_packer.pack_start (solo_model_box, false, false);
199 upper_packer.pack_start (*solo_opt_box, false, false);
200 upper_packer.pack_start (*solo_packer, false, false);
202 cut_all_button.set_text (_("MUTE"));
203 cut_all_button.set_name ("monitor section cut");
204 cut_all_button.set_name (X_("monitor section cut"));
205 cut_all_button.set_size_request (50,50);
206 cut_all_button.show ();
208 act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
210 cut_all_button.set_related_action (act);
213 dim_all_button.set_text (_("dim"));
214 dim_all_button.set_name ("monitor section dim");
215 // dim_all_button.set_size_request (50,50);
216 act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
218 dim_all_button.set_related_action (act);
221 mono_button.set_text (_("mono"));
222 mono_button.set_name ("monitor section mono");
223 // mono_button.set_size_request (50,50);
224 act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
226 mono_button.set_related_action (act);
229 HBox* bbox = manage (new HBox);
231 bbox->set_spacing (12);
232 bbox->pack_start (mono_button, true, true);
233 bbox->pack_start (dim_all_button, true, true);
235 lower_packer.set_spacing (12);
236 lower_packer.pack_start (*bbox, false, false);
237 lower_packer.pack_start (cut_all_button, false, false);
241 gain_control = new VolumeController (big_knob_pixbuf, boost::shared_ptr<Controllable>(), 1.0, 0.01, 0.1, true, 80, 80, false);
243 spin_label = manage (new Label (_("Monitor")));
244 spin_packer = manage (new VBox);
245 spin_packer->show ();
246 spin_packer->set_spacing (6);
247 spin_packer->pack_start (*gain_control, false, false);
248 spin_packer->pack_start (*spin_label, false, false);
250 lower_packer.pack_start (*spin_packer, true, true);
252 main_table_scroller.add (main_table);
253 main_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
254 main_table_scroller.set_size_request (-1, 150);
255 main_table_scroller.set_shadow_type (Gtk::SHADOW_NONE);
256 main_table_scroller.show ();
258 vpacker.set_border_width (12);
259 vpacker.set_spacing (12);
260 vpacker.pack_start (upper_packer, false, false);
261 vpacker.pack_start (*dim_packer, false, false);
262 vpacker.pack_start (main_table_scroller, false, false);
263 vpacker.pack_start (lower_packer, false, false);
265 hpacker.set_border_width (12);
266 hpacker.set_spacing (12);
267 hpacker.pack_start (vpacker, true, true);
269 gain_control->show_all ();
270 dim_control->show_all ();
271 solo_boost_control->show_all ();
275 upper_packer.show ();
276 lower_packer.show ();
281 assign_controllables ();
283 _tearoff = new TearOff (hpacker);
285 /* if torn off, make this a normal window */
286 _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
287 _tearoff->tearoff_window().set_title (X_("Monitor"));
288 _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
290 /* catch changes that affect us */
292 Config->ParameterChanged.connect (config_connection, invalidator (*this), ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context());
295 MonitorSection::~MonitorSection ()
297 for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
301 _channel_buttons.clear ();
305 delete solo_boost_control;
310 MonitorSection::set_session (Session* s)
312 AxisView::set_session (s);
316 _route = _session->monitor_out ();
319 /* session with monitor section */
320 _monitor = _route->monitor_control ();
321 assign_controllables ();
323 /* session with no monitor section */
333 control_connections.drop_connections ();
334 rude_iso_button.unset_active_state ();
335 rude_solo_button.unset_active_state ();
337 assign_controllables ();
341 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
342 : cut (ArdourButton::just_led_default_elements)
343 , dim (ArdourButton::just_led_default_elements)
344 , solo (ArdourButton::just_led_default_elements)
345 , invert (ArdourButton::just_led_default_elements)
347 cut.set_diameter (3);
348 dim.set_diameter (3);
349 solo.set_diameter (3);
350 invert.set_diameter (3);
352 cut.set_name (X_("monitor section cut"));
353 dim.set_name (X_("monitor section dim"));
354 solo.set_name (X_("monitor section solo"));
355 invert.set_name (X_("monitor section invert"));
357 cut.unset_flags (Gtk::CAN_FOCUS);
358 dim.unset_flags (Gtk::CAN_FOCUS);
359 solo.unset_flags (Gtk::CAN_FOCUS);
360 invert.unset_flags (Gtk::CAN_FOCUS);
364 MonitorSection::populate_buttons ()
370 Glib::RefPtr<Action> act;
371 uint32_t nchans = _monitor->output_streams().n_audio();
373 main_table.resize (nchans+1, 5);
374 main_table.set_col_spacings (6);
375 main_table.set_row_spacings (6);
376 main_table.set_homogeneous (true);
378 Label* l1 = manage (new Label (X_("out")));
379 main_table.attach (*l1, 0, 1, 0, 1, SHRINK|FILL, SHRINK|FILL);
380 l1 = manage (new Label (X_("cut")));
381 main_table.attach (*l1, 1, 2, 0, 1, SHRINK|FILL, SHRINK|FILL);
382 l1 = manage (new Label (X_("dim")));
383 main_table.attach (*l1, 2, 3, 0, 1, SHRINK|FILL, SHRINK|FILL);
384 l1 = manage (new Label (X_("solo")));
385 main_table.attach (*l1, 3, 4, 0, 1, SHRINK|FILL, SHRINK|FILL);
386 l1 = manage (new Label (X_("inv")));
387 main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL);
389 const uint32_t row_offset = 1;
391 for (uint32_t i = 0; i < nchans; ++i) {
404 snprintf (buf, sizeof (buf), "%d", i+1);
408 Label* label = manage (new Label (l));
409 main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
411 ChannelButtonSet* cbs = new ChannelButtonSet;
413 _channel_buttons.push_back (cbs);
415 main_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
416 main_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
417 main_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
418 main_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
420 snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
421 act = ActionManager::get_action (X_("Monitor"), buf);
423 cbs->cut.set_related_action (act);
426 snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
427 act = ActionManager::get_action (X_("Monitor"), buf);
429 cbs->dim.set_related_action (act);
432 snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
433 act = ActionManager::get_action (X_("Monitor"), buf);
435 cbs->solo.set_related_action (act);
438 snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
439 act = ActionManager::get_action (X_("Monitor"), buf);
441 cbs->invert.set_related_action (act);
445 main_table.show_all ();
449 MonitorSection::set_button_names ()
451 rec_enable_button_label.set_text ("rec");
452 mute_button_label.set_text ("rec");
453 solo_button_label.set_text ("rec");
457 MonitorSection::toggle_exclusive_solo ()
463 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
465 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
466 Config->set_exclusive_solo (tact->get_active());
473 MonitorSection::toggle_mute_overrides_solo ()
479 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
481 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
482 Config->set_solo_mute_override (tact->get_active());
487 MonitorSection::dim_all ()
493 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
495 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
496 _monitor->set_dim_all (tact->get_active());
502 MonitorSection::cut_all ()
508 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
510 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
511 _monitor->set_cut_all (tact->get_active());
516 MonitorSection::mono ()
522 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
524 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
525 _monitor->set_mono (tact->get_active());
530 MonitorSection::cut_channel (uint32_t chn)
537 snprintf (buf, sizeof (buf), "monitor-cut-%u", chn);
539 --chn; // 0-based in backend
541 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
543 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
544 _monitor->set_cut (chn, tact->get_active());
549 MonitorSection::dim_channel (uint32_t chn)
556 snprintf (buf, sizeof (buf), "monitor-dim-%u", chn);
558 --chn; // 0-based in backend
560 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
562 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
563 _monitor->set_dim (chn, tact->get_active());
569 MonitorSection::solo_channel (uint32_t chn)
576 snprintf (buf, sizeof (buf), "monitor-solo-%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_solo (chn, tact->get_active());
589 MonitorSection::invert_channel (uint32_t chn)
596 snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
598 --chn; // 0-based in backend
600 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
602 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
603 _monitor->set_polarity (chn, tact->get_active());
608 MonitorSection::register_actions ()
612 Glib::RefPtr<Action> act;
614 monitor_actions = ActionGroup::create (X_("Monitor"));
615 ActionManager::add_action_group (monitor_actions);
617 ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", "Switch monitor to mono",
618 sigc::mem_fun (*this, &MonitorSection::mono));
620 ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", "Cut monitor",
621 sigc::mem_fun (*this, &MonitorSection::cut_all));
623 ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", "Dim monitor",
624 sigc::mem_fun (*this, &MonitorSection::dim_all));
626 act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", "Toggle exclusive solo mode",
627 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo));
629 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
630 tact->set_active (Config->get_exclusive_solo());
632 act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", "Toggle mute overrides solo mode",
633 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
635 tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
636 tact->set_active (Config->get_solo_mute_override());
639 /* note the 1-based counting (for naming - backend uses 0-based) */
641 for (uint32_t chn = 1; chn <= 16; ++chn) {
643 action_name = string_compose (X_("monitor-cut-%1"), chn);
644 action_descr = string_compose (_("Cut monitor channel %1"), chn);
645 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
646 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
648 action_name = string_compose (X_("monitor-dim-%1"), chn);
649 action_descr = string_compose (_("Dim monitor channel %1"), chn+1);
650 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
651 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
653 action_name = string_compose (X_("monitor-solo-%1"), chn);
654 action_descr = string_compose (_("Solo monitor channel %1"), chn+1);
655 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
656 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
658 action_name = string_compose (X_("monitor-invert-%1"), chn);
659 action_descr = string_compose (_("Invert monitor channel %1"), chn+1);
660 ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", action_descr.c_str(),
661 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
666 Glib::RefPtr<ActionGroup> solo_actions = ActionGroup::create (X_("Solo"));
667 RadioAction::Group solo_group;
669 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", "", "In-place solo",
670 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
671 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", "", "After Fade Listen (AFL) solo",
672 sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
673 ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", "", "Pre Fade Listen (PFL) solo",
674 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
676 ActionManager::add_action_group (solo_actions);
680 MonitorSection::solo_use_in_place ()
682 /* this is driven by a toggle on a radio group, and so is invoked twice,
683 once for the item that became inactive and once for the one that became
687 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
690 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
692 Config->set_solo_control_is_listen_control (!ract->get_active());
698 MonitorSection::solo_use_afl ()
700 /* this is driven by a toggle on a radio group, and so is invoked twice,
701 once for the item that became inactive and once for the one that became
705 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
707 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
709 if (ract->get_active()) {
710 Config->set_listen_position (AfterFaderListen);
711 Config->set_solo_control_is_listen_control (true);
718 MonitorSection::solo_use_pfl ()
720 /* this is driven by a toggle on a radio group, and so is invoked twice,
721 once for the item that became inactive and once for the one that became
725 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
727 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
729 if (ract->get_active()) {
730 Config->set_listen_position (PreFaderListen);
731 Config->set_solo_control_is_listen_control (true);
738 MonitorSection::setup_knob_images ()
742 uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob");
744 snprintf (buf, 16, "#%x", (c >> 8));
745 cerr << "Motion feedback using " << buf << endl;
746 MotionFeedback::set_lamp_color (buf);
747 big_knob_pixbuf = MotionFeedback::render_pixbuf (80);
751 error << "No usable large knob image" << endmsg;
752 throw failed_constructor ();
755 if (!big_knob_pixbuf) {
756 error << "No usable large knob image" << endmsg;
757 throw failed_constructor ();
762 little_knob_pixbuf = MotionFeedback::render_pixbuf (30);
766 error << "No usable small knob image" << endmsg;
767 throw failed_constructor ();
770 if (!little_knob_pixbuf) {
771 error << "No usable small knob image" << endmsg;
772 throw failed_constructor ();
778 MonitorSection::update_solo_model ()
780 const char* action_name = 0;
781 Glib::RefPtr<Action> act;
783 if (Config->get_solo_control_is_listen_control()) {
784 switch (Config->get_listen_position()) {
785 case AfterFaderListen:
786 action_name = X_("solo-use-afl");
789 action_name = X_("solo-use-pfl");
793 action_name = X_("solo-use-in-place");
796 act = ActionManager::get_action (X_("Solo"), action_name);
798 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
800 ract->set_active (true);
806 MonitorSection::map_state ()
808 if (!_route || !_monitor) {
812 Glib::RefPtr<Action> act;
814 update_solo_model ();
816 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
818 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
820 tact->set_active (_monitor->cut_all());
824 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
826 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
828 tact->set_active (_monitor->dim_all());
832 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
834 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
836 tact->set_active (_monitor->mono());
840 uint32_t nchans = _monitor->output_streams().n_audio();
842 assert (nchans == _channel_buttons.size ());
844 for (uint32_t n = 0; n < nchans; ++n) {
846 char action_name[32];
848 snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n+1);
849 act = ActionManager::get_action (X_("Monitor"), action_name);
851 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
853 tact->set_active (_monitor->cut (n));
857 snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n+1);
858 act = ActionManager::get_action (X_("Monitor"), action_name);
860 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
862 tact->set_active (_monitor->dimmed (n));
866 snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n+1);
867 act = ActionManager::get_action (X_("Monitor"), action_name);
869 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
871 tact->set_active (_monitor->soloed (n));
875 snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n+1);
876 act = ActionManager::get_action (X_("Monitor"), action_name);
878 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
880 tact->set_active (_monitor->inverted (n));
887 MonitorSection::do_blink (bool onoff)
890 audition_blink (onoff);
894 MonitorSection::audition_blink (bool onoff)
900 if (_session->is_auditioning()) {
902 rude_audition_button.set_active_state (CairoWidget::Active);
904 rude_audition_button.unset_active_state ();
907 rude_audition_button.unset_active_state ();
912 MonitorSection::solo_blink (bool onoff)
918 if (_session->soloing() || _session->listening()) {
920 rude_solo_button.set_active_state (CairoWidget::Active);
922 rude_solo_button.unset_active_state ();
925 if (_session->soloing()) {
926 if (_session->solo_isolated()) {
927 rude_iso_button.set_active_state (CairoWidget::Active);
932 // rude_solo_button.set_active (false);
933 rude_solo_button.unset_active_state ();
934 rude_iso_button.unset_active_state ();
939 MonitorSection::cancel_solo (GdkEventButton*)
942 if (_session->soloing()) {
943 _session->set_solo (_session->get_routes(), false);
944 } else if (_session->listening()) {
945 _session->set_listen (_session->get_routes(), false);
953 MonitorSection::cancel_isolate (GdkEventButton*)
956 boost::shared_ptr<RouteList> rl (_session->get_routes ());
957 _session->set_solo_isolated (rl, false, Session::rt_cleanup, true);
964 MonitorSection::cancel_audition (GdkEventButton*)
967 _session->cancel_audition();
973 MonitorSection::parameter_changed (std::string name)
975 if (name == "solo-control-is-listen-control" ||
976 name == "listen-position") {
977 update_solo_model ();
982 MonitorSection::assign_controllables ()
984 boost::shared_ptr<Controllable> none;
987 /* too early - GUI controls not set up yet */
992 solo_cut_control->set_controllable (_session->solo_cut_control());
994 solo_cut_control->set_controllable (none);
998 gain_control->set_controllable (_route->gain_control());
1000 gain_control->set_controllable (none);
1005 cut_all_button.set_controllable (_monitor->cut_control());
1006 cut_all_button.watch ();
1007 dim_all_button.set_controllable (_monitor->dim_control());
1008 dim_all_button.watch ();
1009 mono_button.set_controllable (_monitor->mono_control());
1010 mono_button.watch ();
1012 dim_control->set_controllable (_monitor->dim_level_control ());
1013 solo_boost_control->set_controllable (_monitor->solo_boost_control ());
1017 cut_all_button.set_controllable (none);
1018 dim_all_button.set_controllable (none);
1019 mono_button.set_controllable (none);
1021 dim_control->set_controllable (none);
1022 solo_boost_control->set_controllable (none);
1027 MonitorSection::state_id() const
1029 return "monitor-section";