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
)
40 , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // initial value is unity gain
42 , dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1) // upper+lower will be reset to match model
44 , solo_boost_adjustment (1.0, 1.0, 3.0, 0.01, 0.1) // upper and lower will be reset to match model
45 , solo_boost_control (0)
46 , solo_cut_adjustment (0.0, 0.0, 1.0, 0.01, 0.1)
47 , solo_cut_control (0)
48 , solo_in_place_button (solo_model_group
, _("SiP"))
49 , afl_button (solo_model_group
, _("AFL"))
50 , pfl_button (solo_model_group
, _("PFL"))
51 , cut_all_button (_("MUTE"))
52 , dim_all_button (_("dim"))
53 , mono_button (_("mono"))
54 , rude_solo_button (_("soloing"))
55 , rude_iso_button (_("isolated"))
56 , rude_audition_button (_("auditioning"))
57 , exclusive_solo_button (_("Exclusive"))
58 , solo_mute_override_button (_("Solo/Mute"))
60 Glib::RefPtr
<Action
> act
;
62 if (!monitor_actions
) {
64 /* do some static stuff */
77 dim_control
= new VolumeController (little_knob_pixbuf
, &dim_adjustment
, false, 30, 30);
79 HBox
* dim_packer
= manage (new HBox
);
82 spin_label
= manage (new Label (_("Dim Cut")));
83 spin_packer
= manage (new VBox
);
85 spin_packer
->set_spacing (6);
86 spin_packer
->pack_start (*dim_control
, false, false);
87 spin_packer
->pack_start (*spin_label
, false, false);
89 dim_packer
->set_spacing (12);
90 dim_packer
->pack_start (*spin_packer
, true, true);
94 rude_solo_button
.set_name ("TransportSoloAlert");
95 rude_solo_button
.show ();
97 rude_iso_button
.set_name ("MonitorIsoAlert");
98 rude_iso_button
.show ();
100 rude_audition_button
.set_name ("TransportAuditioningAlert");
101 rude_audition_button
.show ();
103 ARDOUR_UI::Blink
.connect (sigc::mem_fun (*this, &MonitorSection::do_blink
));
105 rude_solo_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo
), false);
106 UI::instance()->set_tip (rude_solo_button
, _("When active, something is soloed.\nClick to de-solo everything"));
108 rude_iso_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate
), false);
109 UI::instance()->set_tip (rude_iso_button
, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
111 rude_audition_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition
), false);
112 UI::instance()->set_tip (rude_audition_button
, _("When active, auditioning is active.\nClick to stop the audition"));
114 solo_model_box
.set_spacing (6);
115 solo_model_box
.pack_start (solo_in_place_button
, false, false);
116 solo_model_box
.pack_start (afl_button
, false, false);
117 solo_model_box
.pack_start (pfl_button
, false, false);
119 solo_in_place_button
.show ();
122 solo_model_box
.show ();
124 act
= ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
126 act
->connect_proxy (solo_in_place_button
);
129 act
= ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
131 act
->connect_proxy (afl_button
);
134 act
= ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
136 act
->connect_proxy (pfl_button
);
141 solo_boost_control
= new VolumeController (little_knob_pixbuf
, &solo_boost_adjustment
, false, 30, 30);
143 HBox
* solo_packer
= manage (new HBox
);
144 solo_packer
->set_spacing (12);
145 solo_packer
->show ();
147 spin_label
= manage (new Label (_("Solo Boost")));
148 spin_packer
= manage (new VBox
);
149 spin_packer
->show ();
150 spin_packer
->set_spacing (6);
151 spin_packer
->pack_start (*solo_boost_control
, false, false);
152 spin_packer
->pack_start (*spin_label
, false, false);
154 solo_packer
->pack_start (*spin_packer
, true, true);
158 solo_cut_control
= new VolumeController (little_knob_pixbuf
, &solo_cut_adjustment
, false, 30, 30);
160 spin_label
= manage (new Label (_("SiP Cut")));
161 spin_packer
= manage (new VBox
);
162 spin_packer
->show ();
163 spin_packer
->set_spacing (6);
164 spin_packer
->pack_start (*solo_cut_control
, false, false);
165 spin_packer
->pack_start (*spin_label
, false, false);
167 solo_packer
->pack_start (*spin_packer
, true, true);
169 exclusive_solo_button
.set_name (X_("MonitorOptButton"));
170 ARDOUR_UI::instance()->set_tip (&exclusive_solo_button
, _("Exclusive solo means that only 1 solo is active at a time"));
172 act
= ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
174 act
->connect_proxy (exclusive_solo_button
);
177 solo_mute_override_button
.set_name (X_("MonitorOptButton"));
178 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)"));
180 act
= ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
182 act
->connect_proxy (solo_mute_override_button
);
185 HBox
* solo_opt_box
= manage (new HBox
);
186 solo_opt_box
->set_spacing (12);
187 solo_opt_box
->set_homogeneous (true);
188 solo_opt_box
->pack_start (exclusive_solo_button
);
189 solo_opt_box
->pack_start (solo_mute_override_button
);
190 solo_opt_box
->show ();
192 upper_packer
.set_spacing (12);
194 Gtk::HBox
* rude_box
= manage (new HBox
);
195 rude_box
->pack_start (rude_solo_button
, true, true);
196 rude_box
->pack_start (rude_iso_button
, true, true);
198 upper_packer
.pack_start (*rude_box
, false, false);
199 upper_packer
.pack_start (rude_audition_button
, false, false);
200 upper_packer
.pack_start (solo_model_box
, false, false);
201 upper_packer
.pack_start (*solo_opt_box
, false, false);
202 upper_packer
.pack_start (*solo_packer
, false, false);
204 act
= ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
206 act
->connect_proxy (cut_all_button
);
209 act
= ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
211 act
->connect_proxy (dim_all_button
);
214 act
= ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
216 act
->connect_proxy (mono_button
);
219 cut_all_button
.set_name (X_("MonitorMuteButton"));
220 cut_all_button
.unset_flags (Gtk::CAN_FOCUS
);
221 cut_all_button
.set_size_request (50,50);
222 cut_all_button
.show ();
224 HBox
* bbox
= manage (new HBox
);
226 bbox
->set_spacing (12);
227 bbox
->pack_start (mono_button
, true, true);
228 bbox
->pack_start (dim_all_button
, true, true);
230 dim_all_button
.set_name (X_("MonitorDimButton"));
231 dim_all_button
.unset_flags (Gtk::CAN_FOCUS
);
232 mono_button
.set_name (X_("MonitorMonoButton"));
233 mono_button
.unset_flags (Gtk::CAN_FOCUS
);
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
, &gain_adjustment
, false, 80, 80);
243 spin_label
= manage (new Label (_("Gain")));
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 vpacker
.set_border_width (12);
253 vpacker
.set_spacing (12);
254 vpacker
.pack_start (upper_packer
, false, false);
255 vpacker
.pack_start (*dim_packer
, false, false);
256 vpacker
.pack_start (main_table
, false, false);
257 vpacker
.pack_start (lower_packer
, false, false);
259 hpacker
.set_border_width (12);
260 hpacker
.set_spacing (12);
261 hpacker
.pack_start (vpacker
, true, true);
263 gain_control
->show_all ();
264 dim_control
->show_all ();
265 solo_boost_control
->show_all ();
269 upper_packer
.show ();
270 lower_packer
.show ();
275 assign_controllables ();
277 _tearoff
= new TearOff (hpacker
);
279 /* if torn off, make this a normal window */
280 _tearoff
->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL
);
281 _tearoff
->tearoff_window().set_title (X_("Monitor"));
282 _tearoff
->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press
), false);
284 /* catch changes that affect us */
286 Config
->ParameterChanged
.connect (config_connection
, invalidator (*this), ui_bind (&MonitorSection::parameter_changed
, this, _1
), gui_context());
289 MonitorSection::~MonitorSection ()
291 for (ChannelButtons::iterator i
= _channel_buttons
.begin(); i
!= _channel_buttons
.end(); ++i
) {
295 _channel_buttons
.clear ();
299 delete solo_boost_control
;
304 MonitorSection::set_session (Session
* s
)
306 AxisView::set_session (s
);
310 _route
= _session
->monitor_out ();
313 /* session with monitor section */
314 _monitor
= _route
->monitor_control ();
315 assign_controllables ();
317 /* session with no monitor section */
327 control_connections
.drop_connections ();
328 rude_iso_button
.set_active (false);
329 rude_solo_button
.set_active (false);
331 assign_controllables ();
335 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
341 cut
.set_name (X_("MonitorMuteButton"));
342 dim
.set_name (X_("MonitorDimButton"));
343 solo
.set_name (X_("MixerSoloButton"));
344 invert
.set_name (X_("MonitorInvertButton"));
346 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut
.gobj()), false);
347 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim
.gobj()), false);
348 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert
.gobj()), false);
349 gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo
.gobj()), false);
351 cut
.unset_flags (Gtk::CAN_FOCUS
);
352 dim
.unset_flags (Gtk::CAN_FOCUS
);
353 solo
.unset_flags (Gtk::CAN_FOCUS
);
354 invert
.unset_flags (Gtk::CAN_FOCUS
);
358 MonitorSection::populate_buttons ()
364 Glib::RefPtr
<Action
> act
;
365 uint32_t nchans
= _monitor
->output_streams().n_audio();
367 main_table
.resize (nchans
+1, 5);
368 main_table
.set_col_spacings (6);
369 main_table
.set_row_spacings (6);
370 main_table
.set_homogeneous (true);
372 Label
* l1
= manage (new Label (X_("out")));
373 main_table
.attach (*l1
, 0, 1, 0, 1, SHRINK
|FILL
, SHRINK
|FILL
);
374 l1
= manage (new Label (X_("cut")));
375 main_table
.attach (*l1
, 1, 2, 0, 1, SHRINK
|FILL
, SHRINK
|FILL
);
376 l1
= manage (new Label (X_("dim")));
377 main_table
.attach (*l1
, 2, 3, 0, 1, SHRINK
|FILL
, SHRINK
|FILL
);
378 l1
= manage (new Label (X_("solo")));
379 main_table
.attach (*l1
, 3, 4, 0, 1, SHRINK
|FILL
, SHRINK
|FILL
);
380 l1
= manage (new Label (X_("inv")));
381 main_table
.attach (*l1
, 4, 5, 0, 1, SHRINK
|FILL
, SHRINK
|FILL
);
383 const uint32_t row_offset
= 1;
385 for (uint32_t i
= 0; i
< nchans
; ++i
) {
398 snprintf (buf
, sizeof (buf
), "%d", i
+1);
402 Label
* label
= manage (new Label (l
));
403 main_table
.attach (*label
, 0, 1, i
+row_offset
, i
+row_offset
+1, SHRINK
|FILL
, SHRINK
|FILL
);
405 ChannelButtonSet
* cbs
= new ChannelButtonSet
;
407 _channel_buttons
.push_back (cbs
);
409 main_table
.attach (cbs
->cut
, 1, 2, i
+row_offset
, i
+row_offset
+1, SHRINK
|FILL
, SHRINK
|FILL
);
410 main_table
.attach (cbs
->dim
, 2, 3, i
+row_offset
, i
+row_offset
+1, SHRINK
|FILL
, SHRINK
|FILL
);
411 main_table
.attach (cbs
->solo
, 3, 4, i
+row_offset
, i
+row_offset
+1, SHRINK
|FILL
, SHRINK
|FILL
);
412 main_table
.attach (cbs
->invert
, 4, 5, i
+row_offset
, i
+row_offset
+1, SHRINK
|FILL
, SHRINK
|FILL
);
414 snprintf (buf
, sizeof (buf
), "monitor-cut-%u", i
+1);
415 act
= ActionManager::get_action (X_("Monitor"), buf
);
417 act
->connect_proxy (cbs
->cut
);
420 snprintf (buf
, sizeof (buf
), "monitor-dim-%u", i
+1);
421 act
= ActionManager::get_action (X_("Monitor"), buf
);
423 act
->connect_proxy (cbs
->dim
);
426 snprintf (buf
, sizeof (buf
), "monitor-solo-%u", i
+1);
427 act
= ActionManager::get_action (X_("Monitor"), buf
);
429 act
->connect_proxy (cbs
->solo
);
432 snprintf (buf
, sizeof (buf
), "monitor-invert-%u", i
+1);
433 act
= ActionManager::get_action (X_("Monitor"), buf
);
435 act
->connect_proxy (cbs
->invert
);
439 main_table
.show_all ();
443 MonitorSection::set_button_names ()
445 rec_enable_button_label
.set_text ("rec");
446 mute_button_label
.set_text ("rec");
447 solo_button_label
.set_text ("rec");
451 MonitorSection::toggle_exclusive_solo ()
457 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
459 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
460 Config
->set_exclusive_solo (tact
->get_active());
467 MonitorSection::toggle_mute_overrides_solo ()
473 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
475 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
476 Config
->set_solo_mute_override (tact
->get_active());
481 MonitorSection::dim_all ()
487 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
489 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
490 _monitor
->set_dim_all (tact
->get_active());
496 MonitorSection::cut_all ()
502 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
504 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
505 _monitor
->set_cut_all (tact
->get_active());
510 MonitorSection::mono ()
516 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), "monitor-mono");
518 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
519 _monitor
->set_mono (tact
->get_active());
524 MonitorSection::cut_channel (uint32_t chn
)
531 snprintf (buf
, sizeof (buf
), "monitor-cut-%u", chn
);
533 --chn
; // 0-based in backend
535 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), buf
);
537 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
538 _monitor
->set_cut (chn
, tact
->get_active());
543 MonitorSection::dim_channel (uint32_t chn
)
550 snprintf (buf
, sizeof (buf
), "monitor-dim-%u", chn
);
552 --chn
; // 0-based in backend
554 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), buf
);
556 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
557 _monitor
->set_dim (chn
, tact
->get_active());
563 MonitorSection::solo_channel (uint32_t chn
)
570 snprintf (buf
, sizeof (buf
), "monitor-solo-%u", chn
);
572 --chn
; // 0-based in backend
574 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), buf
);
576 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
577 _monitor
->set_solo (chn
, tact
->get_active());
583 MonitorSection::invert_channel (uint32_t chn
)
590 snprintf (buf
, sizeof (buf
), "monitor-invert-%u", chn
);
592 --chn
; // 0-based in backend
594 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Monitor"), buf
);
596 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
597 _monitor
->set_polarity (chn
, tact
->get_active());
602 MonitorSection::register_actions ()
606 Glib::RefPtr
<Action
> act
;
608 monitor_actions
= ActionGroup::create (X_("Monitor"));
609 ActionManager::add_action_group (monitor_actions
);
611 ActionManager::register_toggle_action (monitor_actions
, "monitor-mono", "",
612 sigc::mem_fun (*this, &MonitorSection::mono
));
614 ActionManager::register_toggle_action (monitor_actions
, "monitor-cut-all", "",
615 sigc::mem_fun (*this, &MonitorSection::cut_all
));
617 ActionManager::register_toggle_action (monitor_actions
, "monitor-dim-all", "",
618 sigc::mem_fun (*this, &MonitorSection::dim_all
));
620 act
= ActionManager::register_toggle_action (monitor_actions
, "toggle-exclusive-solo", "",
621 sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo
));
623 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
624 tact
->set_active (Config
->get_exclusive_solo());
626 act
= ActionManager::register_toggle_action (monitor_actions
, "toggle-mute-overrides-solo", "",
627 sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo
));
629 tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic(act
);
630 tact
->set_active (Config
->get_solo_mute_override());
633 /* note the 1-based counting (for naming - backend uses 0-based) */
635 for (uint32_t chn
= 1; chn
<= 16; ++chn
) {
637 /* for the time being, do not use the action description because it always
638 shows up in the buttons, which is undesirable.
641 action_name
= string_compose (X_("monitor-cut-%1"), chn
);
642 action_descr
= string_compose (_("Cut Monitor Chn %1"), chn
);
643 ActionManager::register_toggle_action (monitor_actions
, action_name
.c_str(), "",
644 sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel
), chn
));
646 action_name
= string_compose (X_("monitor-dim-%1"), chn
);
647 action_descr
= string_compose (_("Dim Monitor Chn %1"), chn
+1);
648 ActionManager::register_toggle_action (monitor_actions
, action_name
.c_str(), "",
649 sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel
), chn
));
651 action_name
= string_compose (X_("monitor-solo-%1"), chn
);
652 action_descr
= string_compose (_("Solo Monitor Chn %1"), chn
);
653 ActionManager::register_toggle_action (monitor_actions
, action_name
.c_str(), "",
654 sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel
), chn
));
656 action_name
= string_compose (X_("monitor-invert-%1"), chn
);
657 action_descr
= string_compose (_("Invert Monitor Chn %1"), chn
);
658 ActionManager::register_toggle_action (monitor_actions
, action_name
.c_str(), "",
659 sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel
), chn
));
664 Glib::RefPtr
<ActionGroup
> solo_actions
= ActionGroup::create (X_("Solo"));
665 RadioAction::Group solo_group
;
667 ActionManager::register_radio_action (solo_actions
, solo_group
, "solo-use-in-place", "",
668 sigc::mem_fun (*this, &MonitorSection::solo_use_in_place
));
669 ActionManager::register_radio_action (solo_actions
, solo_group
, "solo-use-afl", "",
670 sigc::mem_fun (*this, &MonitorSection::solo_use_afl
));
671 ActionManager::register_radio_action (solo_actions
, solo_group
, "solo-use-pfl", "",
672 sigc::mem_fun (*this, &MonitorSection::solo_use_pfl
));
674 ActionManager::add_action_group (solo_actions
);
678 MonitorSection::solo_use_in_place ()
680 /* this is driven by a toggle on a radio group, and so is invoked twice,
681 once for the item that became inactive and once for the one that became
685 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Solo"), X_("solo-use-in-place"));
688 Glib::RefPtr
<RadioAction
> ract
= Glib::RefPtr
<RadioAction
>::cast_dynamic (act
);
690 Config
->set_solo_control_is_listen_control (!ract
->get_active());
696 MonitorSection::solo_use_afl ()
698 /* this is driven by a toggle on a radio group, and so is invoked twice,
699 once for the item that became inactive and once for the one that became
703 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
705 Glib::RefPtr
<RadioAction
> ract
= Glib::RefPtr
<RadioAction
>::cast_dynamic (act
);
707 if (ract
->get_active()) {
708 Config
->set_listen_position (AfterFaderListen
);
709 Config
->set_solo_control_is_listen_control (true);
716 MonitorSection::solo_use_pfl ()
718 /* this is driven by a toggle on a radio group, and so is invoked twice,
719 once for the item that became inactive and once for the one that became
723 Glib::RefPtr
<Action
> act
= ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
725 Glib::RefPtr
<RadioAction
> ract
= Glib::RefPtr
<RadioAction
>::cast_dynamic (act
);
727 if (ract
->get_active()) {
728 Config
->set_listen_position (PreFaderListen
);
729 Config
->set_solo_control_is_listen_control (true);
736 MonitorSection::setup_knob_images ()
740 big_knob_pixbuf
= MotionFeedback::render_pixbuf (80);
744 error
<< "No usable large knob image" << endmsg
;
745 throw failed_constructor ();
748 if (!big_knob_pixbuf
) {
749 error
<< "No usable large knob image" << endmsg
;
750 throw failed_constructor ();
755 little_knob_pixbuf
= MotionFeedback::render_pixbuf (30);
759 error
<< "No usable small knob image" << endmsg
;
760 throw failed_constructor ();
763 if (!little_knob_pixbuf
) {
764 error
<< "No usable small knob image" << endmsg
;
765 throw failed_constructor ();
771 MonitorSection::nonlinear_gain_printer (SpinButton
* button
)
773 double val
= button
->get_adjustment()->get_value();
775 snprintf (buf
, sizeof (buf
), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (val
)));
776 button
->set_text (buf
);
781 MonitorSection::linear_gain_printer (SpinButton
* button
)
783 double val
= button
->get_adjustment()->get_value();
785 snprintf (buf
, sizeof (buf
), "%.1f", accurate_coefficient_to_dB (val
));
786 button
->set_text (buf
);
791 MonitorSection::update_solo_model ()
793 const char* action_name
;
794 Glib::RefPtr
<Action
> act
;
796 if (Config
->get_solo_control_is_listen_control()) {
797 switch (Config
->get_listen_position()) {
798 case AfterFaderListen
:
799 action_name
= X_("solo-use-afl");
802 action_name
= X_("solo-use-pfl");
806 action_name
= X_("solo-use-in-place");
809 act
= ActionManager::get_action (X_("Solo"), action_name
);
811 Glib::RefPtr
<RadioAction
> ract
= Glib::RefPtr
<RadioAction
>::cast_dynamic (act
);
813 ract
->set_active (true);
819 MonitorSection::map_state ()
821 if (!_route
|| !_monitor
) {
825 gain_control
->get_adjustment()->set_value (gain_to_slider_position (_route
->gain_control()->get_value()));
826 dim_control
->get_adjustment()->set_value (_monitor
->dim_level());
827 solo_boost_control
->get_adjustment()->set_value (_monitor
->solo_boost_level());
829 Glib::RefPtr
<Action
> act
;
831 update_solo_model ();
833 act
= ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
835 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
837 tact
->set_active (_monitor
->cut_all());
841 act
= ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
843 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
845 tact
->set_active (_monitor
->dim_all());
849 act
= ActionManager::get_action (X_("Monitor"), "monitor-mono");
851 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
853 tact
->set_active (_monitor
->mono());
857 uint32_t nchans
= _monitor
->output_streams().n_audio();
859 assert (nchans
== _channel_buttons
.size ());
861 for (uint32_t n
= 0; n
< nchans
; ++n
) {
863 char action_name
[32];
865 snprintf (action_name
, sizeof (action_name
), "monitor-cut-%u", n
+1);
866 act
= ActionManager::get_action (X_("Monitor"), action_name
);
868 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
870 tact
->set_active (_monitor
->cut (n
));
874 snprintf (action_name
, sizeof (action_name
), "monitor-dim-%u", n
+1);
875 act
= ActionManager::get_action (X_("Monitor"), action_name
);
877 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
879 tact
->set_active (_monitor
->dimmed (n
));
883 snprintf (action_name
, sizeof (action_name
), "monitor-solo-%u", n
+1);
884 act
= ActionManager::get_action (X_("Monitor"), action_name
);
886 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
888 tact
->set_active (_monitor
->soloed (n
));
892 snprintf (action_name
, sizeof (action_name
), "monitor-invert-%u", n
+1);
893 act
= ActionManager::get_action (X_("Monitor"), action_name
);
895 Glib::RefPtr
<ToggleAction
> tact
= Glib::RefPtr
<ToggleAction
>::cast_dynamic (act
);
897 tact
->set_active (_monitor
->inverted (n
));
904 MonitorSection::do_blink (bool onoff
)
907 audition_blink (onoff
);
911 MonitorSection::audition_blink (bool onoff
)
917 if (_session
->is_auditioning()) {
919 rude_audition_button
.set_state (STATE_ACTIVE
);
921 rude_audition_button
.set_state (STATE_NORMAL
);
924 rude_audition_button
.set_active (false);
925 rude_audition_button
.set_state (STATE_NORMAL
);
930 MonitorSection::solo_blink (bool onoff
)
936 if (_session
->soloing() || _session
->listening()) {
938 rude_solo_button
.set_state (STATE_ACTIVE
);
940 rude_solo_button
.set_state (STATE_NORMAL
);
943 if (_session
->soloing()) {
944 rude_iso_button
.set_active (_session
->solo_isolated());
948 // rude_solo_button.set_active (false);
949 rude_solo_button
.set_state (STATE_NORMAL
);
950 rude_iso_button
.set_active (false);
955 MonitorSection::cancel_solo (GdkEventButton
*)
958 if (_session
->soloing()) {
959 _session
->set_solo (_session
->get_routes(), false);
960 } else if (_session
->listening()) {
961 _session
->set_listen (_session
->get_routes(), false);
969 MonitorSection::cancel_isolate (GdkEventButton
*)
972 boost::shared_ptr
<RouteList
> rl (_session
->get_routes ());
973 _session
->set_solo_isolated (rl
, false, Session::rt_cleanup
, true);
980 MonitorSection::cancel_audition (GdkEventButton
*)
983 _session
->cancel_audition();
989 MonitorSection::solo_cut_changed ()
991 Config
->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment
.get_value()));
995 MonitorSection::parameter_changed (std::string name
)
997 if (name
== "solo-control-is-listen-control" ||
998 name
== "listen-position") {
999 update_solo_model ();
1000 } else if (name
== "solo-mute-gain") {
1001 solo_cut_adjustment
.set_value (gain_to_slider_position (Config
->get_solo_mute_gain()));
1006 MonitorSection::assign_controllables ()
1008 boost::shared_ptr
<Controllable
> none
;
1010 if (!gain_control
) {
1011 /* too early - GUI controls not set up yet */
1016 boost::shared_ptr
<Controllable
> c
= _session
->solo_cut_control();
1017 solo_cut_control
->set_controllable (c
);
1018 solo_cut_control
->get_adjustment()->set_value (c
->get_value());
1020 solo_cut_control
->set_controllable (none
);
1024 gain_control
->set_controllable (_route
->gain_control());
1026 gain_control
->set_controllable (none
);
1031 cut_all_button
.set_controllable (_monitor
->cut_control());
1032 cut_all_button
.watch ();
1033 dim_all_button
.set_controllable (_monitor
->dim_control());
1034 dim_all_button
.watch ();
1035 mono_button
.set_controllable (_monitor
->mono_control());
1036 mono_button
.watch ();
1038 boost::shared_ptr
<Controllable
> c (_monitor
->dim_level_control ());
1040 dim_control
->set_controllable (c
);
1041 dim_adjustment
.set_lower (c
->lower());
1042 dim_adjustment
.set_upper (c
->upper());
1044 c
= _monitor
->solo_boost_control ();
1045 solo_boost_control
->set_controllable (c
);
1046 solo_boost_adjustment
.set_lower (c
->lower());
1047 solo_boost_adjustment
.set_upper (c
->upper());
1051 cut_all_button
.set_controllable (none
);
1052 dim_all_button
.set_controllable (none
);
1053 mono_button
.set_controllable (none
);
1055 dim_control
->set_controllable (none
);
1056 solo_boost_control
->set_controllable (none
);