2 Copyright (C) 2000-2002 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.
24 #include <sigc++/bind.h>
26 #include <gtkmm2ext/gtk_ui.h>
27 #include <gtkmm2ext/utils.h>
28 #include <gtkmm2ext/choice.h>
29 #include <gtkmm2ext/slider_controller.h>
30 #include <gtkmm2ext/stop_signal.h>
31 #include <gtkmm2ext/bindable_button.h>
32 #include <gtkmm2ext/doi.h>
34 #include <ardour/ardour.h>
35 #include <ardour/session.h>
36 #include <ardour/audioengine.h>
37 #include <ardour/route.h>
38 #include <ardour/audio_track.h>
39 #include <ardour/diskstream.h>
40 #include <ardour/panner.h>
41 #include <ardour/send.h>
42 #include <ardour/insert.h>
43 #include <ardour/ladspa_plugin.h>
44 #include <ardour/connection.h>
45 #include <ardour/session_connection.h>
47 #include "ardour_ui.h"
48 #include "ardour_dialog.h"
49 #include "mixer_strip.h"
52 #include "plugin_selector.h"
53 #include "public_editor.h"
55 #include "plugin_ui.h"
57 #include "io_selector.h"
59 #include "gui_thread.h"
64 using namespace ARDOUR;
66 using namespace Gtkmm2ext;
69 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
71 float val = adj.get_value ();
76 snprintf (buf, 32, "%.3f", val);
80 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer)
82 RouteUI (rt, sess, _("mute"), _("solo"), _("RECORD")),
84 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
85 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
87 panners (_route, sess),
89 gain_automation_style_button (""),
90 gain_automation_state_button (""),
91 pan_automation_style_button (""),
92 pan_automation_state_button (""),
93 polarity_button (_("polarity")),
94 comment_button (_("comments")),
95 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
96 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
99 if (set_color_from_route()) {
100 set_color (unique_random_color());
106 _marked_for_display = false;
108 ignore_comment_edit = false;
109 ignore_toggle = false;
110 ignore_speed_adjustment = false;
114 width_button.add (*(manage (new Gtk::Image (get_xpm("lr.xpm")))));
115 hide_button.add (*(manage (new Gtk::Image (get_xpm("small_x.xpm")))));
118 input_label.set_text (_("INPUT"));
119 input_button.add (input_label);
120 input_button.set_name ("MixerIOButton");
121 input_label.set_name ("MixerIOButtonLabel");
123 output_label.set_text (_("OUTPUT"));
124 output_button.add (output_label);
125 output_button.set_name ("MixerIOButton");
126 output_label.set_name ("MixerIOButtonLabel");
128 rec_enable_button->set_name ("MixerRecordEnableButton");
129 rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
131 solo_button->set_name ("MixerSoloButton");
132 mute_button->set_name ("MixerMuteButton");
133 gain_automation_style_button.set_name ("MixerAutomationModeButton");
134 gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
135 pan_automation_style_button.set_name ("MixerAutomationModeButton");
136 pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
137 polarity_button.set_name ("MixerPhaseInvertButton");
139 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode"));
140 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Gain automation mode"));
142 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type"));
143 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Gain automation type"));
145 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
147 width_button.unset_flags (Gtk::CAN_FOCUS);
148 hide_button.unset_flags (Gtk::CAN_FOCUS);
149 input_button.unset_flags (Gtk::CAN_FOCUS);
150 output_button.unset_flags (Gtk::CAN_FOCUS);
151 solo_button->unset_flags (Gtk::CAN_FOCUS);
152 mute_button->unset_flags (Gtk::CAN_FOCUS);
153 gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
154 gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
155 pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
156 pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
157 polarity_button.unset_flags (Gtk::CAN_FOCUS);
159 button_table.set_homogeneous (true);
161 button_table.attach (name_button, 0, 2, 0, 1);
162 button_table.attach (group_button, 0, 2, 1, 2);
163 button_table.attach (input_button, 0, 2, 2, 3);
165 button_table.attach (polarity_button, 0, 2, 3, 4);
167 button_table.attach (*solo_button, 0, 1, 4, 5);
168 button_table.attach (*mute_button, 1, 2, 4, 5);
170 // button_table.attach (gain_automation_style_button, 0, 1, 5, 6);
171 button_table.attach (gain_automation_state_button, 0, 1, 5, 6);
172 // button_table.attach (pan_automation_style_button, 0, 1, 6, 7);
173 button_table.attach (pan_automation_state_button, 1, 2, 5, 6);
175 using namespace Menu_Helpers;
177 gain_astate_menu.items().push_back (MenuElem (_("off"),
178 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Off)));
179 gain_astate_menu.items().push_back (MenuElem (_("play"),
180 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Play)));
181 gain_astate_menu.items().push_back (MenuElem (_("write"),
182 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Write)));
183 gain_astate_menu.items().push_back (MenuElem (_("touch"),
184 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Touch)));
186 gain_astyle_menu.items().push_back (MenuElem (_("trim")));
187 gain_astyle_menu.items().push_back (MenuElem (_("abs")));
189 pan_astate_menu.items().push_back (MenuElem (_("off"),
190 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Off)));
191 pan_astate_menu.items().push_back (MenuElem (_("play"),
192 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Play)));
193 pan_astate_menu.items().push_back (MenuElem (_("write"),
194 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Write)));
195 pan_astate_menu.items().push_back (MenuElem (_("touch"),
196 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Touch)));
198 pan_astyle_menu.items().push_back (MenuElem (_("trim")));
199 pan_astyle_menu.items().push_back (MenuElem (_("abs")));
201 gain_astate_menu.set_name ("ArdourContextMenu");
202 gain_astyle_menu.set_name ("ArdourContextMenu");
203 pan_astate_menu.set_name ("ArdourContextMenu");
204 pan_astyle_menu.set_name ("ArdourContextMenu");
206 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("gain automation mode"));
207 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("pan automation mode"));
208 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("gain automation state"));
209 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("pan automation state"));
211 if (is_audio_track()) {
213 AudioTrack* at = dynamic_cast<AudioTrack*>(&_route);
215 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
217 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
219 speed_frame.set_name ("BaseFrame");
220 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
221 speed_frame.add (speed_spinner);
223 speed_spinner.set_print_func (speed_printer, 0);
225 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("varispeed"));
227 button_table.attach (speed_frame, 0, 2, 6, 7);
228 button_table.attach (*rec_enable_button, 0, 2, 7, 8);
231 name_button.add (name_label);
232 name_button.set_name ("MixerNameButton");
233 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
235 name_label.set_name ("MixerNameButtonLabel");
236 name_label.set_text (_route.name());
238 group_button.add (group_label);
239 group_button.set_name ("MixerGroupButton");
240 group_label.set_name ("MixerGroupButtonLabel");
242 comment_button.set_name ("MixerCommentButton");
243 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route.comment()=="" ?
244 _("click to add/edit comments"):
246 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
248 global_vpacker.set_border_width (0);
249 global_vpacker.set_spacing (0);
251 Gtk::VBox *whvbox = manage (new Gtk::VBox);
253 width_button.set_name ("MixerWidthButton");
254 hide_button.set_name ("MixerHideButton");
256 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
257 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
259 width_hide_box.pack_start (width_button, false, true);
260 width_hide_box.pack_end (hide_button, false, true);
262 whvbox->pack_start (width_hide_box, true, true);
264 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
265 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
266 global_vpacker.pack_start (pre_redirect_box, true, true);
267 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
268 global_vpacker.pack_start (post_redirect_box, true, true);
269 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
270 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
271 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
273 global_frame.add (global_vpacker);
274 global_frame.set_shadow_type (Gtk::SHADOW_IN);
275 global_frame.set_name ("BaseFrame");
279 /* force setting of visible selected status */
282 set_selected (false);
287 _route.input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
288 _route.output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
289 _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
290 _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
291 _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
292 _route.mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
293 _route.gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_state_changed));
294 _route.gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_style_changed));
295 _route.panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
297 if (is_audio_track()) {
298 audio_track()->diskstream_changed.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
299 get_diskstream()->speed_changed.connect (mem_fun(*this, &MixerStrip::speed_changed));
302 _route.name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
303 _route.comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
304 _route.gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
306 input_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
307 output_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
309 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
310 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press));
311 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release));
312 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press));
313 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
315 gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_style_button_event), false);
316 gain_automation_style_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::gain_automation_style_button_event), false);
317 pan_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_style_button_event), false);
318 pan_automation_style_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::pan_automation_style_button_event), false);
320 gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_state_button_event), false);
321 gain_automation_state_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::gain_automation_state_button_event), false);
322 pan_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_state_button_event), false);
323 pan_automation_state_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::pan_automation_state_button_event), false);
325 polarity_button.signal_toggled().connect (mem_fun(*this, &MixerStrip::polarity_toggled));
327 name_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::name_button_button_release), false);
329 group_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
332 set_stuff_from_route ();
334 /* start off as a passthru strip. we'll correct this, if necessary,
335 in update_diskstream_display().
338 set_name ("AudioTrackStripBase");
340 /* now force an update of all the various elements */
342 pre_redirect_box.update();
343 post_redirect_box.update();
348 mix_group_changed (0);
349 gain_automation_state_changed ();
350 pan_automation_state_changed ();
353 panners.setup_pan ();
355 if (is_audio_track()) {
359 /* XXX hack: no phase invert changed signal */
361 polarity_button.set_active (_route.phase_invert());
363 update_diskstream_display ();
364 update_input_display ();
365 update_output_display ();
367 add_events (Gdk::BUTTON_RELEASE_MASK);
370 MixerStrip::~MixerStrip ()
372 GoingAway(); /* EMIT_SIGNAL */
374 if (input_selector) {
375 delete input_selector;
378 if (output_selector) {
379 delete output_selector;
384 MixerStrip::set_stuff_from_route ()
390 if ((prop = xml_node->property ("strip_width")) != 0) {
391 if (prop->value() == "wide") {
393 } else if (prop->value() == "narrow") {
397 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
405 if ((prop = xml_node->property ("shown_mixer")) != 0) {
406 if (prop->value() == "no") {
407 _marked_for_display = false;
409 _marked_for_display = true;
413 /* backwards compatibility */
414 _marked_for_display = true;
419 MixerStrip::set_width (Width w)
421 /* always set the gpm width again, things may be hidden */
423 panners.set_width (w);
424 pre_redirect_box.set_width (w);
425 post_redirect_box.set_width (w);
437 set_size_request (-1, -1);
438 xml_node->add_property ("strip_width", "wide");
440 static_cast<Gtk::Label*> (rec_enable_button->get_child())->set_text (_("RECORD"));
441 static_cast<Gtk::Label*> (mute_button->get_child())->set_text (_("mute"));
442 static_cast<Gtk::Label*> (solo_button->get_child())->set_text (_("solo"));
443 static_cast<Gtk::Label*> (comment_button.get_child())->set_text (_("comments"));
444 static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (astyle_string(_route.gain_automation_curve().automation_style()));
445 static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (astate_string(_route.gain_automation_curve().automation_state()));
446 static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (astyle_string(_route.panner().automation_style()));
447 static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (astate_string(_route.panner().automation_state()));
448 static_cast<Gtk::Label*> (polarity_button.get_child())->set_text (_("polarity"));
449 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
453 set_size_request (50, -1);
454 xml_node->add_property ("strip_width", "narrow");
456 static_cast<Gtk::Label*> (rec_enable_button->get_child())->set_text (_("REC"));
457 static_cast<Gtk::Label*> (mute_button->get_child())->set_text (_("m"));
458 static_cast<Gtk::Label*> (solo_button->get_child())->set_text (_("s"));
459 static_cast<Gtk::Label*> (comment_button.get_child())->set_text (_("cmt"));
460 static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (short_astyle_string(_route.gain_automation_curve().automation_style()));
461 static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (short_astate_string(_route.gain_automation_curve().automation_state()));
462 static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (short_astyle_string(_route.panner().automation_style()));
463 static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (short_astate_string(_route.panner().automation_state()));
464 static_cast<Gtk::Label*> (polarity_button.get_child())->set_text (_("pol"));
465 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
469 update_input_display ();
470 update_output_display ();
471 mix_group_changed (0);
476 MixerStrip::set_packed (bool yn)
483 xml_node->add_property ("shown_mixer", "yes");
485 xml_node->add_property ("shown_mixer", "no");
491 MixerStrip::output_press (GdkEventButton *ev)
493 using namespace Menu_Helpers;
495 if (!_session.engine().connected()) {
496 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
501 MenuList& citems = output_menu.items();
502 output_menu.set_name ("ArdourContextMenu");
505 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
506 citems.push_back (SeparatorElem());
507 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
508 citems.push_back (SeparatorElem());
510 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
512 output_menu.popup (1, ev->time);
518 MixerStrip::edit_output_configuration ()
520 if (output_selector == 0) {
521 output_selector = new IOSelectorWindow (_session, _route, false);
524 if (output_selector->is_visible()) {
525 output_selector->get_toplevel()->get_window()->raise();
527 output_selector->show_all ();
532 MixerStrip::edit_input_configuration ()
534 if (input_selector == 0) {
535 input_selector = new IOSelectorWindow (_session, _route, true);
538 if (input_selector->is_visible()) {
539 input_selector->get_toplevel()->get_window()->raise();
541 input_selector->show_all ();
546 MixerStrip::input_press (GdkEventButton *ev)
548 using namespace Menu_Helpers;
550 MenuList& citems = input_menu.items();
551 input_menu.set_name ("ArdourContextMenu");
554 if (!_session.engine().connected()) {
555 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
560 #if ADVANCED_ROUTE_DISKSTREAM_CONNECTIVITY
561 if (is_audio_track()) {
562 citems.push_back (MenuElem (_("Track"), mem_fun(*this, &MixerStrip::select_stream_input)));
565 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
566 citems.push_back (SeparatorElem());
567 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
568 citems.push_back (SeparatorElem());
570 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
571 input_menu.popup (1, ev->time);
577 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
579 if (!ignore_toggle) {
582 _route.use_input_connection (*c, this);
585 catch (AudioEngine::PortRegistrationFailure& err) {
586 error << _("could not register new ports required for that connection")
593 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
595 if (!ignore_toggle) {
598 _route.use_output_connection (*c, this);
601 catch (AudioEngine::PortRegistrationFailure& err) {
602 error << _("could not register new ports required for that connection")
609 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
611 using namespace Menu_Helpers;
613 if (dynamic_cast<InputConnection *> (c) == 0) {
617 MenuList& citems = input_menu.items();
619 if (c->nports() == _route.n_inputs()) {
621 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
623 ARDOUR::Connection *current = _route.input_connection();
626 ignore_toggle = true;
627 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
628 ignore_toggle = false;
634 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
636 using namespace Menu_Helpers;
638 if (dynamic_cast<OutputConnection *> (c) == 0) {
642 if (c->nports() == _route.n_outputs()) {
644 MenuList& citems = output_menu.items();
645 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
647 ARDOUR::Connection *current = _route.output_connection();
650 ignore_toggle = true;
651 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
652 ignore_toggle = false;
658 MixerStrip::select_stream_input ()
660 using namespace Menu_Helpers;
662 Menu *stream_menu = manage (new Menu);
663 MenuList& items = stream_menu->items();
664 stream_menu->set_name ("ArdourContextMenu");
666 Session::DiskStreamList streams = _session.disk_streams();
668 for (Session::DiskStreamList::iterator i = streams.begin(); i != streams.end(); ++i) {
670 if (!(*i)->hidden()) {
672 items.push_back (CheckMenuElem ((*i)->name(), bind (mem_fun(*this, &MixerStrip::stream_input_chosen), *i)));
674 if (get_diskstream() == *i) {
675 ignore_toggle = true;
676 static_cast<CheckMenuItem *> (&items.back())->set_active (true);
677 ignore_toggle = false;
682 stream_menu->popup (1, 0);
686 MixerStrip::stream_input_chosen (DiskStream *stream)
688 if (is_audio_track()) {
689 audio_track()->set_diskstream (*stream, this);
694 MixerStrip::update_diskstream_display ()
696 if (is_audio_track()) {
700 update_input_display ();
702 if (input_selector) {
703 input_selector->hide_all ();
712 update_input_display ();
713 show_passthru_color ();
718 MixerStrip::connect_to_pan ()
720 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
722 panstate_connection.disconnect ();
723 panstyle_connection.disconnect ();
725 if (!_route.panner().empty()) {
726 StreamPanner* sp = _route.panner().front();
728 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_state_changed));
729 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_style_changed));
732 panners.pan_changed (this);
736 MixerStrip::update_input_display ()
738 ARDOUR::Connection *c;
740 if ((c = _route.input_connection()) != 0) {
741 input_label.set_text (c->name());
745 input_label.set_text (_("INPUT"));
748 input_label.set_text (_("IN"));
753 panners.setup_pan ();
757 MixerStrip::update_output_display ()
759 ARDOUR::Connection *c;
761 if ((c = _route.output_connection()) != 0) {
762 output_label.set_text (c->name());
766 output_label.set_text (_("OUTPUT"));
769 output_label.set_text (_("OUT"));
775 panners.setup_pan ();
779 MixerStrip::update ()
781 gpm.update_meters ();
785 MixerStrip::fast_update ()
787 if (_session.meter_falloff() > 0.0f) {
788 gpm.update_meters_falloff ();
793 MixerStrip::gain_automation_state_button_event (GdkEventButton *ev)
795 if (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_2BUTTON_PRESS) {
799 switch (ev->button) {
801 switch (ev->button) {
803 gain_astate_menu.popup (1, ev->time);
814 MixerStrip::gain_automation_style_button_event (GdkEventButton *ev)
816 if (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_2BUTTON_PRESS) {
820 switch (ev->button) {
822 gain_astyle_menu.popup (1, ev->time);
831 MixerStrip::pan_automation_state_button_event (GdkEventButton *ev)
833 using namespace Menu_Helpers;
835 if (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_2BUTTON_PRESS) {
839 switch (ev->button) {
841 pan_astate_menu.popup (1, ev->time);
851 MixerStrip::pan_automation_style_button_event (GdkEventButton *ev)
853 switch (ev->button) {
855 pan_astyle_menu.popup (1, ev->time);
864 MixerStrip::astate_string (AutoState state)
866 return _astate_string (state, false);
870 MixerStrip::short_astate_string (AutoState state)
872 return _astate_string (state, true);
876 MixerStrip::_astate_string (AutoState state, bool shrt)
882 sstr = (shrt ? "--" : _("off"));
885 sstr = (shrt ? "P" : _("aplay"));
888 sstr = (shrt ? "T" : _("touch"));
891 sstr = (shrt ? "W" : _("awrite"));
899 MixerStrip::astyle_string (AutoStyle style)
901 return _astyle_string (style, false);
905 MixerStrip::short_astyle_string (AutoStyle style)
907 return _astyle_string (style, true);
911 MixerStrip::_astyle_string (AutoStyle style, bool shrt)
916 /* XXX it might different in different languages */
918 return (shrt ? _("abs") : _("abs"));
923 MixerStrip::diskstream_changed (void *src)
925 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
929 MixerStrip::gain_automation_style_changed ()
933 static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (astyle_string(_route.gain_automation_curve().automation_style()));
936 static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (short_astyle_string(_route.gain_automation_curve().automation_style()));
942 MixerStrip::gain_automation_state_changed ()
944 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::gain_automation_state_changed));
950 static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (astate_string(_route.gain_automation_curve().automation_state()));
953 static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (short_astate_string(_route.gain_automation_curve().automation_state()));
957 x = (_route.gain_automation_state() != Off);
959 if (gain_automation_state_button.get_active() != x) {
960 ignore_toggle = true;
961 gain_automation_state_button.set_active (x);
962 ignore_toggle = false;
965 gpm.update_gain_sensitive ();
967 /* start watching automation so that things move */
969 gain_watching.disconnect();
972 gain_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (gpm, &GainMeter::effective_gain_display));
977 MixerStrip::pan_automation_style_changed ()
979 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_style_changed));
983 static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (astyle_string(_route.panner().automation_style()));
986 static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (short_astyle_string(_route.panner().automation_style()));
992 MixerStrip::pan_automation_state_changed ()
994 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_state_changed));
1000 static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (astate_string(_route.panner().automation_state()));
1003 static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (short_astate_string(_route.panner().automation_state()));
1007 /* when creating a new session, we get to create busses (and
1008 sometimes tracks) with no outputs by the time they get
1012 if (_route.panner().empty()) {
1016 x = (_route.panner().front()->automation().automation_state() != Off);
1018 if (pan_automation_state_button.get_active() != x) {
1019 ignore_toggle = true;
1020 pan_automation_state_button.set_active (x);
1021 ignore_toggle = false;
1024 panners.update_pan_sensitive ();
1026 /* start watching automation so that things move */
1028 pan_watching.disconnect();
1031 pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (panners, &PannerUI::effective_pan_display));
1036 MixerStrip::input_changed (IOChange change, void *src)
1038 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
1042 MixerStrip::output_changed (IOChange change, void *src)
1044 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
1048 MixerStrip::comment_button_clicked ()
1050 if (comment_window == 0) {
1051 setup_comment_editor ();
1054 if (comment_window->is_visible()) {
1055 comment_window->hide ();
1059 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1060 comment_window->show_all ();
1061 comment_window->present();
1063 ResponseType response = (ResponseType) comment_window->run();
1064 comment_window->hide ();
1067 case RESPONSE_ACCEPT:
1073 string str = comment_area->get_buffer()->get_text();
1074 _route.set_comment (str, this);
1075 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
1076 str.empty() ? _("click to add/edit comments") : str);
1080 MixerStrip::setup_comment_editor ()
1083 title = _route.name();
1084 title += _(": comment editor");
1086 comment_window = new ArdourDialog (title, false);
1087 comment_area = manage (new TextView());
1089 comment_area->set_name ("MixerTrackCommentArea");
1090 comment_area->set_editable (true);
1091 comment_area->get_buffer()->set_text (_route.comment());
1092 comment_area->set_size_request (200,100);
1093 comment_area->show ();
1095 comment_window->get_vbox()->pack_start (*comment_area);
1096 comment_window->add_button (Stock::CANCEL, RESPONSE_CANCEL);
1097 comment_window->add_button (Stock::OK, RESPONSE_ACCEPT);
1101 MixerStrip::comment_changed (void *src)
1103 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
1106 ignore_comment_edit = true;
1108 comment_area->get_buffer()->set_text (_route.comment());
1110 ignore_comment_edit = false;
1115 MixerStrip::set_mix_group (RouteGroup *rg)
1117 _route.set_mix_group (rg, this);
1121 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
1123 using namespace Menu_Helpers;
1125 MenuList& items = group_menu->items();
1127 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
1129 if (_route.mix_group() == rg) {
1130 static_cast<RadioMenuItem*>(&items.back())->set_active ();
1135 MixerStrip::select_mix_group (GdkEventButton *ev)
1137 using namespace Menu_Helpers;
1139 if (group_menu == 0) {
1140 group_menu = new Menu;
1142 group_menu->set_name ("ArdourContextMenu");
1143 MenuList& items = group_menu->items();
1144 RadioMenuItem::Group group;
1147 items.push_back (RadioMenuElem (group, _("no group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
1149 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
1151 group_menu->popup (1, 0);
1157 MixerStrip::mix_group_changed (void *ignored)
1159 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1161 RouteGroup *rg = _route.mix_group();
1164 group_label.set_text (rg->name());
1168 group_label.set_text (_("no group"));
1171 group_label.set_text (_("~G"));
1178 MixerStrip::polarity_toggled ()
1182 if ((x = polarity_button.get_active()) != _route.phase_invert()) {
1183 _route.set_phase_invert (x, this);
1189 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1191 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1193 if (what_changed == "color") {
1194 if (set_color_from_route () == 0) {
1195 show_route_color ();
1201 MixerStrip::show_route_color ()
1203 name_button.ensure_style ();
1204 Glib::RefPtr<Gtk::Style> style = name_button.get_style()->copy();
1205 style->set_bg (Gtk::STATE_NORMAL, color());
1206 name_button.set_style (style);
1208 route_active_changed ();
1212 MixerStrip::show_passthru_color ()
1214 route_active_changed ();
1218 MixerStrip::build_route_ops_menu ()
1220 using namespace Menu_Helpers;
1222 route_ops_menu = manage (new Menu);
1223 route_ops_menu->set_name ("ArdourContextMenu");
1225 MenuList& items = route_ops_menu->items();
1227 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1228 items.push_back (SeparatorElem());
1229 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
1230 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1231 route_active_menu_item->set_active (_route.active());
1233 build_remote_control_menu ();
1235 items.push_back (SeparatorElem());
1236 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1238 items.push_back (SeparatorElem());
1239 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1243 MixerStrip::name_button_button_release (GdkEventButton* ev)
1245 if (ev->button == 3) {
1246 list_route_operations ();
1252 MixerStrip::list_route_operations ()
1254 if (route_ops_menu == 0) {
1255 build_route_ops_menu ();
1258 refresh_remote_control_menu();
1260 route_ops_menu->popup (1, 0);
1265 MixerStrip::speed_adjustment_changed ()
1267 /* since there is a usable speed adjustment, there has to be a diskstream */
1268 if (!ignore_speed_adjustment) {
1269 get_diskstream()->set_speed (speed_adjustment.get_value());
1274 MixerStrip::speed_changed ()
1276 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1280 MixerStrip::update_speed_display ()
1284 val = get_diskstream()->speed();
1287 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1289 speed_spinner.set_name ("MixerStripSpeedBase");
1292 if (speed_adjustment.get_value() != val) {
1293 ignore_speed_adjustment = true;
1294 speed_adjustment.set_value (val);
1295 ignore_speed_adjustment = false;
1301 MixerStrip::set_selected (bool yn)
1303 AxisView::set_selected (yn);
1305 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1306 global_frame.set_name ("MixerStripSelectedFrame");
1308 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1309 global_frame.set_name ("MixerStripFrame");
1311 global_frame.queue_draw ();
1315 MixerStrip::name_changed (void *src)
1319 RouteUI::name_changed (src);
1322 name_label.set_text (short_version (_route.name(), 5));
1328 MixerStrip::width_clicked ()
1341 MixerStrip::hide_clicked ()
1344 Hiding(); /* EMIT_SIGNAL */
1346 _mixer.hide_strip (this);
1351 MixerStrip::set_embedded (bool yn)
1357 MixerStrip::map_frozen ()
1359 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1361 AudioTrack* at = dynamic_cast<AudioTrack*>(&_route);
1364 switch (at->freeze_state()) {
1365 case AudioTrack::Frozen:
1366 pre_redirect_box.set_sensitive (false);
1367 post_redirect_box.set_sensitive (false);
1368 speed_spinner.set_sensitive (false);
1371 pre_redirect_box.set_sensitive (true);
1372 post_redirect_box.set_sensitive (true);
1373 speed_spinner.set_sensitive (true);
1377 _route.foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1381 MixerStrip::hide_redirect_editor (Redirect* redirect)
1383 void* gui = redirect->get_gui ();
1386 static_cast<Gtk::Widget*>(gui)->hide ();
1391 MixerStrip::route_active_changed ()
1393 RouteUI::route_active_changed ();
1395 if (is_audio_track()) {
1396 if (_route.active()) {
1397 set_name ("AudioTrackStripBase");
1398 gpm.set_meter_strip_name ("AudioTrackStripBase");
1400 set_name ("AudioTrackStripBaseInactive");
1401 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1403 gpm.set_fader_name ("AudioTrackFader");
1405 if (_route.active()) {
1406 set_name ("AudioBusStripBase");
1407 gpm.set_meter_strip_name ("AudioBusStripBase");
1409 set_name ("AudioBusStripBaseInactive");
1410 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1412 gpm.set_fader_name ("AudioBusFader");
1417 MixerStrip::mix_group() const
1419 return _route.mix_group();