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);
155 img = manage (new Gtk::Image (::get_icon("hide")));
158 hide_button.add (*img);
160 input_label.set_text (_("Input"));
161 ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
162 input_button.add (input_label);
163 input_button.set_name ("MixerIOButton");
164 input_label.set_name ("MixerIOButtonLabel");
165 input_button_box.pack_start (input_button, true, true);
167 output_label.set_text (_("Output"));
168 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
169 output_button.add (output_label);
170 output_button.set_name ("MixerIOButton");
171 output_label.set_name ("MixerIOButtonLabel");
172 Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
174 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
175 meter_point_button.add (meter_point_label);
176 meter_point_button.set_name ("MixerStripMeterPreButton");
177 meter_point_label.set_name ("MixerStripMeterPreButton");
179 /* TRANSLATORS: this string should be longest of the strings
180 used to describe meter points. In english, it's "input".
182 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
184 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
186 meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
187 meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
189 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
191 monitor_input_button->set_diameter (3);
192 monitor_disk_button->set_diameter (3);
194 solo_isolated_led = manage (new ArdourButton (ArdourButton::led_default_elements));
195 solo_isolated_led->show ();
196 solo_isolated_led->set_diameter (3);
197 solo_isolated_led->set_no_show_all (true);
198 solo_isolated_led->set_name (X_("solo isolate"));
199 solo_isolated_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
200 solo_isolated_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_isolate_button_release));
201 UI::instance()->set_tip (solo_isolated_led, _("Isolate Solo"), "");
203 solo_safe_led = manage (new ArdourButton (ArdourButton::led_default_elements));
204 solo_safe_led->show ();
205 solo_safe_led->set_diameter (3);
206 solo_safe_led->set_no_show_all (true);
207 solo_safe_led->set_name (X_("solo safe"));
208 solo_safe_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
209 solo_safe_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_safe_button_release));
210 UI::instance()->set_tip (solo_safe_led, _("Lock Solo Status"), "");
212 solo_safe_led->set_text (_("lock"));
213 solo_isolated_led->set_text (_("iso"));
215 top_button_table.set_homogeneous (true);
216 top_button_table.set_spacings (2);
217 top_button_table.attach (*monitor_input_button, 0, 1, 0, 1);
218 top_button_table.attach (*monitor_disk_button, 1, 2, 0, 1);
219 top_button_table.show ();
221 rec_solo_table.set_homogeneous (false);
222 rec_solo_table.set_row_spacings (2);
223 rec_solo_table.set_col_spacings (2);
224 rec_solo_table.attach (*solo_isolated_led, 1, 2, 0, 1);
225 rec_solo_table.attach (*solo_safe_led, 1, 2, 1, 2);
226 rec_solo_table.show ();
228 button_table.set_homogeneous (false);
229 button_table.set_spacings (0);
231 if (solo_isolated_led) {
232 button_size_group->add_widget (*solo_isolated_led);
235 button_size_group->add_widget (*solo_safe_led);
237 if (rec_enable_button) {
238 button_size_group->add_widget (*rec_enable_button);
240 if (monitor_disk_button) {
241 button_size_group->add_widget (*monitor_disk_button);
243 if (monitor_input_button) {
244 button_size_group->add_widget (*monitor_input_button);
247 button_table.attach (name_button, 0, 1, 0, 1);
248 button_table.attach (input_button_box, 0, 1, 1, 2);
249 button_table.attach (_invert_button_box, 0, 1, 2, 3);
251 middle_button_table.set_homogeneous (true);
252 middle_button_table.set_spacings (2);
254 bottom_button_table.set_col_spacings (0);
255 bottom_button_table.set_homogeneous (true);
256 bottom_button_table.attach (group_button, 0, 1, 0, 1);
258 name_button.add (name_label);
259 name_button.set_name ("MixerNameButton");
260 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
262 name_label.set_name ("MixerNameButtonLabel");
263 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
264 group_button.add (group_label);
265 group_button.set_name ("MixerGroupButton");
266 Gtkmm2ext::set_size_request_to_display_given_text (group_button, "Group", 2, 2);
267 group_label.set_name ("MixerGroupButtonLabel");
269 _comment_button.set_name (X_("MixerCommentButton"));
270 _comment_button.signal_clicked().connect (sigc::mem_fun (*this, &MixerStrip::toggle_comment_editor));
272 global_vpacker.set_border_width (0);
273 global_vpacker.set_spacing (0);
275 width_button.set_name ("MixerWidthButton");
276 hide_button.set_name ("MixerHideButton");
277 top_event_box.set_name ("MixerTopEventBox");
279 width_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::width_clicked));
280 hide_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::hide_clicked));
282 width_hide_box.pack_start (width_button, false, true);
283 width_hide_box.pack_start (top_event_box, true, true);
284 width_hide_box.pack_end (hide_button, false, true);
286 whvbox.pack_start (width_hide_box, true, true);
288 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
289 global_vpacker.pack_start (button_table, Gtk::PACK_SHRINK);
290 global_vpacker.pack_start (processor_box, true, true);
291 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
292 global_vpacker.pack_start (top_button_table, Gtk::PACK_SHRINK, 2);
293 global_vpacker.pack_start (rec_solo_table, Gtk::PACK_SHRINK, 2);
294 global_vpacker.pack_start (middle_button_table, Gtk::PACK_SHRINK, 2);
295 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
296 global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
297 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
298 global_vpacker.pack_start (_comment_button, Gtk::PACK_SHRINK);
300 global_frame.add (global_vpacker);
301 global_frame.set_shadow_type (Gtk::SHADOW_IN);
302 global_frame.set_name ("BaseFrame");
306 /* force setting of visible selected status */
309 set_selected (false);
314 _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped, this), gui_context());
315 _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context());
317 input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
318 output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
320 /* ditto for this button and busses */
322 name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false);
323 group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false);
327 /* start off as a passthru strip. we'll correct this, if necessary,
328 in update_diskstream_display().
331 /* start off as a passthru strip. we'll correct this, if necessary,
332 in update_diskstream_display().
335 if (is_midi_track()) {
336 set_name ("MidiTrackStripBase");
338 set_name ("AudioTrackStripBase");
341 add_events (Gdk::BUTTON_RELEASE_MASK|
342 Gdk::ENTER_NOTIFY_MASK|
343 Gdk::LEAVE_NOTIFY_MASK|
345 Gdk::KEY_RELEASE_MASK);
347 set_flags (get_flags() | Gtk::CAN_FOCUS);
349 AudioEngine::instance()->PortConnectedOrDisconnected.connect (
350 *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
353 /* Add the widgets under visibility control to the VisibilityGroup; the names used here
354 must be the same as those used in RCOptionEditor so that the configuration changes
355 are recognised when they occur.
357 _visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"));
358 _visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
359 _visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
360 _visibility.add (&_comment_button, X_("Comments"), _("Comments"));
361 _visibility.add (&group_button, X_("Group"), _("Group"));
362 _visibility.add (&meter_point_button, X_("MeterPoint"), _("Meter Point"));
364 parameter_changed (X_("mixer-strip-visibility"));
366 Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, ui_bind (&MixerStrip::parameter_changed, this, _1), gui_context());
368 gpm.LevelMeterButtonPress.connect_same_thread (_level_meter_connection, boost::bind (&MixerStrip::level_meter_button_press, this, _1));
371 MixerStrip::~MixerStrip ()
373 CatchDeletion (this);
375 delete input_selector;
376 delete output_selector;
377 delete comment_window;
381 MixerStrip::set_route (boost::shared_ptr<Route> rt)
383 if (rec_enable_button->get_parent()) {
384 rec_solo_table.remove (*rec_enable_button);
387 if (show_sends_button->get_parent()) {
388 rec_solo_table.remove (*show_sends_button);
391 processor_box.set_route (rt);
393 RouteUI::set_route (rt);
395 /* map the current state */
398 update_solo_display ();
400 delete input_selector;
403 delete output_selector;
406 revert_to_default_display ();
408 if (solo_button->get_parent()) {
409 middle_button_table.remove (*solo_button);
412 if (mute_button->get_parent()) {
413 middle_button_table.remove (*mute_button);
416 if (route()->is_master()) {
417 middle_button_table.attach (*mute_button, 0, 2, 0, 1);
418 solo_button->hide ();
419 mute_button->show ();
420 rec_solo_table.hide ();
422 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
423 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
424 mute_button->show ();
425 solo_button->show ();
426 rec_solo_table.show ();
429 if (_mixer_owned && (route()->is_master() || route()->is_monitor())) {
431 if (scrollbar_height == 0) {
432 HScrollbar scrollbar;
433 Gtk::Requisition requisition(scrollbar.size_request ());
434 scrollbar_height = requisition.height;
437 spacer = manage (new EventBox);
438 spacer->set_size_request (-1, scrollbar_height);
439 global_vpacker.pack_start (*spacer, false, false);
443 monitor_input_button->show ();
444 monitor_disk_button->show ();
446 monitor_input_button->hide();
447 monitor_disk_button->hide ();
450 if (is_midi_track()) {
451 if (midi_input_enable_button == 0) {
452 Image* img = manage (new Image (get_icon (X_("midi_socket_small"))));
453 midi_input_enable_button = manage (new StatefulToggleButton);
454 midi_input_enable_button->set_name ("MixerMidiInputEnableButton");
455 midi_input_enable_button->set_image (*img);
456 midi_input_enable_button->signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_press), false);
457 midi_input_enable_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_release), false);
458 ARDOUR_UI::instance()->set_tip (midi_input_enable_button, _("Enable/Disable MIDI input"));
460 input_button_box.remove (*midi_input_enable_button);
462 /* get current state */
463 midi_input_status_changed ();
464 input_button_box.pack_start (*midi_input_enable_button, false, false);
466 midi_track()->InputActiveChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::midi_input_status_changed, this), gui_context());
468 if (midi_input_enable_button) {
469 /* removal from the container will delete it */
470 input_button_box.remove (*midi_input_enable_button);
471 midi_input_enable_button = 0;
475 if (is_audio_track()) {
476 boost::shared_ptr<AudioTrack> at = audio_track();
477 at->FreezeChange.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::map_frozen, this), gui_context());
480 if (has_audio_outputs ()) {
488 rec_solo_table.attach (*rec_enable_button, 0, 1, 0, 2);
489 rec_enable_button->set_sensitive (_session->writable());
490 rec_enable_button->show();
496 if (!_route->is_master()) {
497 rec_solo_table.attach (*show_sends_button, 0, 1, 0, 2);
498 show_sends_button->show();
502 meter_point_label.set_text (meter_point_string (_route->meter_point()));
504 delete route_ops_menu;
507 _route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
508 _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
510 if (_route->panner_shell()) {
511 _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
514 if (is_audio_track()) {
515 audio_track()->DiskstreamChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
518 _route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
520 set_stuff_from_route ();
522 /* now force an update of all the various elements */
525 update_solo_display ();
528 route_group_changed ();
531 panners.setup_pan ();
533 update_diskstream_display ();
534 update_input_display ();
535 update_output_display ();
537 add_events (Gdk::BUTTON_RELEASE_MASK);
539 processor_box.show ();
541 if (!route()->is_master() && !route()->is_monitor()) {
542 /* we don't allow master or control routes to be hidden */
547 width_hide_box.show();
550 global_vpacker.show();
552 middle_button_table.show();
553 bottom_button_table.show();
555 gain_unit_button.show();
556 gain_unit_label.show();
557 meter_point_button.show();
558 meter_point_label.show();
559 diskstream_button.show();
560 diskstream_label.show();
561 input_button_box.show_all();
562 output_button.show();
566 _comment_button.show();
570 parameter_changed ("mixer-strip-visibility");
576 MixerStrip::set_stuff_from_route ()
578 /* if width is not set, it will be set by the MixerUI or editor */
580 string str = gui_property ("strip-width");
582 set_width_enum (Width (string_2_enum (str, _width)), this);
587 MixerStrip::set_width_enum (Width w, void* owner)
589 /* always set the gpm width again, things may be hidden */
592 panners.set_width (w);
594 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
596 _width_owner = owner;
600 if (_width_owner == this) {
601 set_gui_property ("strip-width", enum_2_string (_width));
608 if (show_sends_button) {
609 show_sends_button->set_text (_("Sends"));
612 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
613 gpm.astyle_string(gain_automation->automation_style()));
614 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
615 gpm.astate_string(gain_automation->automation_state()));
617 if (_route->panner()) {
618 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
619 panners.astyle_string(_route->panner()->automation_style()));
620 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
621 panners.astate_string(_route->panner()->automation_state()));
624 solo_isolated_led->set_text (_("iso"));
625 solo_safe_led->set_text (_("lock"));
627 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
628 set_size_request (-1, -1);
632 if (show_sends_button) {
633 show_sends_button->set_text (_("Snd"));
636 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
637 gpm.short_astyle_string(gain_automation->automation_style()));
638 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
639 gpm.short_astate_string(gain_automation->automation_state()));
641 if (_route->panner()) {
642 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
643 panners.short_astyle_string(_route->panner()->automation_style()));
644 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
645 panners.short_astate_string(_route->panner()->automation_state()));
648 solo_isolated_led->set_text ("i");
649 solo_safe_led->set_text ("l");
651 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
652 set_size_request (max (50, gpm.get_gm_width()), -1);
656 processor_box.set_width (w);
658 update_input_display ();
659 update_output_display ();
660 setup_comment_button ();
661 route_group_changed ();
667 MixerStrip::set_packed (bool yn)
672 set_gui_property ("visible", true);
674 set_gui_property ("visible", false);
679 struct RouteCompareByName {
680 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
681 return a->name().compare (b->name()) < 0;
686 MixerStrip::output_press (GdkEventButton *ev)
688 using namespace Menu_Helpers;
689 if (!_session->engine().connected()) {
690 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
695 MenuList& citems = output_menu.items();
696 switch (ev->button) {
699 edit_output_configuration ();
704 output_menu.set_name ("ArdourContextMenu");
706 output_menu_bundles.clear ();
708 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
710 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
713 string_compose ("Add %1 port", (*i).to_i18n_string()),
714 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_output_port), *i)
719 citems.push_back (SeparatorElem());
720 uint32_t const n_with_separator = citems.size ();
722 ARDOUR::BundleList current = _route->output()->bundles_connected ();
724 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
726 /* give user bundles first chance at being in the menu */
728 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
729 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
730 maybe_add_bundle_to_output_menu (*i, current);
734 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
735 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
736 maybe_add_bundle_to_output_menu (*i, current);
740 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
741 RouteList copy = *routes;
742 copy.sort (RouteCompareByName ());
743 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
744 maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
747 if (citems.size() == n_with_separator) {
748 /* no routes added; remove the separator */
752 output_menu.popup (1, ev->time);
763 MixerStrip::edit_output_configuration ()
765 if (output_selector == 0) {
767 boost::shared_ptr<Send> send;
768 boost::shared_ptr<IO> output;
770 if ((send = boost::dynamic_pointer_cast<Send>(_current_delivery)) != 0) {
771 if (!boost::dynamic_pointer_cast<InternalSend>(send)) {
772 output = send->output();
774 output = _route->output ();
777 output = _route->output ();
780 output_selector = new IOSelectorWindow (_session, output);
783 if (output_selector->is_visible()) {
784 output_selector->get_toplevel()->get_window()->raise();
786 output_selector->present ();
791 MixerStrip::edit_input_configuration ()
793 if (input_selector == 0) {
794 input_selector = new IOSelectorWindow (_session, _route->input());
797 if (input_selector->is_visible()) {
798 input_selector->get_toplevel()->get_window()->raise();
800 input_selector->present ();
805 MixerStrip::input_press (GdkEventButton *ev)
807 using namespace Menu_Helpers;
809 MenuList& citems = input_menu.items();
810 input_menu.set_name ("ArdourContextMenu");
813 if (!_session->engine().connected()) {
814 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
819 if (_session->actively_recording() && _route->record_enabled())
822 switch (ev->button) {
825 edit_input_configuration ();
830 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
832 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
835 string_compose ("Add %1 port", (*i).to_i18n_string()),
836 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_input_port), *i)
841 citems.push_back (SeparatorElem());
842 uint32_t const n_with_separator = citems.size ();
844 input_menu_bundles.clear ();
846 ARDOUR::BundleList current = _route->input()->bundles_connected ();
848 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
850 /* give user bundles first chance at being in the menu */
852 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
853 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
854 maybe_add_bundle_to_input_menu (*i, current);
858 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
859 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
860 maybe_add_bundle_to_input_menu (*i, current);
864 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
865 RouteList copy = *routes;
866 copy.sort (RouteCompareByName ());
867 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
868 maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
871 if (citems.size() == n_with_separator) {
872 /* no routes added; remove the separator */
876 input_menu.popup (1, ev->time);
886 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
892 ARDOUR::BundleList current = _route->input()->bundles_connected ();
894 if (std::find (current.begin(), current.end(), c) == current.end()) {
895 _route->input()->connect_ports_to_bundle (c, this);
897 _route->input()->disconnect_ports_from_bundle (c, this);
902 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
908 ARDOUR::BundleList current = _route->output()->bundles_connected ();
910 if (std::find (current.begin(), current.end(), c) == current.end()) {
911 _route->output()->connect_ports_to_bundle (c, this);
913 _route->output()->disconnect_ports_from_bundle (c, this);
918 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
920 using namespace Menu_Helpers;
922 if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs() || *b == *_route->output()->bundle()) {
926 list<boost::shared_ptr<Bundle> >::iterator i = input_menu_bundles.begin ();
927 while (i != input_menu_bundles.end() && b->has_same_ports (*i) == false) {
931 if (i != input_menu_bundles.end()) {
935 input_menu_bundles.push_back (b);
937 MenuList& citems = input_menu.items();
939 std::string n = b->name ();
940 replace_all (n, "_", " ");
942 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
944 if (std::find (current.begin(), current.end(), b) != current.end()) {
945 ignore_toggle = true;
946 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
947 ignore_toggle = false;
952 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
954 using namespace Menu_Helpers;
956 if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs() || *b == *_route->input()->bundle()) {
960 list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
961 while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
965 if (i != output_menu_bundles.end()) {
969 output_menu_bundles.push_back (b);
971 MenuList& citems = output_menu.items();
973 std::string n = b->name ();
974 replace_all (n, "_", " ");
976 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
978 if (std::find (current.begin(), current.end(), b) != current.end()) {
979 ignore_toggle = true;
980 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
981 ignore_toggle = false;
986 MixerStrip::update_diskstream_display ()
990 if (input_selector) {
991 input_selector->hide_all ();
994 route_color_changed ();
998 show_passthru_color ();
1003 MixerStrip::connect_to_pan ()
1005 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan)
1007 panstate_connection.disconnect ();
1008 panstyle_connection.disconnect ();
1010 if (!_route->panner()) {
1014 boost::shared_ptr<Pannable> p = _route->pannable ();
1016 p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
1017 p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
1019 panners.panshell_changed ();
1024 * Output port labelling
1025 * =====================
1027 * Case 1: Each output has one connection, all connections are to system:playback_%i
1028 * out 1 -> system:playback_1
1029 * out 2 -> system:playback_2
1030 * out 3 -> system:playback_3
1033 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
1034 * out 1 -> ardour:track_x/in 1
1035 * out 2 -> ardour:track_x/in 2
1036 * Display as: track_x
1038 * Case 3: Each output has one connection, all connections are to Jack client "program x"
1039 * out 1 -> program x:foo
1040 * out 2 -> program x:foo
1041 * Display as: program x
1043 * Case 4: No connections (Disconnected)
1046 * Default case (unusual routing):
1047 * Display as: *number of connections*
1051 * .-----------------------------------------------.
1053 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
1054 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
1055 * '-----------------------------------------------'
1056 * .-----------------------------------------------.
1059 * '-----------------------------------------------'
1063 MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool for_input)
1067 boost::shared_ptr<Port> port;
1068 vector<string> port_connections;
1070 uint32_t total_connection_count = 0;
1071 uint32_t io_connection_count = 0;
1072 uint32_t ardour_connection_count = 0;
1073 uint32_t system_connection_count = 0;
1074 uint32_t other_connection_count = 0;
1076 ostringstream label;
1077 string label_string;
1079 bool have_label = false;
1080 bool each_io_has_one_connection = true;
1082 string connection_name;
1083 string ardour_track_name;
1084 string other_connection_type;
1085 string system_ports;
1088 ostringstream tooltip;
1089 char * tooltip_cstr;
1091 tooltip << route->name();
1094 io_count = route->n_inputs().n_total();
1096 io_count = route->n_outputs().n_total();
1099 for (io_index = 0; io_index < io_count; ++io_index) {
1101 port = route->input()->nth (io_index);
1103 port = route->output()->nth (io_index);
1106 port_connections.clear ();
1107 port->get_connections(port_connections);
1108 io_connection_count = 0;
1110 if (!port_connections.empty()) {
1111 for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
1112 string& connection_name (*i);
1114 if (io_connection_count == 0) {
1115 tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
1117 tooltip << ", " << connection_name;
1120 if (connection_name.find("ardour:") == 0) {
1121 if (ardour_track_name.empty()) {
1122 // "ardour:Master/in 1" -> "ardour:Master/"
1123 string::size_type slash = connection_name.find("/");
1124 if (slash != string::npos) {
1125 ardour_track_name = connection_name.substr(0, slash + 1);
1129 if (connection_name.find(ardour_track_name) == 0) {
1130 ++ardour_connection_count;
1132 } else if (connection_name.find("system:") == 0) {
1134 // "system:capture_123" -> "123"
1135 system_port = connection_name.substr(15);
1137 // "system:playback_123" -> "123"
1138 system_port = connection_name.substr(16);
1141 if (system_ports.empty()) {
1142 system_ports += system_port;
1144 system_ports += "/" + system_port;
1147 ++system_connection_count;
1149 if (other_connection_type.empty()) {
1150 // "jamin:in 1" -> "jamin:"
1151 other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
1154 if (connection_name.find(other_connection_type) == 0) {
1155 ++other_connection_count;
1159 ++total_connection_count;
1160 ++io_connection_count;
1164 if (io_connection_count != 1) {
1165 each_io_has_one_connection = false;
1169 if (total_connection_count == 0) {
1170 tooltip << endl << _("Disconnected");
1173 tooltip_cstr = new char[tooltip.str().size() + 1];
1174 strcpy(tooltip_cstr, tooltip.str().c_str());
1177 ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, "");
1179 ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, "");
1182 if (each_io_has_one_connection) {
1183 if ((total_connection_count == ardour_connection_count)) {
1184 // all connections are to the same track in ardour
1185 // "ardour:Master/" -> "Master"
1186 string::size_type slash = ardour_track_name.find("/");
1187 if (slash != string::npos) {
1188 label << ardour_track_name.substr(7, slash - 7);
1192 else if (total_connection_count == system_connection_count) {
1193 // all connections are to system ports
1194 label << system_ports;
1197 else if (total_connection_count == other_connection_count) {
1198 // all connections are to the same external program eg jamin
1199 // "jamin:" -> "jamin"
1200 label << other_connection_type.substr(0, other_connection_type.size() - 1);
1206 if (total_connection_count == 0) {
1210 // Odd configuration
1211 label << "*" << total_connection_count << "*";
1217 label_string = label.str().substr(0, 6);
1220 label_string = label.str().substr(0, 3);
1225 input_label.set_text (label_string);
1227 output_label.set_text (label_string);
1232 MixerStrip::update_input_display ()
1234 update_io_button (_route, _width, true);
1235 panners.setup_pan ();
1239 MixerStrip::update_output_display ()
1241 update_io_button (_route, _width, false);
1242 gpm.setup_meters ();
1243 panners.setup_pan ();
1247 MixerStrip::fast_update ()
1249 gpm.update_meters ();
1253 MixerStrip::diskstream_changed ()
1255 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display, this));
1259 MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::weak_ptr<Port> wb)
1261 boost::shared_ptr<Port> a = wa.lock ();
1262 boost::shared_ptr<Port> b = wb.lock ();
1264 if ((a && _route->input()->has_port (a)) || (b && _route->input()->has_port (b))) {
1265 update_input_display ();
1266 set_width_enum (_width, this);
1269 if ((a && _route->output()->has_port (a)) || (b && _route->output()->has_port (b))) {
1270 update_output_display ();
1271 set_width_enum (_width, this);
1276 MixerStrip::setup_comment_button ()
1281 if (_route->comment().empty ()) {
1282 _comment_button.unset_bg (STATE_NORMAL);
1283 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Comments"));
1285 _comment_button.modify_bg (STATE_NORMAL, color ());
1286 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Comments*"));
1291 if (_route->comment().empty ()) {
1292 _comment_button.unset_bg (STATE_NORMAL);
1293 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Cmt"));
1295 _comment_button.modify_bg (STATE_NORMAL, color ());
1296 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Cmt*"));
1301 ARDOUR_UI::instance()->set_tip (
1302 _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
1307 MixerStrip::comment_editor_done_editing ()
1309 string const str = comment_area->get_buffer()->get_text();
1310 if (str == _route->comment ()) {
1314 _route->set_comment (str, this);
1315 setup_comment_button ();
1319 MixerStrip::toggle_comment_editor ()
1321 if (ignore_toggle) {
1325 if (comment_window && comment_window->is_visible ()) {
1326 comment_window->hide ();
1328 open_comment_editor ();
1333 MixerStrip::open_comment_editor ()
1335 if (comment_window == 0) {
1336 setup_comment_editor ();
1340 title = _route->name();
1341 title += _(": comment editor");
1343 comment_window->set_title (title);
1344 comment_window->present();
1348 MixerStrip::setup_comment_editor ()
1350 comment_window = new ArdourDialog ("", false); // title will be reset to show route
1351 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1352 comment_window->set_skip_taskbar_hint (true);
1353 comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1354 comment_window->set_default_size (400, 200);
1356 comment_area = manage (new TextView());
1357 comment_area->set_name ("MixerTrackCommentArea");
1358 comment_area->set_wrap_mode (WRAP_WORD);
1359 comment_area->set_editable (true);
1360 comment_area->get_buffer()->set_text (_route->comment());
1361 comment_area->show ();
1363 comment_window->get_vbox()->pack_start (*comment_area);
1364 comment_window->get_action_area()->hide();
1368 MixerStrip::comment_changed (void *src)
1370 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
1373 ignore_comment_edit = true;
1375 comment_area->get_buffer()->set_text (_route->comment());
1377 ignore_comment_edit = false;
1382 MixerStrip::select_route_group (GdkEventButton *ev)
1384 using namespace Menu_Helpers;
1386 if (ev->button == 1) {
1388 if (group_menu == 0) {
1390 PropertyList* plist = new PropertyList();
1392 plist->add (Properties::gain, true);
1393 plist->add (Properties::mute, true);
1394 plist->add (Properties::solo, true);
1396 group_menu = new RouteGroupMenu (_session, plist);
1400 r.push_back (route ());
1401 group_menu->build (r);
1402 group_menu->menu()->popup (1, ev->time);
1409 MixerStrip::route_group_changed ()
1411 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed)
1413 RouteGroup *rg = _route->route_group();
1416 group_label.set_text (PBD::short_version (rg->name(), 5));
1420 group_label.set_text (_("Grp"));
1423 group_label.set_text (_("~G"));
1430 MixerStrip::route_color_changed ()
1432 name_button.modify_bg (STATE_NORMAL, color());
1433 top_event_box.modify_bg (STATE_NORMAL, color());
1434 reset_strip_style ();
1438 MixerStrip::show_passthru_color ()
1440 reset_strip_style ();
1444 MixerStrip::build_route_ops_menu ()
1446 using namespace Menu_Helpers;
1447 route_ops_menu = new Menu;
1448 route_ops_menu->set_name ("ArdourContextMenu");
1450 MenuList& items = route_ops_menu->items();
1452 items.push_back (MenuElem (_("Comments..."), sigc::mem_fun (*this, &MixerStrip::open_comment_editor)));
1453 items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
1454 items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
1455 rename_menu_item = &items.back();
1457 items.push_back (SeparatorElem());
1458 items.push_back (CheckMenuElem (_("Active")));
1459 CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
1460 i->set_active (_route->active());
1461 i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
1463 items.push_back (SeparatorElem());
1465 items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
1467 items.push_back (SeparatorElem());
1468 items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1469 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1470 denormal_menu_item->set_active (_route->denormal_protection());
1472 if (!Profile->get_sae()) {
1473 items.push_back (SeparatorElem());
1474 items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
1477 items.push_back (SeparatorElem());
1478 items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
1482 MixerStrip::name_button_button_press (GdkEventButton* ev)
1484 if (ev->button == 3) {
1485 list_route_operations ();
1487 /* do not allow rename if the track is record-enabled */
1488 rename_menu_item->set_sensitive (!_route->record_enabled());
1489 route_ops_menu->popup (1, ev->time);
1491 } else if (ev->button == 1) {
1492 revert_to_default_display ();
1499 MixerStrip::list_route_operations ()
1501 delete route_ops_menu;
1502 build_route_ops_menu ();
1506 MixerStrip::set_selected (bool yn)
1508 AxisView::set_selected (yn);
1510 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1511 global_frame.set_name ("MixerStripSelectedFrame");
1513 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1514 global_frame.set_name ("MixerStripFrame");
1516 global_frame.queue_draw ();
1520 MixerStrip::name_changed ()
1524 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
1527 name_label.set_text (PBD::short_version (_route->name(), 5));
1533 MixerStrip::width_clicked ()
1537 set_width_enum (Narrow, this);
1540 set_width_enum (Wide, this);
1546 MixerStrip::hide_clicked ()
1548 // LAME fix to reset the button status for when it is redisplayed (part 1)
1549 hide_button.set_sensitive(false);
1552 Hiding(); /* EMIT_SIGNAL */
1554 _mixer.hide_strip (this);
1558 hide_button.set_sensitive(true);
1562 MixerStrip::set_embedded (bool yn)
1568 MixerStrip::map_frozen ()
1570 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen)
1572 boost::shared_ptr<AudioTrack> at = audio_track();
1575 switch (at->freeze_state()) {
1576 case AudioTrack::Frozen:
1577 processor_box.set_sensitive (false);
1578 hide_redirect_editors ();
1581 processor_box.set_sensitive (true);
1582 // XXX need some way, maybe, to retoggle redirect editors
1589 MixerStrip::hide_redirect_editors ()
1591 _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor));
1595 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1597 boost::shared_ptr<Processor> processor (p.lock ());
1602 Gtk::Window* w = processor_box.get_processor_ui (processor);
1610 MixerStrip::reset_strip_style ()
1612 if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) {
1614 gpm.set_fader_name ("SendStripBase");
1618 if (is_midi_track()) {
1619 if (_route->active()) {
1620 set_name ("MidiTrackStripBase");
1621 gpm.set_meter_strip_name ("MidiTrackMetrics");
1623 set_name ("MidiTrackStripBaseInactive");
1624 gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
1626 gpm.set_fader_name ("MidiTrackFader");
1627 } else if (is_audio_track()) {
1628 if (_route->active()) {
1629 set_name ("AudioTrackStripBase");
1630 gpm.set_meter_strip_name ("AudioTrackMetrics");
1632 set_name ("AudioTrackStripBaseInactive");
1633 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1635 gpm.set_fader_name ("AudioTrackFader");
1637 if (_route->active()) {
1638 set_name ("AudioBusStripBase");
1639 gpm.set_meter_strip_name ("AudioBusMetrics");
1641 set_name ("AudioBusStripBaseInactive");
1642 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1644 gpm.set_fader_name ("AudioBusFader");
1646 /* (no MIDI busses yet) */
1653 MixerStrip::engine_stopped ()
1658 MixerStrip::engine_running ()
1663 MixerStrip::meter_point_string (MeterPoint mp)
1674 case MeterPostFader:
1689 /** Called when the metering point has changed */
1691 MixerStrip::meter_changed ()
1693 meter_point_label.set_text (meter_point_string (_route->meter_point()));
1694 gpm.setup_meters ();
1695 // reset peak when meter point changes
1696 gpm.reset_peak_display();
1699 /** The bus that we are displaying sends to has changed, or been turned off.
1700 * @param send_to New bus that we are displaying sends to, or 0.
1703 MixerStrip::bus_send_display_changed (boost::shared_ptr<Route> send_to)
1705 RouteUI::bus_send_display_changed (send_to);
1708 boost::shared_ptr<Send> send = _route->internal_send_for (send_to);
1712 revert_to_default_display ();
1715 revert_to_default_display ();
1720 MixerStrip::drop_send ()
1722 boost::shared_ptr<Send> current_send;
1724 if (_current_delivery && (current_send = boost::dynamic_pointer_cast<Send>(_current_delivery))) {
1725 current_send->set_metering (false);
1728 send_gone_connection.disconnect ();
1729 input_button.set_sensitive (true);
1730 output_button.set_sensitive (true);
1731 group_button.set_sensitive (true);
1732 set_invert_sensitive (true);
1733 meter_point_button.set_sensitive (true);
1734 mute_button->set_sensitive (true);
1735 solo_button->set_sensitive (true);
1736 rec_enable_button->set_sensitive (true);
1737 solo_isolated_led->set_sensitive (true);
1738 solo_safe_led->set_sensitive (true);
1739 monitor_input_button->set_sensitive (true);
1740 monitor_disk_button->set_sensitive (true);
1741 _comment_button.set_sensitive (true);
1745 MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
1747 _current_delivery = d;
1748 DeliveryChanged (_current_delivery);
1752 MixerStrip::show_send (boost::shared_ptr<Send> send)
1758 set_current_delivery (send);
1760 send->set_metering (true);
1761 _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
1763 gain_meter().set_controls (_route, send->meter(), send->amp());
1764 gain_meter().setup_meters ();
1766 panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner());
1767 panner_ui().setup_pan ();
1769 input_button.set_sensitive (false);
1770 group_button.set_sensitive (false);
1771 set_invert_sensitive (false);
1772 meter_point_button.set_sensitive (false);
1773 mute_button->set_sensitive (false);
1774 solo_button->set_sensitive (false);
1775 rec_enable_button->set_sensitive (false);
1776 solo_isolated_led->set_sensitive (false);
1777 solo_safe_led->set_sensitive (false);
1778 monitor_input_button->set_sensitive (false);
1779 monitor_disk_button->set_sensitive (false);
1780 _comment_button.set_sensitive (false);
1782 if (boost::dynamic_pointer_cast<InternalSend>(send)) {
1783 output_button.set_sensitive (false);
1786 reset_strip_style ();
1790 MixerStrip::revert_to_default_display ()
1794 set_current_delivery (_route->main_outs ());
1796 gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
1797 gain_meter().setup_meters ();
1799 panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());
1800 panner_ui().setup_pan ();
1802 reset_strip_style ();
1806 MixerStrip::set_button_names ()
1810 rec_enable_button->set_text (_("Rec"));
1811 mute_button->set_text (_("Mute"));
1812 monitor_input_button->set_text (_("In"));
1813 monitor_disk_button->set_text (_("Disk"));
1815 if (_route && _route->solo_safe()) {
1816 if (solo_safe_pixbuf == 0) {
1817 solo_safe_pixbuf = ::get_icon("solo-safe-icon");
1819 solo_button->set_image (solo_safe_pixbuf);
1820 solo_button->set_text (string());
1822 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1823 if (!Config->get_solo_control_is_listen_control()) {
1824 solo_button->set_text (_("Solo"));
1826 switch (Config->get_listen_position()) {
1827 case AfterFaderListen:
1828 solo_button->set_text (_("AFL"));
1830 case PreFaderListen:
1831 solo_button->set_text (_("PFL"));
1839 rec_enable_button->set_text (_("R"));
1840 mute_button->set_text (_("M"));
1841 monitor_input_button->set_text (_("I"));
1842 monitor_disk_button->set_text (_("D"));
1843 if (_route && _route->solo_safe()) {
1844 solo_button->remove ();
1845 if (solo_safe_pixbuf == 0) {
1846 solo_safe_pixbuf =::get_icon("solo-safe-icon");
1848 solo_button->set_image (solo_safe_pixbuf);
1849 solo_button->set_text (string());
1851 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1852 if (!Config->get_solo_control_is_listen_control()) {
1853 solo_button->set_text (_("S"));
1855 switch (Config->get_listen_position()) {
1856 case AfterFaderListen:
1857 solo_button->set_text (_("A"));
1859 case PreFaderListen:
1860 solo_button->set_text (_("P"));
1872 MixerStrip::plugin_selector()
1874 return _mixer.plugin_selector();
1878 MixerStrip::hide_things ()
1880 processor_box.hide_things ();
1884 MixerStrip::input_active_button_press (GdkEventButton*)
1886 /* nothing happens on press */
1891 MixerStrip::input_active_button_release (GdkEventButton* ev)
1893 boost::shared_ptr<MidiTrack> mt = midi_track ();
1899 if (mt->input_active()) {
1900 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1901 /* turn all other tracks using this input off */
1902 _session->set_exclusive_input_active (mt, false);
1904 mt->set_input_active (false);
1908 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1909 /* turn all other tracks using this input on */
1910 _session->set_exclusive_input_active (mt, true);
1912 mt->set_input_active (true);
1920 MixerStrip::midi_input_status_changed ()
1922 if (midi_input_enable_button) {
1923 boost::shared_ptr<MidiTrack> mt = midi_track ();
1925 midi_input_enable_button->set_active (mt->input_active ());
1930 MixerStrip::state_id () const
1932 return string_compose ("strip %1", _route->id().to_s());
1936 MixerStrip::parameter_changed (string p)
1938 if (p == _visibility.get_state_name()) {
1939 /* The user has made changes to the mixer strip visibility, so get
1940 our VisibilityGroup to reflect these changes in our widgets.
1942 _visibility.set_state (Config->get_mixer_strip_visibility ());
1946 /** Called to decide whether the solo isolate / solo lock button visibility should
1947 * be overridden from that configured by the user. We do this for the master bus.
1949 * @return optional value that is present if visibility state should be overridden.
1951 boost::optional<bool>
1952 MixerStrip::override_solo_visibility () const
1954 if (_route && _route->is_master ()) {
1955 return boost::optional<bool> (false);
1958 return boost::optional<bool> ();
1962 MixerStrip::add_input_port (DataType t)
1964 _route->input()->add_port ("", this, t);
1968 MixerStrip::add_output_port (DataType t)
1970 _route->output()->add_port ("", this, t);
1974 MixerStrip::route_active_changed ()
1976 reset_strip_style ();
1980 MixerStrip::copy_processors ()
1982 processor_box.processor_operation (ProcessorBox::ProcessorsCopy);
1986 MixerStrip::cut_processors ()
1988 processor_box.processor_operation (ProcessorBox::ProcessorsCut);
1992 MixerStrip::paste_processors ()
1994 processor_box.processor_operation (ProcessorBox::ProcessorsPaste);
1998 MixerStrip::select_all_processors ()
2000 processor_box.processor_operation (ProcessorBox::ProcessorsSelectAll);
2004 MixerStrip::delete_processors ()
2006 processor_box.processor_operation (ProcessorBox::ProcessorsDelete);
2010 MixerStrip::toggle_processors ()
2012 processor_box.processor_operation (ProcessorBox::ProcessorsToggleActive);
2016 MixerStrip::ab_plugins ()
2018 processor_box.processor_operation (ProcessorBox::ProcessorsAB);
2022 MixerStrip::level_meter_button_press (GdkEventButton* ev)
2024 if (ev->button == 3) {
2025 popup_level_meter_menu (ev);
2033 MixerStrip::popup_level_meter_menu (GdkEventButton* ev)
2035 using namespace Gtk::Menu_Helpers;
2037 Gtk::Menu* m = manage (new Menu);
2038 MenuList& items = m->items ();
2040 RadioMenuItem::Group group;
2042 add_level_meter_item (items, group, _("Input"), MeterInput);
2043 add_level_meter_item (items, group, _("Pre-fader"), MeterPreFader);
2044 add_level_meter_item (items, group, _("Post-fader"), MeterPostFader);
2045 add_level_meter_item (items, group, _("Output"), MeterOutput);
2046 add_level_meter_item (items, group, _("Custom"), MeterCustom);
2048 m->popup (ev->button, ev->time);
2052 MixerStrip::add_level_meter_item (Menu_Helpers::MenuList& items, RadioMenuItem::Group& group, string const & name, MeterPoint point)
2054 using namespace Menu_Helpers;
2056 items.push_back (RadioMenuElem (group, name, sigc::bind (sigc::mem_fun (*this, &MixerStrip::set_meter_point), point)));
2057 RadioMenuItem* i = dynamic_cast<RadioMenuItem *> (&items.back ());
2058 i->set_active (_route->meter_point() == point);
2062 MixerStrip::set_meter_point (MeterPoint p)
2064 _route->set_meter_point (p);