2 Copyright (C) 2000-2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <sigc++/bind.h>
25 #include "pbd/convert.h"
26 #include "pbd/enumwriter.h"
27 #include "pbd/replace_all.h"
28 #include "pbd/stacktrace.h"
30 #include <gtkmm2ext/gtk_ui.h>
31 #include <gtkmm2ext/utils.h>
32 #include <gtkmm2ext/choice.h>
33 #include <gtkmm2ext/doi.h>
34 #include <gtkmm2ext/slider_controller.h>
35 #include <gtkmm2ext/bindable_button.h>
37 #include "ardour/ardour.h"
38 #include "ardour/amp.h"
39 #include "ardour/session.h"
40 #include "ardour/audioengine.h"
41 #include "ardour/internal_send.h"
42 #include "ardour/route.h"
43 #include "ardour/route_group.h"
44 #include "ardour/audio_track.h"
45 #include "ardour/midi_track.h"
46 #include "ardour/pannable.h"
47 #include "ardour/panner.h"
48 #include "ardour/panner_shell.h"
49 #include "ardour/send.h"
50 #include "ardour/processor.h"
51 #include "ardour/profile.h"
52 #include "ardour/ladspa_plugin.h"
53 #include "ardour/user_bundle.h"
54 #include "ardour/port.h"
56 #include "ardour_ui.h"
57 #include "ardour_dialog.h"
58 #include "mixer_strip.h"
61 #include "ardour_button.h"
62 #include "public_editor.h"
64 #include "io_selector.h"
66 #include "gui_thread.h"
67 #include "route_group_menu.h"
71 using namespace ARDOUR;
74 using namespace Gtkmm2ext;
77 int MixerStrip::scrollbar_height = 0;
78 PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion;
80 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
84 , _mixer_owned (in_mixer)
85 , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
88 , button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL))
90 , rec_solo_table (2, 2)
91 , top_button_table (1, 2)
92 , middle_button_table (1, 2)
93 , bottom_button_table (1, 2)
94 , meter_point_label (_("pre"))
95 , midi_input_enable_button (0)
96 , _comment_button (_("Comments"))
97 , _visibility (X_("mixer-strip-visibility"))
102 /* the editor mixer strip: don't destroy it every time
103 the underlying route goes away.
106 self_destruct = false;
110 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
114 , _mixer_owned (in_mixer)
115 , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
118 , button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL))
119 , button_table (3, 1)
120 , middle_button_table (1, 2)
121 , bottom_button_table (1, 2)
122 , meter_point_label (_("pre"))
123 , midi_input_enable_button (0)
124 , _comment_button (_("Comments"))
125 , _visibility (X_("mixer-strip-visibility"))
138 ignore_comment_edit = false;
139 ignore_toggle = false;
145 /* the length of this string determines the width of the mixer strip when it is set to `wide' */
146 longest_label = "longest label";
150 img = manage (new Gtk::Image (::get_icon("strip_width")));
153 width_button.add (*img);
154 ARDOUR_UI::instance()->set_tip (&width_button, _("Toggle the width of this mixer strip"));
156 img = manage (new Gtk::Image (::get_icon("hide")));
159 hide_button.add (*img);
160 ARDOUR_UI::instance()->set_tip (&hide_button, _("Hide this mixer strip"));
162 input_label.set_text (_("Input"));
163 ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
164 input_button.add (input_label);
165 input_button.set_name ("MixerIOButton");
166 input_label.set_name ("MixerIOButtonLabel");
167 input_button_box.pack_start (input_button, true, true);
169 output_label.set_text (_("Output"));
170 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
171 output_button.add (output_label);
172 output_button.set_name ("MixerIOButton");
173 output_label.set_name ("MixerIOButtonLabel");
174 Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
176 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
177 meter_point_button.add (meter_point_label);
178 meter_point_button.set_name ("MixerStripMeterPreButton");
179 meter_point_label.set_name ("MixerStripMeterPreButton");
181 /* TRANSLATORS: this string should be longest of the strings
182 used to describe meter points. In english, it's "input".
184 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
186 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
188 meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
189 meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
191 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
193 monitor_input_button->set_diameter (3);
194 monitor_disk_button->set_diameter (3);
196 solo_isolated_led = manage (new ArdourButton (ArdourButton::led_default_elements));
197 solo_isolated_led->show ();
198 solo_isolated_led->set_diameter (3);
199 solo_isolated_led->set_no_show_all (true);
200 solo_isolated_led->set_name (X_("solo isolate"));
201 solo_isolated_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
202 solo_isolated_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_isolate_button_release));
203 UI::instance()->set_tip (solo_isolated_led, _("Isolate Solo"), "");
205 solo_safe_led = manage (new ArdourButton (ArdourButton::led_default_elements));
206 solo_safe_led->show ();
207 solo_safe_led->set_diameter (3);
208 solo_safe_led->set_no_show_all (true);
209 solo_safe_led->set_name (X_("solo safe"));
210 solo_safe_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
211 solo_safe_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_safe_button_release));
212 UI::instance()->set_tip (solo_safe_led, _("Lock Solo Status"), "");
214 solo_safe_led->set_text (_("lock"));
215 solo_isolated_led->set_text (_("iso"));
217 top_button_table.set_homogeneous (true);
218 top_button_table.set_spacings (2);
219 top_button_table.attach (*monitor_input_button, 0, 1, 0, 1);
220 top_button_table.attach (*monitor_disk_button, 1, 2, 0, 1);
221 top_button_table.show ();
223 rec_solo_table.set_homogeneous (false);
224 rec_solo_table.set_row_spacings (2);
225 rec_solo_table.set_col_spacings (2);
226 rec_solo_table.attach (*solo_isolated_led, 1, 2, 0, 1);
227 rec_solo_table.attach (*solo_safe_led, 1, 2, 1, 2);
228 rec_solo_table.show ();
230 button_table.set_homogeneous (false);
231 button_table.set_spacings (0);
233 if (solo_isolated_led) {
234 button_size_group->add_widget (*solo_isolated_led);
237 button_size_group->add_widget (*solo_safe_led);
239 if (rec_enable_button) {
240 button_size_group->add_widget (*rec_enable_button);
242 if (monitor_disk_button) {
243 button_size_group->add_widget (*monitor_disk_button);
245 if (monitor_input_button) {
246 button_size_group->add_widget (*monitor_input_button);
249 button_table.attach (name_button, 0, 1, 0, 1);
250 button_table.attach (input_button_box, 0, 1, 1, 2);
251 button_table.attach (_invert_button_box, 0, 1, 2, 3);
253 middle_button_table.set_homogeneous (true);
254 middle_button_table.set_spacings (2);
256 bottom_button_table.set_col_spacings (0);
257 bottom_button_table.set_homogeneous (true);
258 bottom_button_table.attach (group_button, 0, 1, 0, 1);
260 name_button.add (name_label);
261 name_button.set_name ("MixerNameButton");
262 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
264 name_label.set_name ("MixerNameButtonLabel");
265 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
266 group_button.add (group_label);
267 group_button.set_name ("MixerGroupButton");
268 Gtkmm2ext::set_size_request_to_display_given_text (group_button, "Group", 2, 2);
269 group_label.set_name ("MixerGroupButtonLabel");
271 _comment_button.set_name (X_("MixerCommentButton"));
272 _comment_button.signal_clicked().connect (sigc::mem_fun (*this, &MixerStrip::toggle_comment_editor));
274 global_vpacker.set_border_width (0);
275 global_vpacker.set_spacing (0);
277 width_button.set_name ("MixerWidthButton");
278 hide_button.set_name ("MixerHideButton");
279 top_event_box.set_name ("MixerTopEventBox");
281 width_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::width_clicked));
282 hide_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::hide_clicked));
284 width_hide_box.pack_start (width_button, false, true);
285 width_hide_box.pack_start (top_event_box, true, true);
286 width_hide_box.pack_end (hide_button, false, true);
288 whvbox.pack_start (width_hide_box, true, true);
290 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
291 global_vpacker.pack_start (button_table, Gtk::PACK_SHRINK);
292 global_vpacker.pack_start (processor_box, true, true);
293 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
294 global_vpacker.pack_start (top_button_table, Gtk::PACK_SHRINK, 2);
295 global_vpacker.pack_start (rec_solo_table, Gtk::PACK_SHRINK, 2);
296 global_vpacker.pack_start (middle_button_table, Gtk::PACK_SHRINK, 2);
297 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
298 global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
299 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
300 global_vpacker.pack_start (_comment_button, Gtk::PACK_SHRINK);
302 global_frame.add (global_vpacker);
303 global_frame.set_shadow_type (Gtk::SHADOW_IN);
304 global_frame.set_name ("BaseFrame");
308 /* force setting of visible selected status */
311 set_selected (false);
316 _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped, this), gui_context());
317 _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context());
319 input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
320 output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
322 /* ditto for this button and busses */
324 name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false);
325 group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false);
329 /* start off as a passthru strip. we'll correct this, if necessary,
330 in update_diskstream_display().
333 /* start off as a passthru strip. we'll correct this, if necessary,
334 in update_diskstream_display().
337 if (is_midi_track()) {
338 set_name ("MidiTrackStripBase");
340 set_name ("AudioTrackStripBase");
343 add_events (Gdk::BUTTON_RELEASE_MASK|
344 Gdk::ENTER_NOTIFY_MASK|
345 Gdk::LEAVE_NOTIFY_MASK|
347 Gdk::KEY_RELEASE_MASK);
349 set_flags (get_flags() | Gtk::CAN_FOCUS);
351 AudioEngine::instance()->PortConnectedOrDisconnected.connect (
352 *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
355 /* Add the widgets under visibility control to the VisibilityGroup; the names used here
356 must be the same as those used in RCOptionEditor so that the configuration changes
357 are recognised when they occur.
359 _visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"));
360 _visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
361 _visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
362 _visibility.add (&_comment_button, X_("Comments"), _("Comments"));
363 _visibility.add (&group_button, X_("Group"), _("Group"));
364 _visibility.add (&meter_point_button, X_("MeterPoint"), _("Meter Point"));
366 parameter_changed (X_("mixer-strip-visibility"));
368 Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, ui_bind (&MixerStrip::parameter_changed, this, _1), gui_context());
370 gpm.LevelMeterButtonPress.connect_same_thread (_level_meter_connection, boost::bind (&MixerStrip::level_meter_button_press, this, _1));
373 MixerStrip::~MixerStrip ()
375 CatchDeletion (this);
377 delete input_selector;
378 delete output_selector;
379 delete comment_window;
383 MixerStrip::set_route (boost::shared_ptr<Route> rt)
385 if (rec_enable_button->get_parent()) {
386 rec_solo_table.remove (*rec_enable_button);
389 if (show_sends_button->get_parent()) {
390 rec_solo_table.remove (*show_sends_button);
393 processor_box.set_route (rt);
395 RouteUI::set_route (rt);
397 /* map the current state */
400 update_solo_display ();
402 delete input_selector;
405 delete output_selector;
408 revert_to_default_display ();
410 if (solo_button->get_parent()) {
411 middle_button_table.remove (*solo_button);
414 if (mute_button->get_parent()) {
415 middle_button_table.remove (*mute_button);
418 if (route()->is_master()) {
419 middle_button_table.attach (*mute_button, 0, 2, 0, 1);
420 solo_button->hide ();
421 mute_button->show ();
422 rec_solo_table.hide ();
424 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
425 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
426 mute_button->show ();
427 solo_button->show ();
428 rec_solo_table.show ();
431 if (_mixer_owned && (route()->is_master() || route()->is_monitor())) {
433 if (scrollbar_height == 0) {
434 HScrollbar scrollbar;
435 Gtk::Requisition requisition(scrollbar.size_request ());
436 scrollbar_height = requisition.height;
439 spacer = manage (new EventBox);
440 spacer->set_size_request (-1, scrollbar_height);
441 global_vpacker.pack_start (*spacer, false, false);
445 monitor_input_button->show ();
446 monitor_disk_button->show ();
448 monitor_input_button->hide();
449 monitor_disk_button->hide ();
452 if (is_midi_track()) {
453 if (midi_input_enable_button == 0) {
454 Image* img = manage (new Image (get_icon (X_("midi_socket_small"))));
455 midi_input_enable_button = manage (new StatefulToggleButton);
456 midi_input_enable_button->set_name ("MixerMidiInputEnableButton");
457 midi_input_enable_button->set_image (*img);
458 midi_input_enable_button->signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_press), false);
459 midi_input_enable_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_release), false);
460 ARDOUR_UI::instance()->set_tip (midi_input_enable_button, _("Enable/Disable MIDI input"));
462 input_button_box.remove (*midi_input_enable_button);
464 /* get current state */
465 midi_input_status_changed ();
466 input_button_box.pack_start (*midi_input_enable_button, false, false);
468 midi_track()->InputActiveChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::midi_input_status_changed, this), gui_context());
470 if (midi_input_enable_button) {
471 /* removal from the container will delete it */
472 input_button_box.remove (*midi_input_enable_button);
473 midi_input_enable_button = 0;
477 if (is_audio_track()) {
478 boost::shared_ptr<AudioTrack> at = audio_track();
479 at->FreezeChange.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::map_frozen, this), gui_context());
482 if (has_audio_outputs ()) {
490 rec_solo_table.attach (*rec_enable_button, 0, 1, 0, 2);
491 rec_enable_button->set_sensitive (_session->writable());
492 rec_enable_button->show();
498 if (!_route->is_master()) {
499 rec_solo_table.attach (*show_sends_button, 0, 1, 0, 2);
500 show_sends_button->show();
504 meter_point_label.set_text (meter_point_string (_route->meter_point()));
506 delete route_ops_menu;
509 _route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
510 _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
512 if (_route->panner_shell()) {
513 _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
516 if (is_audio_track()) {
517 audio_track()->DiskstreamChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
520 _route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
522 set_stuff_from_route ();
524 /* now force an update of all the various elements */
527 update_solo_display ();
530 route_group_changed ();
533 panners.setup_pan ();
535 update_diskstream_display ();
536 update_input_display ();
537 update_output_display ();
539 add_events (Gdk::BUTTON_RELEASE_MASK);
541 processor_box.show ();
543 if (!route()->is_master() && !route()->is_monitor()) {
544 /* we don't allow master or control routes to be hidden */
548 gpm.reset_peak_display ();
551 width_hide_box.show();
554 global_vpacker.show();
556 middle_button_table.show();
557 bottom_button_table.show();
559 gain_unit_button.show();
560 gain_unit_label.show();
561 meter_point_button.show();
562 meter_point_label.show();
563 diskstream_button.show();
564 diskstream_label.show();
565 input_button_box.show_all();
566 output_button.show();
570 _comment_button.show();
574 parameter_changed ("mixer-strip-visibility");
580 MixerStrip::set_stuff_from_route ()
582 /* if width is not set, it will be set by the MixerUI or editor */
584 string str = gui_property ("strip-width");
586 set_width_enum (Width (string_2_enum (str, _width)), this);
591 MixerStrip::set_width_enum (Width w, void* owner)
593 /* always set the gpm width again, things may be hidden */
596 panners.set_width (w);
598 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
600 _width_owner = owner;
604 if (_width_owner == this) {
605 set_gui_property ("strip-width", enum_2_string (_width));
612 if (show_sends_button) {
613 show_sends_button->set_text (_("Sends"));
616 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
617 gpm.astyle_string(gain_automation->automation_style()));
618 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
619 gpm.astate_string(gain_automation->automation_state()));
621 if (_route->panner()) {
622 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
623 panners.astyle_string(_route->panner()->automation_style()));
624 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
625 panners.astate_string(_route->panner()->automation_state()));
628 solo_isolated_led->set_text (_("iso"));
629 solo_safe_led->set_text (_("lock"));
631 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
632 set_size_request (-1, -1);
636 if (show_sends_button) {
637 show_sends_button->set_text (_("Snd"));
640 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
641 gpm.short_astyle_string(gain_automation->automation_style()));
642 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
643 gpm.short_astate_string(gain_automation->automation_state()));
645 if (_route->panner()) {
646 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
647 panners.short_astyle_string(_route->panner()->automation_style()));
648 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
649 panners.short_astate_string(_route->panner()->automation_state()));
652 solo_isolated_led->set_text (_("i"));
653 solo_safe_led->set_text (_("L"));
655 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
656 set_size_request (max (50, gpm.get_gm_width()), -1);
660 processor_box.set_width (w);
662 update_input_display ();
663 update_output_display ();
664 setup_comment_button ();
665 route_group_changed ();
671 MixerStrip::set_packed (bool yn)
676 set_gui_property ("visible", true);
678 set_gui_property ("visible", false);
683 struct RouteCompareByName {
684 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
685 return a->name().compare (b->name()) < 0;
690 MixerStrip::output_press (GdkEventButton *ev)
692 using namespace Menu_Helpers;
693 if (!_session->engine().connected()) {
694 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
699 MenuList& citems = output_menu.items();
700 switch (ev->button) {
703 edit_output_configuration ();
708 output_menu.set_name ("ArdourContextMenu");
710 output_menu_bundles.clear ();
712 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
714 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
717 string_compose ("Add %1 port", (*i).to_i18n_string()),
718 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_output_port), *i)
723 citems.push_back (SeparatorElem());
724 uint32_t const n_with_separator = citems.size ();
726 ARDOUR::BundleList current = _route->output()->bundles_connected ();
728 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
730 /* give user bundles first chance at being in the menu */
732 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
733 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
734 maybe_add_bundle_to_output_menu (*i, current);
738 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
739 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
740 maybe_add_bundle_to_output_menu (*i, current);
744 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
745 RouteList copy = *routes;
746 copy.sort (RouteCompareByName ());
747 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
748 maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
751 if (citems.size() == n_with_separator) {
752 /* no routes added; remove the separator */
756 output_menu.popup (1, ev->time);
767 MixerStrip::edit_output_configuration ()
769 if (output_selector == 0) {
771 boost::shared_ptr<Send> send;
772 boost::shared_ptr<IO> output;
774 if ((send = boost::dynamic_pointer_cast<Send>(_current_delivery)) != 0) {
775 if (!boost::dynamic_pointer_cast<InternalSend>(send)) {
776 output = send->output();
778 output = _route->output ();
781 output = _route->output ();
784 output_selector = new IOSelectorWindow (_session, output);
787 if (output_selector->is_visible()) {
788 output_selector->get_toplevel()->get_window()->raise();
790 output_selector->present ();
795 MixerStrip::edit_input_configuration ()
797 if (input_selector == 0) {
798 input_selector = new IOSelectorWindow (_session, _route->input());
801 if (input_selector->is_visible()) {
802 input_selector->get_toplevel()->get_window()->raise();
804 input_selector->present ();
809 MixerStrip::input_press (GdkEventButton *ev)
811 using namespace Menu_Helpers;
813 MenuList& citems = input_menu.items();
814 input_menu.set_name ("ArdourContextMenu");
817 if (!_session->engine().connected()) {
818 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
823 if (_session->actively_recording() && _route->record_enabled())
826 switch (ev->button) {
829 edit_input_configuration ();
834 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
836 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
839 string_compose ("Add %1 port", (*i).to_i18n_string()),
840 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_input_port), *i)
845 citems.push_back (SeparatorElem());
846 uint32_t const n_with_separator = citems.size ();
848 input_menu_bundles.clear ();
850 ARDOUR::BundleList current = _route->input()->bundles_connected ();
852 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
854 /* give user bundles first chance at being in the menu */
856 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
857 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
858 maybe_add_bundle_to_input_menu (*i, current);
862 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
863 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
864 maybe_add_bundle_to_input_menu (*i, current);
868 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
869 RouteList copy = *routes;
870 copy.sort (RouteCompareByName ());
871 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
872 maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
875 if (citems.size() == n_with_separator) {
876 /* no routes added; remove the separator */
880 input_menu.popup (1, ev->time);
890 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
896 ARDOUR::BundleList current = _route->input()->bundles_connected ();
898 if (std::find (current.begin(), current.end(), c) == current.end()) {
899 _route->input()->connect_ports_to_bundle (c, this);
901 _route->input()->disconnect_ports_from_bundle (c, this);
906 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
912 ARDOUR::BundleList current = _route->output()->bundles_connected ();
914 if (std::find (current.begin(), current.end(), c) == current.end()) {
915 _route->output()->connect_ports_to_bundle (c, this);
917 _route->output()->disconnect_ports_from_bundle (c, this);
922 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
924 using namespace Menu_Helpers;
926 if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs() || *b == *_route->output()->bundle()) {
930 list<boost::shared_ptr<Bundle> >::iterator i = input_menu_bundles.begin ();
931 while (i != input_menu_bundles.end() && b->has_same_ports (*i) == false) {
935 if (i != input_menu_bundles.end()) {
939 input_menu_bundles.push_back (b);
941 MenuList& citems = input_menu.items();
943 std::string n = b->name ();
944 replace_all (n, "_", " ");
946 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
948 if (std::find (current.begin(), current.end(), b) != current.end()) {
949 ignore_toggle = true;
950 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
951 ignore_toggle = false;
956 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
958 using namespace Menu_Helpers;
960 if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs() || *b == *_route->input()->bundle()) {
964 list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
965 while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
969 if (i != output_menu_bundles.end()) {
973 output_menu_bundles.push_back (b);
975 MenuList& citems = output_menu.items();
977 std::string n = b->name ();
978 replace_all (n, "_", " ");
980 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
982 if (std::find (current.begin(), current.end(), b) != current.end()) {
983 ignore_toggle = true;
984 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
985 ignore_toggle = false;
990 MixerStrip::update_diskstream_display ()
994 if (input_selector) {
995 input_selector->hide_all ();
998 route_color_changed ();
1002 show_passthru_color ();
1007 MixerStrip::connect_to_pan ()
1009 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan)
1011 panstate_connection.disconnect ();
1012 panstyle_connection.disconnect ();
1014 if (!_route->panner()) {
1018 boost::shared_ptr<Pannable> p = _route->pannable ();
1020 p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
1021 p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
1023 panners.panshell_changed ();
1028 * Output port labelling
1029 * =====================
1031 * Case 1: Each output has one connection, all connections are to system:playback_%i
1032 * out 1 -> system:playback_1
1033 * out 2 -> system:playback_2
1034 * out 3 -> system:playback_3
1037 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
1038 * out 1 -> ardour:track_x/in 1
1039 * out 2 -> ardour:track_x/in 2
1040 * Display as: track_x
1042 * Case 3: Each output has one connection, all connections are to Jack client "program x"
1043 * out 1 -> program x:foo
1044 * out 2 -> program x:foo
1045 * Display as: program x
1047 * Case 4: No connections (Disconnected)
1050 * Default case (unusual routing):
1051 * Display as: *number of connections*
1055 * .-----------------------------------------------.
1057 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
1058 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
1059 * '-----------------------------------------------'
1060 * .-----------------------------------------------.
1063 * '-----------------------------------------------'
1067 MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool for_input)
1071 boost::shared_ptr<Port> port;
1072 vector<string> port_connections;
1074 uint32_t total_connection_count = 0;
1075 uint32_t io_connection_count = 0;
1076 uint32_t ardour_connection_count = 0;
1077 uint32_t system_connection_count = 0;
1078 uint32_t other_connection_count = 0;
1080 ostringstream label;
1081 string label_string;
1083 bool have_label = false;
1084 bool each_io_has_one_connection = true;
1086 string connection_name;
1087 string ardour_track_name;
1088 string other_connection_type;
1089 string system_ports;
1092 ostringstream tooltip;
1093 char * tooltip_cstr;
1095 tooltip << route->name();
1098 io_count = route->n_inputs().n_total();
1100 io_count = route->n_outputs().n_total();
1103 for (io_index = 0; io_index < io_count; ++io_index) {
1105 port = route->input()->nth (io_index);
1107 port = route->output()->nth (io_index);
1110 port_connections.clear ();
1111 port->get_connections(port_connections);
1112 io_connection_count = 0;
1114 if (!port_connections.empty()) {
1115 for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
1116 string& connection_name (*i);
1118 if (io_connection_count == 0) {
1119 tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
1121 tooltip << ", " << connection_name;
1124 if (connection_name.find("ardour:") == 0) {
1125 if (ardour_track_name.empty()) {
1126 // "ardour:Master/in 1" -> "ardour:Master/"
1127 string::size_type slash = connection_name.find("/");
1128 if (slash != string::npos) {
1129 ardour_track_name = connection_name.substr(0, slash + 1);
1133 if (connection_name.find(ardour_track_name) == 0) {
1134 ++ardour_connection_count;
1136 } else if (connection_name.find("system:") == 0) {
1138 // "system:capture_123" -> "123"
1139 system_port = connection_name.substr(15);
1141 // "system:playback_123" -> "123"
1142 system_port = connection_name.substr(16);
1145 if (system_ports.empty()) {
1146 system_ports += system_port;
1148 system_ports += "/" + system_port;
1151 ++system_connection_count;
1153 if (other_connection_type.empty()) {
1154 // "jamin:in 1" -> "jamin:"
1155 other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
1158 if (connection_name.find(other_connection_type) == 0) {
1159 ++other_connection_count;
1163 ++total_connection_count;
1164 ++io_connection_count;
1168 if (io_connection_count != 1) {
1169 each_io_has_one_connection = false;
1173 if (total_connection_count == 0) {
1174 tooltip << endl << _("Disconnected");
1177 tooltip_cstr = new char[tooltip.str().size() + 1];
1178 strcpy(tooltip_cstr, tooltip.str().c_str());
1181 ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, "");
1183 ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, "");
1186 if (each_io_has_one_connection) {
1187 if ((total_connection_count == ardour_connection_count)) {
1188 // all connections are to the same track in ardour
1189 // "ardour:Master/" -> "Master"
1190 string::size_type slash = ardour_track_name.find("/");
1191 if (slash != string::npos) {
1192 label << ardour_track_name.substr(7, slash - 7);
1196 else if (total_connection_count == system_connection_count) {
1197 // all connections are to system ports
1198 label << system_ports;
1201 else if (total_connection_count == other_connection_count) {
1202 // all connections are to the same external program eg jamin
1203 // "jamin:" -> "jamin"
1204 label << other_connection_type.substr(0, other_connection_type.size() - 1);
1210 if (total_connection_count == 0) {
1214 // Odd configuration
1215 label << "*" << total_connection_count << "*";
1221 label_string = label.str().substr(0, 6);
1224 label_string = label.str().substr(0, 3);
1229 input_label.set_text (label_string);
1231 output_label.set_text (label_string);
1236 MixerStrip::update_input_display ()
1238 update_io_button (_route, _width, true);
1239 panners.setup_pan ();
1243 MixerStrip::update_output_display ()
1245 update_io_button (_route, _width, false);
1246 gpm.setup_meters ();
1247 panners.setup_pan ();
1251 MixerStrip::fast_update ()
1253 gpm.update_meters ();
1257 MixerStrip::diskstream_changed ()
1259 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display, this));
1263 MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::weak_ptr<Port> wb)
1265 boost::shared_ptr<Port> a = wa.lock ();
1266 boost::shared_ptr<Port> b = wb.lock ();
1268 if ((a && _route->input()->has_port (a)) || (b && _route->input()->has_port (b))) {
1269 update_input_display ();
1270 set_width_enum (_width, this);
1273 if ((a && _route->output()->has_port (a)) || (b && _route->output()->has_port (b))) {
1274 update_output_display ();
1275 set_width_enum (_width, this);
1280 MixerStrip::setup_comment_button ()
1285 if (_route->comment().empty ()) {
1286 _comment_button.unset_bg (STATE_NORMAL);
1287 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Comments"));
1289 _comment_button.modify_bg (STATE_NORMAL, color ());
1290 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Comments*"));
1295 if (_route->comment().empty ()) {
1296 _comment_button.unset_bg (STATE_NORMAL);
1297 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Cmt"));
1299 _comment_button.modify_bg (STATE_NORMAL, color ());
1300 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Cmt*"));
1305 ARDOUR_UI::instance()->set_tip (
1306 _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
1311 MixerStrip::comment_editor_done_editing ()
1313 string const str = comment_area->get_buffer()->get_text();
1314 if (str == _route->comment ()) {
1318 _route->set_comment (str, this);
1319 setup_comment_button ();
1323 MixerStrip::toggle_comment_editor ()
1325 if (ignore_toggle) {
1329 if (comment_window && comment_window->is_visible ()) {
1330 comment_window->hide ();
1332 open_comment_editor ();
1337 MixerStrip::open_comment_editor ()
1339 if (comment_window == 0) {
1340 setup_comment_editor ();
1344 title = _route->name();
1345 title += _(": comment editor");
1347 comment_window->set_title (title);
1348 comment_window->present();
1352 MixerStrip::setup_comment_editor ()
1354 comment_window = new ArdourDialog ("", false); // title will be reset to show route
1355 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1356 comment_window->set_skip_taskbar_hint (true);
1357 comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1358 comment_window->set_default_size (400, 200);
1360 comment_area = manage (new TextView());
1361 comment_area->set_name ("MixerTrackCommentArea");
1362 comment_area->set_wrap_mode (WRAP_WORD);
1363 comment_area->set_editable (true);
1364 comment_area->get_buffer()->set_text (_route->comment());
1365 comment_area->show ();
1367 comment_window->get_vbox()->pack_start (*comment_area);
1368 comment_window->get_action_area()->hide();
1372 MixerStrip::comment_changed (void *src)
1374 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
1377 ignore_comment_edit = true;
1379 comment_area->get_buffer()->set_text (_route->comment());
1381 ignore_comment_edit = false;
1386 MixerStrip::select_route_group (GdkEventButton *ev)
1388 using namespace Menu_Helpers;
1390 if (ev->button == 1) {
1392 if (group_menu == 0) {
1394 PropertyList* plist = new PropertyList();
1396 plist->add (Properties::gain, true);
1397 plist->add (Properties::mute, true);
1398 plist->add (Properties::solo, true);
1400 group_menu = new RouteGroupMenu (_session, plist);
1404 r.push_back (route ());
1405 group_menu->build (r);
1406 group_menu->menu()->popup (1, ev->time);
1413 MixerStrip::route_group_changed ()
1415 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed)
1417 RouteGroup *rg = _route->route_group();
1420 group_label.set_text (PBD::short_version (rg->name(), 5));
1424 group_label.set_text (_("Grp"));
1427 group_label.set_text (_("~G"));
1434 MixerStrip::route_color_changed ()
1436 name_button.modify_bg (STATE_NORMAL, color());
1437 top_event_box.modify_bg (STATE_NORMAL, color());
1438 reset_strip_style ();
1442 MixerStrip::show_passthru_color ()
1444 reset_strip_style ();
1448 MixerStrip::build_route_ops_menu ()
1450 using namespace Menu_Helpers;
1451 route_ops_menu = new Menu;
1452 route_ops_menu->set_name ("ArdourContextMenu");
1454 MenuList& items = route_ops_menu->items();
1456 items.push_back (MenuElem (_("Comments..."), sigc::mem_fun (*this, &MixerStrip::open_comment_editor)));
1457 items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
1458 items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
1459 rename_menu_item = &items.back();
1461 items.push_back (SeparatorElem());
1462 items.push_back (CheckMenuElem (_("Active")));
1463 CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
1464 i->set_active (_route->active());
1465 i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
1467 items.push_back (SeparatorElem());
1469 items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
1471 items.push_back (SeparatorElem());
1472 items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1473 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1474 denormal_menu_item->set_active (_route->denormal_protection());
1476 if (!Profile->get_sae()) {
1477 items.push_back (SeparatorElem());
1478 items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
1481 items.push_back (SeparatorElem());
1482 items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
1486 MixerStrip::name_button_button_press (GdkEventButton* ev)
1488 if (ev->button == 3) {
1489 list_route_operations ();
1491 /* do not allow rename if the track is record-enabled */
1492 rename_menu_item->set_sensitive (!_route->record_enabled());
1493 route_ops_menu->popup (1, ev->time);
1495 } else if (ev->button == 1) {
1496 revert_to_default_display ();
1503 MixerStrip::list_route_operations ()
1505 delete route_ops_menu;
1506 build_route_ops_menu ();
1510 MixerStrip::set_selected (bool yn)
1512 AxisView::set_selected (yn);
1514 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1515 global_frame.set_name ("MixerStripSelectedFrame");
1517 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1518 global_frame.set_name ("MixerStripFrame");
1520 global_frame.queue_draw ();
1524 MixerStrip::name_changed ()
1528 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
1531 name_label.set_text (PBD::short_version (_route->name(), 5));
1537 MixerStrip::width_clicked ()
1541 set_width_enum (Narrow, this);
1544 set_width_enum (Wide, this);
1550 MixerStrip::hide_clicked ()
1552 // LAME fix to reset the button status for when it is redisplayed (part 1)
1553 hide_button.set_sensitive(false);
1556 Hiding(); /* EMIT_SIGNAL */
1558 _mixer.hide_strip (this);
1562 hide_button.set_sensitive(true);
1566 MixerStrip::set_embedded (bool yn)
1572 MixerStrip::map_frozen ()
1574 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen)
1576 boost::shared_ptr<AudioTrack> at = audio_track();
1579 switch (at->freeze_state()) {
1580 case AudioTrack::Frozen:
1581 processor_box.set_sensitive (false);
1582 hide_redirect_editors ();
1585 processor_box.set_sensitive (true);
1586 // XXX need some way, maybe, to retoggle redirect editors
1593 MixerStrip::hide_redirect_editors ()
1595 _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor));
1599 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1601 boost::shared_ptr<Processor> processor (p.lock ());
1606 Gtk::Window* w = processor_box.get_processor_ui (processor);
1614 MixerStrip::reset_strip_style ()
1616 if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) {
1618 gpm.set_fader_name ("SendStripBase");
1622 if (is_midi_track()) {
1623 if (_route->active()) {
1624 set_name ("MidiTrackStripBase");
1625 gpm.set_meter_strip_name ("MidiTrackMetrics");
1627 set_name ("MidiTrackStripBaseInactive");
1628 gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
1630 gpm.set_fader_name ("MidiTrackFader");
1631 } else if (is_audio_track()) {
1632 if (_route->active()) {
1633 set_name ("AudioTrackStripBase");
1634 gpm.set_meter_strip_name ("AudioTrackMetrics");
1636 set_name ("AudioTrackStripBaseInactive");
1637 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1639 gpm.set_fader_name ("AudioTrackFader");
1641 if (_route->active()) {
1642 set_name ("AudioBusStripBase");
1643 gpm.set_meter_strip_name ("AudioBusMetrics");
1645 set_name ("AudioBusStripBaseInactive");
1646 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1648 gpm.set_fader_name ("AudioBusFader");
1650 /* (no MIDI busses yet) */
1657 MixerStrip::engine_stopped ()
1662 MixerStrip::engine_running ()
1667 MixerStrip::meter_point_string (MeterPoint mp)
1678 case MeterPostFader:
1693 /** Called when the metering point has changed */
1695 MixerStrip::meter_changed ()
1697 meter_point_label.set_text (meter_point_string (_route->meter_point()));
1698 gpm.setup_meters ();
1699 // reset peak when meter point changes
1700 gpm.reset_peak_display();
1703 /** The bus that we are displaying sends to has changed, or been turned off.
1704 * @param send_to New bus that we are displaying sends to, or 0.
1707 MixerStrip::bus_send_display_changed (boost::shared_ptr<Route> send_to)
1709 RouteUI::bus_send_display_changed (send_to);
1712 boost::shared_ptr<Send> send = _route->internal_send_for (send_to);
1716 revert_to_default_display ();
1719 revert_to_default_display ();
1724 MixerStrip::drop_send ()
1726 boost::shared_ptr<Send> current_send;
1728 if (_current_delivery && (current_send = boost::dynamic_pointer_cast<Send>(_current_delivery))) {
1729 current_send->set_metering (false);
1732 send_gone_connection.disconnect ();
1733 input_button.set_sensitive (true);
1734 output_button.set_sensitive (true);
1735 group_button.set_sensitive (true);
1736 set_invert_sensitive (true);
1737 meter_point_button.set_sensitive (true);
1738 mute_button->set_sensitive (true);
1739 solo_button->set_sensitive (true);
1740 rec_enable_button->set_sensitive (true);
1741 solo_isolated_led->set_sensitive (true);
1742 solo_safe_led->set_sensitive (true);
1743 monitor_input_button->set_sensitive (true);
1744 monitor_disk_button->set_sensitive (true);
1745 _comment_button.set_sensitive (true);
1749 MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
1751 _current_delivery = d;
1752 DeliveryChanged (_current_delivery);
1756 MixerStrip::show_send (boost::shared_ptr<Send> send)
1762 set_current_delivery (send);
1764 send->set_metering (true);
1765 _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
1767 gain_meter().set_controls (_route, send->meter(), send->amp());
1768 gain_meter().setup_meters ();
1770 panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner());
1771 panner_ui().setup_pan ();
1773 input_button.set_sensitive (false);
1774 group_button.set_sensitive (false);
1775 set_invert_sensitive (false);
1776 meter_point_button.set_sensitive (false);
1777 mute_button->set_sensitive (false);
1778 solo_button->set_sensitive (false);
1779 rec_enable_button->set_sensitive (false);
1780 solo_isolated_led->set_sensitive (false);
1781 solo_safe_led->set_sensitive (false);
1782 monitor_input_button->set_sensitive (false);
1783 monitor_disk_button->set_sensitive (false);
1784 _comment_button.set_sensitive (false);
1786 if (boost::dynamic_pointer_cast<InternalSend>(send)) {
1787 output_button.set_sensitive (false);
1790 reset_strip_style ();
1794 MixerStrip::revert_to_default_display ()
1798 set_current_delivery (_route->main_outs ());
1800 gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
1801 gain_meter().setup_meters ();
1803 panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());
1804 panner_ui().setup_pan ();
1806 reset_strip_style ();
1810 MixerStrip::set_button_names ()
1814 rec_enable_button->set_text (_("Rec"));
1815 mute_button->set_text (_("Mute"));
1816 monitor_input_button->set_text (_("In"));
1817 monitor_disk_button->set_text (_("Disk"));
1819 if (_route && _route->solo_safe()) {
1820 if (solo_safe_pixbuf == 0) {
1821 solo_safe_pixbuf = ::get_icon("solo-safe-icon");
1823 solo_button->set_image (solo_safe_pixbuf);
1824 solo_button->set_text (string());
1826 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1827 if (!Config->get_solo_control_is_listen_control()) {
1828 solo_button->set_text (_("Solo"));
1830 switch (Config->get_listen_position()) {
1831 case AfterFaderListen:
1832 solo_button->set_text (_("AFL"));
1834 case PreFaderListen:
1835 solo_button->set_text (_("PFL"));
1843 rec_enable_button->set_text (_("R"));
1844 mute_button->set_text (_("M"));
1845 monitor_input_button->set_text (_("I"));
1846 monitor_disk_button->set_text (_("D"));
1847 if (_route && _route->solo_safe()) {
1848 solo_button->remove ();
1849 if (solo_safe_pixbuf == 0) {
1850 solo_safe_pixbuf =::get_icon("solo-safe-icon");
1852 solo_button->set_image (solo_safe_pixbuf);
1853 solo_button->set_text (string());
1855 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1856 if (!Config->get_solo_control_is_listen_control()) {
1857 solo_button->set_text (_("S"));
1859 switch (Config->get_listen_position()) {
1860 case AfterFaderListen:
1861 solo_button->set_text (_("A"));
1863 case PreFaderListen:
1864 solo_button->set_text (_("P"));
1876 MixerStrip::plugin_selector()
1878 return _mixer.plugin_selector();
1882 MixerStrip::hide_things ()
1884 processor_box.hide_things ();
1888 MixerStrip::input_active_button_press (GdkEventButton*)
1890 /* nothing happens on press */
1895 MixerStrip::input_active_button_release (GdkEventButton* ev)
1897 boost::shared_ptr<MidiTrack> mt = midi_track ();
1903 if (mt->input_active()) {
1904 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1905 /* turn all other tracks using this input off */
1906 _session->set_exclusive_input_active (mt, false);
1908 mt->set_input_active (false);
1912 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1913 /* turn all other tracks using this input on */
1914 _session->set_exclusive_input_active (mt, true);
1916 mt->set_input_active (true);
1924 MixerStrip::midi_input_status_changed ()
1926 if (midi_input_enable_button) {
1927 boost::shared_ptr<MidiTrack> mt = midi_track ();
1929 midi_input_enable_button->set_active (mt->input_active ());
1934 MixerStrip::state_id () const
1936 return string_compose ("strip %1", _route->id().to_s());
1940 MixerStrip::parameter_changed (string p)
1942 if (p == _visibility.get_state_name()) {
1943 /* The user has made changes to the mixer strip visibility, so get
1944 our VisibilityGroup to reflect these changes in our widgets.
1946 _visibility.set_state (Config->get_mixer_strip_visibility ());
1950 /** Called to decide whether the solo isolate / solo lock button visibility should
1951 * be overridden from that configured by the user. We do this for the master bus.
1953 * @return optional value that is present if visibility state should be overridden.
1955 boost::optional<bool>
1956 MixerStrip::override_solo_visibility () const
1958 if (_route && _route->is_master ()) {
1959 return boost::optional<bool> (false);
1962 return boost::optional<bool> ();
1966 MixerStrip::add_input_port (DataType t)
1968 _route->input()->add_port ("", this, t);
1972 MixerStrip::add_output_port (DataType t)
1974 _route->output()->add_port ("", this, t);
1978 MixerStrip::route_active_changed ()
1980 reset_strip_style ();
1984 MixerStrip::copy_processors ()
1986 processor_box.processor_operation (ProcessorBox::ProcessorsCopy);
1990 MixerStrip::cut_processors ()
1992 processor_box.processor_operation (ProcessorBox::ProcessorsCut);
1996 MixerStrip::paste_processors ()
1998 processor_box.processor_operation (ProcessorBox::ProcessorsPaste);
2002 MixerStrip::select_all_processors ()
2004 processor_box.processor_operation (ProcessorBox::ProcessorsSelectAll);
2008 MixerStrip::delete_processors ()
2010 processor_box.processor_operation (ProcessorBox::ProcessorsDelete);
2014 MixerStrip::toggle_processors ()
2016 processor_box.processor_operation (ProcessorBox::ProcessorsToggleActive);
2020 MixerStrip::ab_plugins ()
2022 processor_box.processor_operation (ProcessorBox::ProcessorsAB);
2026 MixerStrip::level_meter_button_press (GdkEventButton* ev)
2028 if (ev->button == 3) {
2029 popup_level_meter_menu (ev);
2037 MixerStrip::popup_level_meter_menu (GdkEventButton* ev)
2039 using namespace Gtk::Menu_Helpers;
2041 Gtk::Menu* m = manage (new Menu);
2042 MenuList& items = m->items ();
2044 RadioMenuItem::Group group;
2046 add_level_meter_item (items, group, _("Input"), MeterInput);
2047 add_level_meter_item (items, group, _("Pre-fader"), MeterPreFader);
2048 add_level_meter_item (items, group, _("Post-fader"), MeterPostFader);
2049 add_level_meter_item (items, group, _("Output"), MeterOutput);
2050 add_level_meter_item (items, group, _("Custom"), MeterCustom);
2052 m->popup (ev->button, ev->time);
2056 MixerStrip::add_level_meter_item (Menu_Helpers::MenuList& items, RadioMenuItem::Group& group, string const & name, MeterPoint point)
2058 using namespace Menu_Helpers;
2060 items.push_back (RadioMenuElem (group, name, sigc::bind (sigc::mem_fun (*this, &MixerStrip::set_meter_point), point)));
2061 RadioMenuItem* i = dynamic_cast<RadioMenuItem *> (&items.back ());
2062 i->set_active (_route->meter_point() == point);
2066 MixerStrip::set_meter_point (MeterPoint p)
2068 _route->set_meter_point (p);