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.
22 #include <sigc++/bind.h>
24 #include <pbd/convert.h>
25 #include <pbd/enumwriter.h>
27 #include <gtkmm2ext/gtk_ui.h>
28 #include <gtkmm2ext/utils.h>
29 #include <gtkmm2ext/choice.h>
30 #include <gtkmm2ext/stop_signal.h>
31 #include <gtkmm2ext/doi.h>
32 #include <gtkmm2ext/slider_controller.h>
33 #include <gtkmm2ext/bindable_button.h>
35 #include <ardour/ardour.h>
36 #include <ardour/session.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/route.h>
39 #include <ardour/audio_track.h>
40 #include <ardour/audio_diskstream.h>
41 #include <ardour/panner.h>
42 #include <ardour/send.h>
43 #include <ardour/processor.h>
44 #include <ardour/profile.h>
45 #include <ardour/ladspa_plugin.h>
46 #include <ardour/auto_bundle.h>
47 #include <ardour/user_bundle.h>
49 #include "ardour_ui.h"
50 #include "ardour_dialog.h"
51 #include "mixer_strip.h"
54 #include "public_editor.h"
56 #include "io_selector.h"
58 #include "gui_thread.h"
63 using namespace ARDOUR;
66 using namespace Gtkmm2ext;
69 int MixerStrip::scrollbar_height = 0;
71 #ifdef VARISPEED_IN_MIXER_STRIP
73 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
75 float val = adj.get_value ();
80 snprintf (buf, 32, "%.3f", val);
85 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
87 , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
89 , _mixer_owned (in_mixer)
90 , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
91 , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
95 , middle_button_table (1, 2)
96 , bottom_button_table (1, 2)
97 , meter_point_label (_("pre"))
98 , comment_button (_("Comments"))
99 , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1)
100 , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
106 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
108 , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
110 , _mixer_owned (in_mixer)
111 , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
112 , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
115 , button_table (3, 2)
116 , middle_button_table (1, 2)
117 , bottom_button_table (1, 2)
118 , meter_point_label (_("pre"))
119 , comment_button (_("Comments"))
120 , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1)
121 , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
134 _marked_for_display = false;
136 ignore_comment_edit = false;
137 ignore_toggle = false;
138 ignore_speed_adjustment = false;
146 img = manage (new Gtk::Image (::get_icon("strip_width")));
149 width_button.add (*img);
151 img = manage (new Gtk::Image (::get_icon("hide")));
154 hide_button.add (*img);
156 input_label.set_text (_("Input"));
157 ARDOUR_UI::instance()->set_tip (&input_button, _("Click to choose inputs"), "");
158 input_button.add (input_label);
159 input_button.set_name ("MixerIOButton");
160 input_label.set_name ("MixerIOButtonLabel");
162 output_label.set_text (_("Output"));
163 ARDOUR_UI::instance()->set_tip (&output_button, _("Click to choose outputs"), "");
164 output_button.add (output_label);
165 output_button.set_name ("MixerIOButton");
166 output_label.set_name ("MixerIOButtonLabel");
168 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
169 meter_point_button.add (meter_point_label);
170 meter_point_button.set_name ("MixerStripMeterPreButton");
171 meter_point_label.set_name ("MixerStripMeterPreButton");
173 /* TRANSLATORS: this string should be longest of the strings
174 used to describe meter points. In english, it's "input".
176 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
178 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
180 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
181 /* XXX what is this meant to do? */
182 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
184 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
186 mute_button->set_name ("MixerMuteButton");
187 solo_button->set_name ("MixerSoloButton");
189 button_table.set_homogeneous (true);
190 button_table.set_spacings (0);
192 button_table.attach (name_button, 0, 2, 0, 1);
193 button_table.attach (input_button, 0, 2, 1, 2);
195 middle_button_table.set_homogeneous (true);
196 middle_button_table.set_spacings (0);
197 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
198 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
200 bottom_button_table.set_col_spacings (0);
201 bottom_button_table.set_homogeneous (true);
202 bottom_button_table.attach (group_button, 0, 1, 0, 1);
204 name_button.add (name_label);
205 name_button.set_name ("MixerNameButton");
206 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
208 name_label.set_name ("MixerNameButtonLabel");
209 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
210 group_button.add (group_label);
211 group_button.set_name ("MixerGroupButton");
212 group_label.set_name ("MixerGroupButtonLabel");
214 comment_button.set_name ("MixerCommentButton");
216 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
218 global_vpacker.set_border_width (0);
219 global_vpacker.set_spacing (0);
221 width_button.set_name ("MixerWidthButton");
222 hide_button.set_name ("MixerHideButton");
223 top_event_box.set_name ("MixerTopEventBox");
225 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
226 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
228 width_hide_box.pack_start (width_button, false, true);
229 width_hide_box.pack_start (top_event_box, true, true);
230 width_hide_box.pack_end (hide_button, false, true);
231 gain_meter_alignment.set_padding(0, 4, 0, 0);
232 gain_meter_alignment.add(gpm);
234 whvbox.pack_start (width_hide_box, true, true);
236 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
237 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
238 global_vpacker.pack_start (pre_processor_box, true, true);
239 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
240 global_vpacker.pack_start (gain_meter_alignment,Gtk::PACK_SHRINK);
241 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
242 global_vpacker.pack_start (post_processor_box, true, true);
243 if (!is_midi_track()) {
244 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
246 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
247 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
249 global_frame.add (global_vpacker);
250 global_frame.set_shadow_type (Gtk::SHADOW_IN);
251 global_frame.set_name ("BaseFrame");
255 /* force setting of visible selected status */
258 set_selected (false);
263 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
264 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
266 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
267 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
269 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
270 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
271 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
272 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
274 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
278 rec_enable_button->set_name ("MixerRecordEnableButton");
279 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
280 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
282 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
283 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
287 /* start off as a passthru strip. we'll correct this, if necessary,
288 in update_diskstream_display().
291 /* start off as a passthru strip. we'll correct this, if necessary,
292 in update_diskstream_display().
296 set_name ("MidiTrackStripBase");
298 set_name ("AudioTrackStripBase");
300 add_events (Gdk::BUTTON_RELEASE_MASK);
303 MixerStrip::~MixerStrip ()
305 GoingAway(); /* EMIT_SIGNAL */
307 delete input_selector;
308 delete output_selector;
312 MixerStrip::set_route (boost::shared_ptr<Route> rt)
314 if (rec_enable_button->get_parent()) {
315 button_table.remove (*rec_enable_button);
318 #ifdef VARISPEED_IN_MIXER_STRIP
319 if (speed_frame->get_parent()) {
320 button_table.remove (*speed_frame);
324 RouteUI::set_route (rt);
326 delete input_selector;
329 delete output_selector;
334 pre_processor_box.set_route (rt);
335 post_processor_box.set_route (rt);
337 if (set_color_from_route()) {
338 set_color (unique_random_color());
341 if (_mixer_owned && (route()->is_master() || route()->is_control())) {
343 if (scrollbar_height == 0) {
344 HScrollbar scrollbar;
345 Gtk::Requisition requisition(scrollbar.size_request ());
346 scrollbar_height = requisition.height;
349 spacer = manage (new EventBox);
350 spacer->set_size_request (-1, scrollbar_height);
351 global_vpacker.pack_start (*spacer, false, false);
354 if (is_audio_track()) {
356 boost::shared_ptr<AudioTrack> at = audio_track();
358 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
360 #ifdef VARISPEED_IN_MIXER_STRIP
361 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
363 speed_frame.set_name ("BaseFrame");
364 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
365 speed_frame.add (speed_spinner);
367 speed_spinner.set_print_func (speed_printer, 0);
369 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
371 button_table.attach (speed_frame, 0, 2, 5, 6);
372 #endif /* VARISPEED_IN_MIXER_STRIP */
374 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
375 rec_enable_button->show();
378 if (_route->phase_invert()) {
379 name_label.set_text (X_("Ø ") + name_label.get_text());
381 name_label.set_text (_route->name());
384 switch (_route->meter_point()) {
386 meter_point_label.set_text (_("input"));
390 meter_point_label.set_text (_("pre"));
394 meter_point_label.set_text (_("post"));
398 delete route_ops_menu;
401 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
402 _("Click to Add/Edit Comments"):
405 connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
406 connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
407 connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
408 connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
409 connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
410 connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
411 connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
412 connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
414 if (is_audio_track()) {
415 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
416 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
419 connections.push_back (_route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed)));
420 connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
421 connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
423 set_stuff_from_route ();
425 /* now force an update of all the various elements */
427 pre_processor_box.update();
428 post_processor_box.update();
433 mix_group_changed (0);
437 panners.setup_pan ();
439 if (is_audio_track()) {
443 update_diskstream_display ();
444 update_input_display ();
445 update_output_display ();
447 add_events (Gdk::BUTTON_RELEASE_MASK);
449 pre_processor_box.show();
451 if (!route()->is_master() && !route()->is_control()) {
452 /* we don't allow master or control routes to be hidden */
457 width_hide_box.show();
460 global_vpacker.show();
462 middle_button_table.show();
463 bottom_button_table.show();
464 pre_processor_box.show_all ();
467 gain_meter_alignment.show ();
468 post_processor_box.show_all ();
469 gain_unit_button.show();
470 gain_unit_label.show();
471 meter_point_button.show();
472 meter_point_label.show();
473 diskstream_button.show();
474 diskstream_label.show();
477 output_button.show();
481 comment_button.show();
484 speed_spinner.show();
492 MixerStrip::set_stuff_from_route ()
498 /* if width is not set, it will be set by the MixerUI or editor */
500 if ((prop = xml_node->property ("strip-width")) != 0) {
501 set_width (Width (string_2_enum (prop->value(), _width)), this);
504 if ((prop = xml_node->property ("shown-mixer")) != 0) {
505 if (prop->value() == "no") {
506 _marked_for_display = false;
508 _marked_for_display = true;
511 /* backwards compatibility */
512 _marked_for_display = true;
517 MixerStrip::set_width (Width w, void* owner)
519 /* always set the gpm width again, things may be hidden */
522 panners.set_width (w);
523 pre_processor_box.set_width (w);
524 post_processor_box.set_width (w);
526 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
528 _width_owner = owner;
534 if (_width_owner == this) {
535 xml_node->add_property ("strip-width", enum_2_string (_width));
541 if (rec_enable_button) {
542 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
544 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
545 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
547 if (_route->comment() == "") {
548 comment_button.unset_bg (STATE_NORMAL);
549 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
551 comment_button.modify_bg (STATE_NORMAL, color());
552 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
555 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
556 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
557 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
558 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
559 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
560 set_size_request (-1, -1);
564 if (rec_enable_button) {
565 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
567 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
568 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
570 if (_route->comment() == "") {
571 comment_button.unset_bg (STATE_NORMAL);
572 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
574 comment_button.modify_bg (STATE_NORMAL, color());
575 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
578 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
579 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
580 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
581 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
582 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
583 set_size_request (max (50, gpm.get_gm_width()), -1);
586 update_input_display ();
587 update_output_display ();
588 mix_group_changed (0);
596 MixerStrip::set_packed (bool yn)
603 xml_node->add_property ("shown-mixer", "yes");
605 xml_node->add_property ("shown-mixer", "no");
611 MixerStrip::output_press (GdkEventButton *ev)
613 using namespace Menu_Helpers;
614 if (!_session.engine().connected()) {
615 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
620 MenuList& citems = output_menu.items();
621 switch (ev->button) {
625 output_menu.set_name ("ArdourContextMenu");
628 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
629 citems.push_back (SeparatorElem());
630 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
631 citems.push_back (SeparatorElem());
633 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_outputs ();
635 _session.foreach_bundle (
636 bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), current)
639 output_menu.popup (1, ev->time);
650 MixerStrip::edit_output_configuration ()
652 if (output_selector == 0) {
653 output_selector = new IOSelectorWindow (_session, _route, false);
656 if (output_selector->is_visible()) {
657 output_selector->get_toplevel()->get_window()->raise();
659 output_selector->present ();
664 MixerStrip::edit_input_configuration ()
666 if (input_selector == 0) {
667 input_selector = new IOSelectorWindow (_session, _route, true);
670 if (input_selector->is_visible()) {
671 input_selector->get_toplevel()->get_window()->raise();
673 input_selector->present ();
678 MixerStrip::input_press (GdkEventButton *ev)
680 using namespace Menu_Helpers;
682 MenuList& citems = input_menu.items();
683 input_menu.set_name ("ArdourContextMenu");
686 if (!_session.engine().connected()) {
687 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
692 switch (ev->button) {
696 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
697 citems.push_back (SeparatorElem());
698 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
699 citems.push_back (SeparatorElem());
701 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_inputs ();
703 _session.foreach_bundle (
704 bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), current)
707 input_menu.popup (1, ev->time);
717 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
719 if (!ignore_toggle) {
722 _route->connect_input_ports_to_bundle (c, this);
725 catch (AudioEngine::PortRegistrationFailure& err) {
726 error << _("could not register new ports required for that bundle")
733 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
735 if (!ignore_toggle) {
738 _route->connect_output_ports_to_bundle (c, this);
741 catch (AudioEngine::PortRegistrationFailure& err) {
742 error << _("could not register new ports required for that bundle")
749 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
751 using namespace Menu_Helpers;
753 /* the input menu needs to contain only output bundles (that we
754 can connect inputs to */
755 if (b->ports_are_outputs() == false) {
759 MenuList& citems = input_menu.items();
761 if (b->nchannels() == _route->n_inputs()) {
763 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
765 if (std::find (current.begin(), current.end(), b) != current.end()) {
766 ignore_toggle = true;
767 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
768 ignore_toggle = false;
774 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
776 using namespace Menu_Helpers;
778 /* the output menu needs to contain only input bundles (that we
779 can connect outputs to */
780 if (b->ports_are_inputs() == false) {
784 if (b->nchannels() == _route->n_outputs()) {
786 MenuList& citems = output_menu.items();
787 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
789 if (std::find (current.begin(), current.end(), b) != current.end()) {
790 ignore_toggle = true;
791 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
792 ignore_toggle = false;
798 MixerStrip::update_diskstream_display ()
802 if (input_selector) {
803 input_selector->hide_all ();
810 show_passthru_color ();
815 MixerStrip::connect_to_pan ()
817 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
819 panstate_connection.disconnect ();
820 panstyle_connection.disconnect ();
822 boost::shared_ptr<ARDOUR::AutomationControl> pan_control
823 = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
824 _route->panner().data().control(Evoral::Parameter( PanAutomation ) ));
827 panstate_connection = pan_control->alist()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
828 panstyle_connection = pan_control->alist()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
831 panners.pan_changed (this);
835 MixerStrip::update_input_display ()
837 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_inputs ();
839 /* XXX: how do we represent >1 connected bundle? */
840 if (c.empty() == false) {
841 input_label.set_text (c[0]->name());
845 input_label.set_text (_(" Input"));
848 input_label.set_text (_("I"));
852 panners.setup_pan ();
856 MixerStrip::update_output_display ()
858 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_outputs ();
860 /* XXX: how do we represent >1 connected bundle? */
861 if (c.empty() == false) {
862 output_label.set_text (c[0]->name());
866 output_label.set_text (_("Output"));
869 output_label.set_text (_("O"));
875 panners.setup_pan ();
879 MixerStrip::fast_update ()
881 gpm.update_meters ();
885 MixerStrip::diskstream_changed ()
887 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
891 MixerStrip::input_changed (IOChange change, void *src)
893 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
894 set_width(_width, this);
898 MixerStrip::output_changed (IOChange change, void *src)
900 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
901 set_width(_width, this);
906 MixerStrip::comment_editor_done_editing()
908 string str = comment_area->get_buffer()->get_text();
909 if (_route->comment() != str) {
910 _route->set_comment (str, this);
916 comment_button.modify_bg (STATE_NORMAL, color());
917 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
919 comment_button.unset_bg (STATE_NORMAL);
920 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
926 comment_button.modify_bg (STATE_NORMAL, color());
927 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
929 comment_button.unset_bg (STATE_NORMAL);
930 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
935 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
936 str.empty() ? _("Click to Add/Edit Comments") : str);
942 MixerStrip::comment_button_clicked ()
944 if (comment_window == 0) {
945 setup_comment_editor ();
948 int x, y, cw_width, cw_height;
950 if (comment_window->is_visible()) {
951 comment_window->hide ();
955 comment_window->get_size (cw_width, cw_height);
956 comment_window->get_position(x, y);
957 comment_window->move(x, y - (cw_height / 2) - 45);
959 half the dialog height minus the comments button height
960 with some window decoration fudge thrown in.
963 comment_window->show();
964 comment_window->present();
968 MixerStrip::setup_comment_editor ()
971 title = _route->name();
972 title += _(": comment editor");
974 comment_window = new ArdourDialog (title, false);
975 comment_window->set_position (Gtk::WIN_POS_MOUSE);
976 comment_window->set_skip_taskbar_hint (true);
977 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
979 comment_area = manage (new TextView());
980 comment_area->set_name ("MixerTrackCommentArea");
981 comment_area->set_size_request (110, 178);
982 comment_area->set_wrap_mode (WRAP_WORD);
983 comment_area->set_editable (true);
984 comment_area->get_buffer()->set_text (_route->comment());
985 comment_area->show ();
987 comment_window->get_vbox()->pack_start (*comment_area);
988 comment_window->get_action_area()->hide();
992 MixerStrip::comment_changed (void *src)
994 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
997 ignore_comment_edit = true;
999 comment_area->get_buffer()->set_text (_route->comment());
1001 ignore_comment_edit = false;
1006 MixerStrip::set_mix_group (RouteGroup *rg)
1008 _route->set_mix_group (rg, this);
1012 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
1014 using namespace Menu_Helpers;
1016 MenuList& items = group_menu->items();
1018 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
1020 if (_route->mix_group() == rg) {
1021 static_cast<RadioMenuItem*>(&items.back())->set_active ();
1026 MixerStrip::select_mix_group (GdkEventButton *ev)
1028 using namespace Menu_Helpers;
1030 if (group_menu == 0) {
1031 group_menu = new Menu;
1033 group_menu->set_name ("ArdourContextMenu");
1034 MenuList& items = group_menu->items();
1035 RadioMenuItem::Group group;
1037 switch (ev->button) {
1041 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
1043 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
1045 group_menu->popup (1, ev->time);
1056 MixerStrip::mix_group_changed (void *ignored)
1058 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1060 RouteGroup *rg = _route->mix_group();
1063 group_label.set_text (rg->name());
1067 group_label.set_text (_("Grp"));
1070 group_label.set_text (_("~G"));
1078 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1080 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1082 if (what_changed == "color") {
1083 if (set_color_from_route () == 0) {
1084 show_route_color ();
1090 MixerStrip::show_route_color ()
1092 name_button.modify_bg (STATE_NORMAL, color());
1093 top_event_box.modify_bg (STATE_NORMAL, color());
1094 route_active_changed ();
1098 MixerStrip::show_passthru_color ()
1100 route_active_changed ();
1104 MixerStrip::build_route_ops_menu ()
1106 using namespace Menu_Helpers;
1107 route_ops_menu = new Menu;
1108 route_ops_menu->set_name ("ArdourContextMenu");
1110 MenuList& items = route_ops_menu->items();
1112 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1113 items.push_back (SeparatorElem());
1114 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1115 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1116 route_active_menu_item->set_active (_route->active());
1118 items.push_back (SeparatorElem());
1120 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1122 items.push_back (SeparatorElem());
1123 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1124 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1125 polarity_menu_item->set_active (_route->phase_invert());
1126 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1127 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1128 denormal_menu_item->set_active (_route->denormal_protection());
1130 if (!Profile->get_sae()) {
1131 build_remote_control_menu ();
1132 items.push_back (SeparatorElem());
1133 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1136 items.push_back (SeparatorElem());
1137 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1141 MixerStrip::name_button_button_press (GdkEventButton* ev)
1143 if (ev->button == 1 || ev->button == 3) {
1144 list_route_operations ();
1146 Menu_Helpers::MenuList& items = route_ops_menu->items();
1147 /* do not allow rename if the track is record-enabled */
1148 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1150 route_ops_menu->popup (1, ev->time);
1156 MixerStrip::list_route_operations ()
1158 if (route_ops_menu == 0) {
1159 build_route_ops_menu ();
1162 refresh_remote_control_menu();
1167 MixerStrip::speed_adjustment_changed ()
1169 /* since there is a usable speed adjustment, there has to be a diskstream */
1170 if (!ignore_speed_adjustment) {
1171 get_diskstream()->set_speed (speed_adjustment.get_value());
1176 MixerStrip::speed_changed ()
1178 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1182 MixerStrip::update_speed_display ()
1186 val = get_diskstream()->speed();
1189 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1191 speed_spinner.set_name ("MixerStripSpeedBase");
1194 if (speed_adjustment.get_value() != val) {
1195 ignore_speed_adjustment = true;
1196 speed_adjustment.set_value (val);
1197 ignore_speed_adjustment = false;
1203 MixerStrip::set_selected (bool yn)
1205 AxisView::set_selected (yn);
1207 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1208 global_frame.set_name ("MixerStripSelectedFrame");
1210 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1211 global_frame.set_name ("MixerStripFrame");
1213 global_frame.queue_draw ();
1217 MixerStrip::name_changed ()
1221 RouteUI::name_changed ();
1224 name_label.set_text (PBD::short_version (_route->name(), 5));
1227 if (_route->phase_invert()) {
1228 name_label.set_text (X_("Ø ") + name_label.get_text());
1233 MixerStrip::width_clicked ()
1237 set_width (Narrow, this);
1240 set_width (Wide, this);
1246 MixerStrip::hide_clicked ()
1248 // LAME fix to reset the button status for when it is redisplayed (part 1)
1249 hide_button.set_sensitive(false);
1252 Hiding(); /* EMIT_SIGNAL */
1254 _mixer.hide_strip (this);
1258 hide_button.set_sensitive(true);
1262 MixerStrip::set_embedded (bool yn)
1268 MixerStrip::map_frozen ()
1270 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1272 boost::shared_ptr<AudioTrack> at = audio_track();
1275 switch (at->freeze_state()) {
1276 case AudioTrack::Frozen:
1277 pre_processor_box.set_sensitive (false);
1278 post_processor_box.set_sensitive (false);
1279 speed_spinner.set_sensitive (false);
1282 pre_processor_box.set_sensitive (true);
1283 post_processor_box.set_sensitive (true);
1284 speed_spinner.set_sensitive (true);
1285 // XXX need some way, maybe, to retoggle redirect editors
1290 hide_redirect_editors ();
1294 MixerStrip::hide_redirect_editors ()
1296 _route->foreach_processor (mem_fun (*this, &MixerStrip::hide_processor_editor));
1300 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1302 boost::shared_ptr<Processor> processor (p.lock ());
1307 void* gui = processor->get_gui ();
1310 static_cast<Gtk::Widget*>(gui)->hide ();
1315 MixerStrip::route_active_changed ()
1317 RouteUI::route_active_changed ();
1319 if (is_midi_track()) {
1320 if (_route->active()) {
1321 set_name ("MidiTrackStripBase");
1322 gpm.set_meter_strip_name ("MidiTrackStripBase");
1324 set_name ("MidiTrackStripBaseInactive");
1325 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1327 gpm.set_fader_name ("MidiTrackFader");
1328 } else if (is_audio_track()) {
1329 if (_route->active()) {
1330 set_name ("AudioTrackStripBase");
1331 gpm.set_meter_strip_name ("AudioTrackMetrics");
1333 set_name ("AudioTrackStripBaseInactive");
1334 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1336 gpm.set_fader_name ("AudioTrackFader");
1338 if (_route->active()) {
1339 set_name ("AudioBusStripBase");
1340 gpm.set_meter_strip_name ("AudioBusMetrics");
1342 set_name ("AudioBusStripBaseInactive");
1343 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1345 gpm.set_fader_name ("AudioBusFader");
1347 /* (no MIDI busses yet) */
1352 MixerStrip::mix_group() const
1354 return _route->mix_group();
1358 MixerStrip::engine_stopped ()
1363 MixerStrip::engine_running ()
1368 MixerStrip::meter_changed (void *src)
1371 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1373 switch (_route->meter_point()) {
1375 meter_point_label.set_text (_("input"));
1379 meter_point_label.set_text (_("pre"));
1382 case MeterPostFader:
1383 meter_point_label.set_text (_("post"));
1387 gpm.setup_meters ();
1388 // reset peak when meter point changes
1389 gpm.reset_peak_display();
1390 set_width(_width, this);