2 Copyright (C) 2000 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.
25 #include <sigc++/bind.h>
26 #include <pbd/xml++.h>
27 #include <pbd/enumwriter.h>
29 #include <ardour/timestamps.h>
30 #include <ardour/buffer.h>
31 #include <ardour/audioengine.h>
32 #include <ardour/route.h>
33 #include <ardour/insert.h>
34 #include <ardour/send.h>
35 #include <ardour/session.h>
36 #include <ardour/utils.h>
37 #include <ardour/configuration.h>
38 #include <ardour/cycle_timer.h>
39 #include <ardour/route_group.h>
40 #include <ardour/port.h>
41 #include <ardour/ladspa_plugin.h>
42 #include <ardour/panner.h>
43 #include <ardour/dB.h>
44 #include <ardour/mix.h>
49 using namespace ARDOUR;
53 uint32_t Route::order_key_cnt = 0;
56 Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, DataType default_type)
57 : IO (sess, name, input_min, input_max, output_min, output_max, default_type),
59 _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
60 _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
65 Route::Route (Session& sess, const XMLNode& node, DataType default_type)
66 : IO (sess, *node.child ("IO"), default_type),
67 _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
68 _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
71 _set_state (node, false);
77 redirect_max_outs = 0;
81 _phase_invert = false;
82 order_keys[N_("signal")] = order_key_cnt++;
85 _meter_point = MeterPostFader;
89 _have_internal_generator = false;
91 _pending_declick = true;
92 _remote_control_id = 0;
93 _ignore_gain_on_deliver = true;
98 _mute_affects_pre_fader = Config->get_mute_affects_pre_fader();
99 _mute_affects_post_fader = Config->get_mute_affects_post_fader();
100 _mute_affects_control_outs = Config->get_mute_affects_control_outs();
101 _mute_affects_main_outs = Config->get_mute_affects_main_outs();
104 desired_solo_gain = 1.0;
106 desired_mute_gain = 1.0;
110 input_changed.connect (mem_fun (this, &Route::input_change_handler));
111 output_changed.connect (mem_fun (this, &Route::output_change_handler));
116 clear_redirects (this);
119 delete _control_outs;
124 Route::set_remote_control_id (uint32_t id)
126 if (id != _remote_control_id) {
127 _remote_control_id = id;
128 RemoteControlIDChanged ();
133 Route::remote_control_id() const
135 return _remote_control_id;
139 Route::order_key (string name) const
141 OrderKeys::const_iterator i;
143 if ((i = order_keys.find (name)) == order_keys.end()) {
151 Route::set_order_key (string name, long n)
153 order_keys[name] = n;
154 _session.set_dirty ();
158 Route::inc_gain (gain_t fraction, void *src)
160 IO::inc_gain (fraction, src);
164 Route::set_gain (gain_t val, void *src)
166 if (src != 0 && _mix_group && src != _mix_group && _mix_group->is_active()) {
168 if (_mix_group->is_relative()) {
171 gain_t usable_gain = gain();
172 if (usable_gain < 0.000001f) {
173 usable_gain=0.000001f;
177 if (delta < 0.000001f) {
181 delta -= usable_gain;
183 if (delta == 0.0f) return;
185 gain_t factor = delta / usable_gain;
188 factor = _mix_group->get_max_factor(factor);
189 if (factor == 0.0f) {
194 factor = _mix_group->get_min_factor(factor);
195 if (factor == 0.0f) {
201 _mix_group->apply (&Route::inc_gain, factor, _mix_group);
205 _mix_group->apply (&Route::set_gain, val, _mix_group);
215 IO::set_gain (val, src);
219 Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
220 nframes_t start_frame, nframes_t end_frame,
221 nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
225 RedirectList::iterator i;
226 bool post_fader_work = false;
227 bool mute_declick_applied = false;
229 vector<Sample*>::iterator bufiter;
234 gain_t* gab = _session.gain_automation_buffer();
236 switch (Config->get_monitoring_model()) {
237 case HardwareMonitoring:
238 case ExternalMonitoring:
245 declick = _pending_declick;
248 Glib::Mutex::Lock cm (control_outs_lock, Glib::TRY_LOCK);
258 Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
261 dmg = desired_mute_gain;
262 dsg = desired_solo_gain;
271 /* ----------------------------------------------------------------------------------------------------
272 GLOBAL DECLICK (for transport changes etc.)
273 -------------------------------------------------------------------------------------------------- */
276 apply_declick (bufs, nbufs, nframes, 0.0, 1.0, false);
277 _pending_declick = 0;
278 } else if (declick < 0) {
279 apply_declick (bufs, nbufs, nframes, 1.0, 0.0, false);
280 _pending_declick = 0;
283 /* no global declick */
285 if (solo_gain != dsg) {
286 apply_declick (bufs, nbufs, nframes, solo_gain, dsg, false);
292 /* ----------------------------------------------------------------------------------------------------
293 INPUT METERING & MONITORING
294 -------------------------------------------------------------------------------------------------- */
296 if (meter && (_meter_point == MeterInput)) {
297 for (n = 0; n < nbufs; ++n) {
298 _peak_power[n] = Session::compute_peak (bufs[n], nframes, _peak_power[n]);
302 if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) {
303 apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
305 mute_declick_applied = true;
308 if ((_meter_point == MeterInput) && co) {
310 solo_audible = dsg > 0;
311 mute_audible = dmg > 0;// || !_mute_affects_pre_fader;
313 if ( // muted by solo of another track
317 // muted by mute of this track
321 // rec-enabled but not s/w monitoring
323 // TODO: this is probably wrong
325 (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
329 co->silence (nframes, offset);
333 co->deliver_output (bufs, nbufs, nframes, offset);
338 /* ----------------------------------------------------------------------------------------------------
340 -------------------------------------------------------------------------------------------------- */
342 if (with_redirects) {
343 Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
345 if (mute_gain > 0 || !_mute_affects_pre_fader) {
346 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
347 switch ((*i)->placement()) {
350 if (boost::dynamic_pointer_cast<Send>(*i) || boost::dynamic_pointer_cast<PortInsert>(*i)) {
351 (*i)->silence (nframes, offset);
354 (*i)->run (bufs, nbufs, nframes, offset);
358 post_fader_work = true;
363 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
364 switch ((*i)->placement()) {
366 (*i)->silence (nframes, offset);
369 post_fader_work = true;
378 if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_post_fader) {
379 apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
381 mute_declick_applied = true;
384 /* ----------------------------------------------------------------------------------------------------
385 PRE-FADER METERING & MONITORING
386 -------------------------------------------------------------------------------------------------- */
388 if (meter && (_meter_point == MeterPreFader)) {
389 for (n = 0; n < nbufs; ++n) {
390 _peak_power[n] = Session::compute_peak (bufs[n], nframes, _peak_power[n]);
395 if ((_meter_point == MeterPreFader) && co) {
397 solo_audible = dsg > 0;
398 mute_audible = dmg > 0 || !_mute_affects_pre_fader;
400 if ( // muted by solo of another track
404 // muted by mute of this track
408 // rec-enabled but not s/w monitoring
410 (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
414 co->silence (nframes, offset);
418 co->deliver_output (bufs, nbufs, nframes, offset);
423 /* ----------------------------------------------------------------------------------------------------
425 -------------------------------------------------------------------------------------------------- */
427 /* if not recording or recording and requiring any monitor signal, then apply gain */
429 if ( // not recording
431 !(record_enabled() && _session.actively_recording()) ||
435 // h/w monitoring not in use
437 (!Config->get_monitoring_model() == HardwareMonitoring &&
439 // AND software monitoring required
441 Config->get_monitoring_model() == SoftwareMonitoring)) {
443 if (apply_gain_automation) {
446 for (n = 0; n < nbufs; ++n) {
447 Sample *sp = bufs[n];
449 for (nframes_t nx = 0; nx < nframes; ++nx) {
454 for (n = 0; n < nbufs; ++n) {
455 Sample *sp = bufs[n];
457 for (nframes_t nx = 0; nx < nframes; ++nx) {
463 if (apply_gain_automation && _session.transport_rolling() && nframes > 0) {
464 _effective_gain = gab[nframes-1];
469 /* manual (scalar) gain */
473 apply_declick (bufs, nbufs, nframes, _gain, dg, _phase_invert);
476 } else if (_gain != 0 && (_phase_invert || _gain != 1.0)) {
478 /* no need to interpolate current gain value,
479 but its non-unity, so apply it. if the gain
480 is zero, do nothing because we'll ship silence
492 for (n = 0; n < nbufs; ++n) {
493 Sample *sp = bufs[n];
494 Session::apply_gain_to_buffer(sp,nframes,this_gain);
497 } else if (_gain == 0) {
498 for (n = 0; n < nbufs; ++n) {
499 memset (bufs[n], 0, sizeof (Sample) * nframes);
506 /* actively recording, no monitoring required; leave buffers as-is to save CPU cycles */
510 /* ----------------------------------------------------------------------------------------------------
512 -------------------------------------------------------------------------------------------------- */
514 /* note that post_fader_work cannot be true unless with_redirects was also true, so don't test both */
516 if (post_fader_work) {
518 Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
520 if (mute_gain > 0 || !_mute_affects_post_fader) {
521 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
522 switch ((*i)->placement()) {
527 if (boost::dynamic_pointer_cast<Send>(*i) || boost::dynamic_pointer_cast<PortInsert>(*i)) {
528 (*i)->silence (nframes, offset);
531 (*i)->run (bufs, nbufs, nframes, offset);
537 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
538 switch ((*i)->placement()) {
542 (*i)->silence (nframes, offset);
550 if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_control_outs) {
551 apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
553 mute_declick_applied = true;
556 /* ----------------------------------------------------------------------------------------------------
558 -------------------------------------------------------------------------------------------------- */
560 if ((_meter_point == MeterPostFader) && co) {
562 solo_audible = solo_gain > 0;
563 mute_audible = dmg > 0 || !_mute_affects_control_outs;
565 if ( // silent anyway
567 (_gain == 0 && !apply_gain_automation) ||
569 // muted by solo of another track
573 // muted by mute of this track
577 // recording but not s/w monitoring
579 (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
583 co->silence (nframes, offset);
587 co->deliver_output_no_pan (bufs, nbufs, nframes, offset);
591 /* ----------------------------------------------------------------------
593 ----------------------------------------------------------------------*/
595 if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_main_outs) {
596 apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
598 mute_declick_applied = true;
601 /* ----------------------------------------------------------------------------------------------------
603 -------------------------------------------------------------------------------------------------- */
605 solo_audible = dsg > 0;
606 mute_audible = dmg > 0 || !_mute_affects_main_outs;
608 if (n_outputs() == 0) {
612 } else if (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) {
614 IO::silence (nframes, offset);
618 if ( // silent anyway
620 (_gain == 0 && !apply_gain_automation) ||
622 // muted by solo of another track, but not using control outs for solo
624 (!solo_audible && (Config->get_solo_model() != SoloBus)) ||
626 // muted by mute of this track
632 /* don't use Route::silence() here, because that causes
633 all outputs (sends, port inserts, etc. to be silent).
636 if (_meter_point == MeterPostFader) {
637 reset_peak_meters ();
640 IO::silence (nframes, offset);
644 if ((_session.transport_speed() > 1.5f ||
645 _session.transport_speed() < -1.5f) &&
646 Config->get_quieten_at_speed()) {
647 pan (bufs, nbufs, nframes, offset, speed_quietning);
649 // cerr << _name << " panner state = " << _panner->automation_state() << endl;
650 if (!_panner->empty() &&
651 (_panner->automation_state() & Play ||
652 ((_panner->automation_state() & Touch) && !_panner->touching()))) {
653 pan_automated (bufs, nbufs, start_frame, end_frame, nframes, offset);
655 pan (bufs, nbufs, nframes, offset, 1.0);
662 /* ----------------------------------------------------------------------------------------------------
664 -------------------------------------------------------------------------------------------------- */
666 if (meter && (_meter_point == MeterPostFader)) {
667 // cerr << "meter post" << endl;
669 if ((_gain == 0 && !apply_gain_automation) || dmg == 0) {
670 uint32_t no = n_outputs();
671 for (n = 0; n < no; ++n) {
675 uint32_t no = n_outputs();
676 for (n = 0; n < no; ++n) {
677 _peak_power[n] = Session::compute_peak (output(n)->get_buffer (nframes) + offset, nframes, _peak_power[n]);
684 Route::n_process_buffers ()
686 return max (n_inputs(), redirect_max_outs);
691 Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter_first)
693 vector<Sample*>& bufs = _session.get_passthru_buffers();
694 uint32_t limit = n_process_buffers ();
698 collect_input (bufs, limit, nframes, offset);
700 #define meter_stream meter_first
703 for (uint32_t n = 0; n < limit; ++n) {
704 _peak_power[n] = Session::compute_peak (bufs[n], nframes, _peak_power[n]);
706 meter_stream = false;
711 process_output_buffers (bufs, limit, start_frame, end_frame, nframes, offset, true, declick, meter_stream);
717 Route::set_phase_invert (bool yn, void *src)
719 if (_phase_invert != yn) {
722 // phase_invert_changed (src); /* EMIT SIGNAL */
726 Route::set_solo (bool yn, void *src)
732 if (_mix_group && src != _mix_group && _mix_group->is_active()) {
733 _mix_group->apply (&Route::set_solo, yn, _mix_group);
739 solo_changed (src); /* EMIT SIGNAL */
740 _solo_control.Changed (); /* EMIT SIGNAL */
745 Route::set_solo_mute (bool yn)
747 Glib::Mutex::Lock lm (declick_lock);
749 /* Called by Session in response to another Route being soloed.
752 desired_solo_gain = (yn?0.0:1.0);
756 Route::set_solo_safe (bool yn, void *src)
758 if (_solo_safe != yn) {
760 solo_safe_changed (src); /* EMIT SIGNAL */
765 Route::set_mute (bool yn, void *src)
768 if (_mix_group && src != _mix_group && _mix_group->is_active()) {
769 _mix_group->apply (&Route::set_mute, yn, _mix_group);
775 mute_changed (src); /* EMIT SIGNAL */
777 _mute_control.Changed (); /* EMIT SIGNAL */
779 Glib::Mutex::Lock lm (declick_lock);
780 desired_mute_gain = (yn?0.0f:1.0f);
785 Route::add_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t* err_streams)
787 uint32_t old_rmo = redirect_max_outs;
789 if (!_session.engine().connected()) {
794 Glib::RWLock::WriterLock lm (redirect_lock);
796 boost::shared_ptr<PluginInsert> pi;
797 boost::shared_ptr<PortInsert> porti;
799 uint32_t potential_max_streams = 0;
801 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(redirect)) != 0) {
804 if (pi->input_streams() == 0) {
805 /* instrument plugin */
806 _have_internal_generator = true;
809 potential_max_streams = max(pi->input_streams(), pi->output_streams());
811 } else if ((porti = boost::dynamic_pointer_cast<PortInsert>(redirect)) != 0) {
813 /* force new port inserts to start out with an i/o configuration
814 that matches this route's i/o configuration.
816 the "inputs" for the port are supposed to match the output
819 the "outputs" of the route should match the inputs of this
820 route. XXX shouldn't they match the number of active signal
821 streams at the point of insertion?
825 porti->ensure_io (n_outputs (), n_inputs(), false, this);
828 // Ensure peak vector sizes before the plugin is activated
829 while (_peak_power.size() < potential_max_streams) {
830 _peak_power.push_back(0);
832 while (_visible_peak_power.size() < potential_max_streams) {
833 _visible_peak_power.push_back(-INFINITY);
835 while (_max_peak_power.size() < potential_max_streams) {
836 _max_peak_power.push_back(-INFINITY);
839 _redirects.push_back (redirect);
841 if (_reset_plugin_counts (err_streams)) {
842 _redirects.pop_back ();
843 _reset_plugin_counts (0); // it worked before we tried to add it ...
847 redirect->activate ();
848 redirect->active_changed.connect (mem_fun (*this, &Route::redirect_active_proxy));
851 if (redirect_max_outs != old_rmo || old_rmo == 0) {
856 redirects_changed (src); /* EMIT SIGNAL */
861 Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_streams)
863 uint32_t old_rmo = redirect_max_outs;
865 if (!_session.engine().connected()) {
870 Glib::RWLock::WriterLock lm (redirect_lock);
872 RedirectList::iterator existing_end = _redirects.end();
875 uint32_t potential_max_streams = 0;
877 for (RedirectList::const_iterator i = others.begin(); i != others.end(); ++i) {
879 boost::shared_ptr<PluginInsert> pi;
881 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
884 uint32_t m = max(pi->input_streams(), pi->output_streams());
885 if (m > potential_max_streams)
886 potential_max_streams = m;
889 // Ensure peak vector sizes before the plugin is activated
890 while (_peak_power.size() < potential_max_streams) {
891 _peak_power.push_back(0);
893 while (_visible_peak_power.size() < potential_max_streams) {
894 _visible_peak_power.push_back(-INFINITY);
896 while (_max_peak_power.size() < potential_max_streams) {
897 _max_peak_power.push_back(-INFINITY);
900 _redirects.push_back (*i);
902 if (_reset_plugin_counts (err_streams)) {
904 _redirects.erase (existing_end, _redirects.end());
905 _reset_plugin_counts (0); // it worked before we tried to add it ...
910 (*i)->active_changed.connect (mem_fun (*this, &Route::redirect_active_proxy));
914 if (redirect_max_outs != old_rmo || old_rmo == 0) {
918 redirects_changed (src); /* EMIT SIGNAL */
923 Route::clear_redirects (void *src)
925 uint32_t old_rmo = redirect_max_outs;
927 if (!_session.engine().connected()) {
932 Glib::RWLock::WriterLock lm (redirect_lock);
933 RedirectList::iterator i;
934 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
935 (*i)->drop_references ();
940 if (redirect_max_outs != old_rmo) {
944 redirect_max_outs = 0;
945 _have_internal_generator = false;
946 redirects_changed (src); /* EMIT SIGNAL */
950 Route::remove_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t* err_streams)
952 uint32_t old_rmo = redirect_max_outs;
954 if (!_session.engine().connected()) {
958 redirect_max_outs = 0;
961 Glib::RWLock::WriterLock lm (redirect_lock);
962 RedirectList::iterator i;
963 bool removed = false;
965 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
966 if (*i == redirect) {
968 RedirectList::iterator tmp;
970 /* move along, see failure case for reset_plugin_counts()
971 where we may need to reinsert the redirect.
977 /* stop redirects that send signals to JACK ports
978 from causing noise as a result of no longer being
982 boost::shared_ptr<Send> send;
983 boost::shared_ptr<PortInsert> port_insert;
985 if ((send = boost::dynamic_pointer_cast<Send> (*i)) != 0) {
986 send->disconnect_inputs (this);
987 send->disconnect_outputs (this);
988 } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (*i)) != 0) {
989 port_insert->disconnect_inputs (this);
990 port_insert->disconnect_outputs (this);
993 _redirects.erase (i);
1006 if (_reset_plugin_counts (err_streams)) {
1007 /* get back to where we where */
1008 _redirects.insert (i, redirect);
1009 /* we know this will work, because it worked before :) */
1010 _reset_plugin_counts (0);
1016 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
1017 boost::shared_ptr<PluginInsert> pi;
1019 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
1020 if (pi->is_generator()) {
1026 _have_internal_generator = foo;
1029 if (old_rmo != redirect_max_outs) {
1033 redirect->drop_references ();
1035 redirects_changed (src); /* EMIT SIGNAL */
1040 Route::reset_plugin_counts (uint32_t* lpc)
1042 Glib::RWLock::WriterLock lm (redirect_lock);
1043 return _reset_plugin_counts (lpc);
1048 Route::_reset_plugin_counts (uint32_t* err_streams)
1050 RedirectList::iterator r;
1053 map<Placement,list<InsertCount> > insert_map;
1054 nframes_t initial_streams;
1056 redirect_max_outs = 0;
1060 /* divide inserts up by placement so we get the signal flow
1061 properly modelled. we need to do this because the _redirects
1062 list is not sorted by placement, and because other reasons may
1063 exist now or in the future for this separate treatment.
1066 for (r = _redirects.begin(); r != _redirects.end(); ++r) {
1068 boost::shared_ptr<Insert> insert;
1070 /* do this here in case we bomb out before we get to the end of
1074 redirect_max_outs = max ((*r)->output_streams (), redirect_max_outs);
1076 if ((insert = boost::dynamic_pointer_cast<Insert>(*r)) != 0) {
1078 insert_map[insert->placement()].push_back (InsertCount (insert));
1080 /* reset plugin counts back to one for now so
1081 that we have a predictable, controlled
1082 state to try to configure.
1085 boost::shared_ptr<PluginInsert> pi;
1087 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(insert)) != 0) {
1091 } else if (boost::dynamic_pointer_cast<Send> (*r) != 0) {
1104 /* Now process each placement in order, checking to see if we
1105 can really do what has been requested.
1110 if (check_some_plugin_counts (insert_map[PreFader], n_inputs (), err_streams)) {
1114 /* figure out the streams that will feed into PreFader */
1116 if (!insert_map[PreFader].empty()) {
1117 InsertCount& ic (insert_map[PreFader].back());
1118 initial_streams = ic.insert->compute_output_streams (ic.cnt);
1120 initial_streams = n_inputs ();
1125 if (check_some_plugin_counts (insert_map[PostFader], initial_streams, err_streams)) {
1129 /* OK, everything can be set up correctly, so lets do it */
1131 apply_some_plugin_counts (insert_map[PreFader]);
1132 apply_some_plugin_counts (insert_map[PostFader]);
1134 /* recompute max outs of any redirect */
1138 redirect_max_outs = 0;
1139 RedirectList::iterator prev = _redirects.end();
1141 for (r = _redirects.begin(); r != _redirects.end(); prev = r, ++r) {
1142 boost::shared_ptr<Send> s;
1144 if ((s = boost::dynamic_pointer_cast<Send> (*r)) != 0) {
1145 if (r == _redirects.begin()) {
1146 s->expect_inputs (n_inputs());
1148 s->expect_inputs ((*prev)->output_streams());
1153 /* don't pay any attention to send output configuration, since it doesn't
1157 redirect_max_outs = max ((*r)->output_streams (), redirect_max_outs);
1168 Route::apply_some_plugin_counts (list<InsertCount>& iclist)
1170 list<InsertCount>::iterator i;
1172 for (i = iclist.begin(); i != iclist.end(); ++i) {
1174 if ((*i).insert->configure_io ((*i).cnt, (*i).in, (*i).out)) {
1177 /* make sure that however many we have, they are all active */
1178 (*i).insert->activate ();
1185 Route::check_some_plugin_counts (list<InsertCount>& iclist, int32_t required_inputs, uint32_t* err_streams)
1187 list<InsertCount>::iterator i;
1189 for (i = iclist.begin(); i != iclist.end(); ++i) {
1191 if (((*i).cnt = (*i).insert->can_support_input_configuration (required_inputs)) < 0) {
1193 *err_streams = required_inputs;
1198 (*i).in = required_inputs;
1199 (*i).out = (*i).insert->compute_output_streams ((*i).cnt);
1201 required_inputs = (*i).out;
1208 Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_streams)
1210 uint32_t old_rmo = redirect_max_outs;
1216 RedirectList to_be_deleted;
1219 Glib::RWLock::WriterLock lm (redirect_lock);
1220 RedirectList::iterator tmp;
1221 RedirectList the_copy;
1223 the_copy = _redirects;
1225 /* remove all relevant redirects */
1227 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ) {
1231 if ((*i)->placement() == placement) {
1232 to_be_deleted.push_back (*i);
1233 _redirects.erase (i);
1239 /* now copy the relevant ones from "other" */
1241 for (RedirectList::const_iterator i = other._redirects.begin(); i != other._redirects.end(); ++i) {
1242 if ((*i)->placement() == placement) {
1243 _redirects.push_back (Redirect::clone (*i));
1247 /* reset plugin stream handling */
1249 if (_reset_plugin_counts (err_streams)) {
1251 /* FAILED COPY ATTEMPT: we have to restore order */
1253 /* delete all cloned redirects */
1255 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ) {
1260 if ((*i)->placement() == placement) {
1261 _redirects.erase (i);
1267 /* restore the natural order */
1269 _redirects = the_copy;
1270 redirect_max_outs = old_rmo;
1272 /* we failed, even though things are OK again */
1278 /* SUCCESSFUL COPY ATTEMPT: delete the redirects we removed pre-copy */
1279 to_be_deleted.clear ();
1283 if (redirect_max_outs != old_rmo || old_rmo == 0) {
1287 redirects_changed (this); /* EMIT SIGNAL */
1292 Route::all_redirects_flip ()
1294 Glib::RWLock::ReaderLock lm (redirect_lock);
1296 if (_redirects.empty()) {
1300 bool first_is_on = _redirects.front()->active();
1302 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
1303 (*i)->set_active (!first_is_on, this);
1308 Route::all_redirects_active (bool state)
1310 Glib::RWLock::ReaderLock lm (redirect_lock);
1312 if (_redirects.empty()) {
1316 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
1317 (*i)->set_active (state, this);
1321 struct RedirectSorter {
1322 bool operator() (boost::shared_ptr<const Redirect> a, boost::shared_ptr<const Redirect> b) {
1323 return a->sort_key() < b->sort_key();
1328 Route::sort_redirects (uint32_t* err_streams)
1331 RedirectSorter comparator;
1332 Glib::RWLock::WriterLock lm (redirect_lock);
1333 uint32_t old_rmo = redirect_max_outs;
1335 /* the sweet power of C++ ... */
1337 RedirectList as_it_was_before = _redirects;
1339 _redirects.sort (comparator);
1341 if (_reset_plugin_counts (err_streams)) {
1342 _redirects = as_it_was_before;
1343 redirect_max_outs = old_rmo;
1349 redirects_changed (this); /* EMIT SIGNAL */
1361 Route::get_template()
1363 return state(false);
1367 Route::state(bool full_state)
1369 XMLNode *node = new XMLNode("Route");
1370 RedirectList:: iterator i;
1374 node->add_property("flags", enum_2_string (_flags));
1377 node->add_property("default-type", _default_type.to_string());
1379 node->add_property("active", _active?"yes":"no");
1380 node->add_property("muted", _muted?"yes":"no");
1381 node->add_property("soloed", _soloed?"yes":"no");
1382 node->add_property("phase-invert", _phase_invert?"yes":"no");
1383 node->add_property("mute-affects-pre-fader", _mute_affects_pre_fader?"yes":"no");
1384 node->add_property("mute-affects-post-fader", _mute_affects_post_fader?"yes":"no");
1385 node->add_property("mute-affects-control-outs", _mute_affects_control_outs?"yes":"no");
1386 node->add_property("mute-affects-main-outs", _mute_affects_main_outs?"yes":"no");
1389 node->add_property("edit-group", _edit_group->name());
1392 node->add_property("mix-group", _mix_group->name());
1395 string order_string;
1396 OrderKeys::iterator x = order_keys.begin();
1398 while (x != order_keys.end()) {
1399 order_string += (*x).first;
1400 order_string += '=';
1401 snprintf (buf, sizeof(buf), "%ld", (*x).second);
1402 order_string += buf;
1406 if (x == order_keys.end()) {
1410 order_string += ':';
1412 node->add_property ("order-keys", order_string);
1414 node->add_child_nocopy (IO::state (full_state));
1415 node->add_child_nocopy (_solo_control.get_state ());
1416 node->add_child_nocopy (_mute_control.get_state ());
1418 if (_control_outs) {
1419 XMLNode* cnode = new XMLNode (X_("ControlOuts"));
1420 cnode->add_child_nocopy (_control_outs->state (full_state));
1421 node->add_child_nocopy (*cnode);
1424 if (_comment.length()) {
1425 XMLNode *cmt = node->add_child ("Comment");
1426 cmt->add_content (_comment);
1429 for (i = _redirects.begin(); i != _redirects.end(); ++i) {
1430 node->add_child_nocopy((*i)->state (full_state));
1434 node->add_child_copy (*_extra_xml);
1441 Route::set_deferred_state ()
1444 XMLNodeConstIterator niter;
1446 if (!deferred_state) {
1450 nlist = deferred_state->children();
1452 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
1453 add_redirect_from_xml (**niter);
1456 delete deferred_state;
1461 Route::add_redirect_from_xml (const XMLNode& node)
1463 const XMLProperty *prop;
1465 if (node.name() == "Send") {
1469 boost::shared_ptr<Send> send (new Send (_session, node));
1470 add_redirect (send, this);
1473 catch (failed_constructor &err) {
1474 error << _("Send construction failed") << endmsg;
1478 } else if (node.name() == "Insert") {
1481 if ((prop = node.property ("type")) != 0) {
1483 boost::shared_ptr<Insert> insert;
1485 if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "vst") {
1487 insert.reset (new PluginInsert(_session, node));
1489 } else if (prop->value() == "port") {
1492 insert.reset (new PortInsert (_session, node));
1496 error << string_compose(_("unknown Insert type \"%1\"; ignored"), prop->value()) << endmsg;
1499 add_redirect (insert, this);
1502 error << _("Insert XML node has no type property") << endmsg;
1506 catch (failed_constructor &err) {
1507 warning << _("insert could not be created. Ignored.") << endmsg;
1514 Route::set_state (const XMLNode& node)
1516 return _set_state (node, true);
1520 Route::_set_state (const XMLNode& node, bool call_base)
1523 XMLNodeConstIterator niter;
1525 XMLPropertyList plist;
1526 const XMLProperty *prop;
1528 if (node.name() != "Route"){
1529 error << string_compose(_("Bad node sent to Route::set_state() [%1]"), node.name()) << endmsg;
1533 if ((prop = node.property (X_("flags"))) != 0) {
1534 _flags = Flag (string_2_enum (prop->value(), _flags));
1539 if ((prop = node.property (X_("default-type"))) != 0) {
1540 _default_type = DataType(prop->value());
1541 assert(_default_type != DataType::NIL);
1544 if ((prop = node.property (X_("phase-invert"))) != 0) {
1545 set_phase_invert(prop->value()=="yes"?true:false, this);
1548 if ((prop = node.property (X_("active"))) != 0) {
1549 set_active (prop->value() == "yes");
1552 if ((prop = node.property (X_("muted"))) != 0) {
1553 bool yn = prop->value()=="yes"?true:false;
1555 /* force reset of mute status */
1559 mute_gain = desired_mute_gain;
1562 if ((prop = node.property (X_("soloed"))) != 0) {
1563 bool yn = prop->value()=="yes"?true:false;
1565 /* force reset of solo status */
1568 set_solo (yn, this);
1569 solo_gain = desired_solo_gain;
1572 if ((prop = node.property (X_("mute-affects-pre-fader"))) != 0) {
1573 _mute_affects_pre_fader = (prop->value()=="yes")?true:false;
1576 if ((prop = node.property (X_("mute-affects-post-fader"))) != 0) {
1577 _mute_affects_post_fader = (prop->value()=="yes")?true:false;
1580 if ((prop = node.property (X_("mute-affects-control-outs"))) != 0) {
1581 _mute_affects_control_outs = (prop->value()=="yes")?true:false;
1584 if ((prop = node.property (X_("mute-affects-main-outs"))) != 0) {
1585 _mute_affects_main_outs = (prop->value()=="yes")?true:false;
1588 if ((prop = node.property (X_("edit-group"))) != 0) {
1589 RouteGroup* edit_group = _session.edit_group_by_name(prop->value());
1590 if(edit_group == 0) {
1591 error << string_compose(_("Route %1: unknown edit group \"%2 in saved state (ignored)"), _name, prop->value()) << endmsg;
1593 set_edit_group(edit_group, this);
1597 if ((prop = node.property (X_("order-keys"))) != 0) {
1601 string::size_type colon, equal;
1602 string remaining = prop->value();
1604 while (remaining.length()) {
1606 if ((equal = remaining.find_first_of ('=')) == string::npos || equal == remaining.length()) {
1607 error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
1610 if (sscanf (remaining.substr (equal+1).c_str(), "%ld", &n) != 1) {
1611 error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
1614 set_order_key (remaining.substr (0, equal), n);
1618 colon = remaining.find_first_of (':');
1620 if (colon != string::npos) {
1621 remaining = remaining.substr (colon+1);
1628 nlist = node.children();
1630 if (deferred_state) {
1631 delete deferred_state;
1634 deferred_state = new XMLNode(X_("deferred state"));
1636 /* set parent class properties before anything else */
1638 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
1642 if (child->name() == IO::state_node_name && call_base) {
1644 IO::set_state (*child);
1649 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
1653 if (child->name() == X_("Send")) {
1656 if (!IO::ports_legal) {
1658 deferred_state->add_child_copy (*child);
1661 add_redirect_from_xml (*child);
1664 } else if (child->name() == X_("Insert")) {
1666 if (!IO::ports_legal) {
1668 deferred_state->add_child_copy (*child);
1672 add_redirect_from_xml (*child);
1675 } else if (child->name() == X_("Automation")) {
1677 if ((prop = child->property (X_("path"))) != 0) {
1678 load_automation (prop->value());
1681 } else if (child->name() == X_("ControlOuts")) {
1683 string coutname = _name;
1684 coutname += _("[control]");
1686 _control_outs = new IO (_session, coutname);
1687 _control_outs->set_state (**(child->children().begin()));
1689 } else if (child->name() == X_("Comment")) {
1691 /* XXX this is a terrible API design in libxml++ */
1693 XMLNode *cmt = *(child->children().begin());
1694 _comment = cmt->content();
1696 } else if (child->name() == X_("extra")) {
1698 _extra_xml = new XMLNode (*child);
1700 } else if (child->name() == X_("controllable") && (prop = child->property("name")) != 0) {
1702 if (prop->value() == "solo") {
1703 _solo_control.set_state (*child);
1704 _session.add_controllable (&_solo_control);
1706 else if (prop->value() == "mute") {
1707 _mute_control.set_state (*child);
1708 _session.add_controllable (&_mute_control);
1713 if ((prop = node.property (X_("mix-group"))) != 0) {
1714 RouteGroup* mix_group = _session.mix_group_by_name(prop->value());
1715 if (mix_group == 0) {
1716 error << string_compose(_("Route %1: unknown mix group \"%2 in saved state (ignored)"), _name, prop->value()) << endmsg;
1718 set_mix_group(mix_group, this);
1726 Route::curve_reallocate ()
1728 // _gain_automation_curve.finish_resize ();
1729 // _pan_automation_curve.finish_resize ();
1733 Route::silence (nframes_t nframes, nframes_t offset)
1737 // reset_peak_meters ();
1739 IO::silence (nframes, offset);
1741 if (_control_outs) {
1742 _control_outs->silence (nframes, offset);
1746 Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
1749 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
1750 boost::shared_ptr<PluginInsert> pi;
1751 if (!_active && (pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) != 0) {
1752 // skip plugins, they don't need anything when we're not active
1756 (*i)->silence (nframes, offset);
1759 if (nframes == _session.get_block_size() && offset == 0) {
1769 Route::set_control_outs (const vector<string>& ports)
1771 Glib::Mutex::Lock lm (control_outs_lock);
1772 vector<string>::const_iterator i;
1774 if (_control_outs) {
1775 delete _control_outs;
1779 if (ports.empty()) {
1783 string coutname = _name;
1784 coutname += _("[control]");
1786 _control_outs = new IO (_session, coutname);
1788 /* our control outs need as many outputs as we
1789 have outputs. we track the changes in ::output_change_handler().
1792 _control_outs->ensure_io (0, n_outputs(), true, this);
1798 Route::set_edit_group (RouteGroup *eg, void *src)
1801 if (eg == _edit_group) {
1806 _edit_group->remove (this);
1809 if ((_edit_group = eg) != 0) {
1810 _edit_group->add (this);
1813 _session.set_dirty ();
1814 edit_group_changed (src); /* EMIT SIGNAL */
1818 Route::drop_edit_group (void *src)
1821 _session.set_dirty ();
1822 edit_group_changed (src); /* EMIT SIGNAL */
1826 Route::set_mix_group (RouteGroup *mg, void *src)
1829 if (mg == _mix_group) {
1834 _mix_group->remove (this);
1837 if ((_mix_group = mg) != 0) {
1838 _mix_group->add (this);
1841 _session.set_dirty ();
1842 mix_group_changed (src); /* EMIT SIGNAL */
1846 Route::drop_mix_group (void *src)
1849 _session.set_dirty ();
1850 mix_group_changed (src); /* EMIT SIGNAL */
1854 Route::set_comment (string cmt, void *src)
1857 comment_changed (src);
1858 _session.set_dirty ();
1862 Route::feeds (boost::shared_ptr<Route> other)
1867 uint32_t no = self.n_outputs();
1868 uint32_t ni = other->n_inputs ();
1870 for (i = 0; i < no; ++i) {
1871 for (j = 0; j < ni; ++j) {
1872 if (self.output(i)->connected_to (other->input(j)->name())) {
1878 /* check Redirects which may also interconnect Routes */
1880 for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); r++) {
1882 no = (*r)->n_outputs();
1884 for (i = 0; i < no; ++i) {
1885 for (j = 0; j < ni; ++j) {
1886 if ((*r)->output(i)->connected_to (other->input (j)->name())) {
1893 /* check for control room outputs which may also interconnect Routes */
1895 if (_control_outs) {
1897 no = _control_outs->n_outputs();
1899 for (i = 0; i < no; ++i) {
1900 for (j = 0; j < ni; ++j) {
1901 if (_control_outs->output(i)->connected_to (other->input (j)->name())) {
1912 Route::set_mute_config (mute_type t, bool onoff, void *src)
1916 _mute_affects_pre_fader = onoff;
1917 pre_fader_changed(src); /* EMIT SIGNAL */
1921 _mute_affects_post_fader = onoff;
1922 post_fader_changed(src); /* EMIT SIGNAL */
1926 _mute_affects_control_outs = onoff;
1927 control_outs_changed(src); /* EMIT SIGNAL */
1931 _mute_affects_main_outs = onoff;
1932 main_outs_changed(src); /* EMIT SIGNAL */
1938 Route::get_mute_config (mute_type t)
1944 onoff = _mute_affects_pre_fader;
1947 onoff = _mute_affects_post_fader;
1950 onoff = _mute_affects_control_outs;
1953 onoff = _mute_affects_main_outs;
1961 Route::set_active (bool yn)
1964 active_changed(); /* EMIT SIGNAL */
1968 Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects)
1970 nframes_t now = _session.transport_frame();
1973 Glib::RWLock::ReaderLock lm (redirect_lock);
1976 automation_snapshot (now);
1979 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
1981 if (Config->get_plugins_stop_with_transport() && can_flush_redirects) {
1982 (*i)->deactivate ();
1986 (*i)->transport_stopped (now);
1990 IO::transport_stopped (now);
1992 _roll_delay = _initial_delay;
1996 Route::input_change_handler (IOChange change, void *ignored)
1998 if (change & ConfigurationChanged) {
1999 reset_plugin_counts (0);
2004 Route::output_change_handler (IOChange change, void *ignored)
2006 if (change & ConfigurationChanged) {
2007 if (_control_outs) {
2008 _control_outs->ensure_io (0, n_outputs(), true, this);
2011 reset_plugin_counts (0);
2016 Route::pans_required () const
2018 if (n_outputs() < 2) {
2022 return max (n_inputs (), redirect_max_outs);
2026 Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
2027 bool session_state_changing, bool can_record, bool rec_monitors_input)
2029 if (n_outputs() == 0) {
2033 if (session_state_changing || !_active) {
2034 silence (nframes, offset);
2038 apply_gain_automation = false;
2041 passthru (start_frame, end_frame, nframes, offset, 0, false);
2043 silence (nframes, offset);
2050 Route::check_initial_delay (nframes_t nframes, nframes_t& offset, nframes_t& transport_frame)
2052 if (_roll_delay > nframes) {
2054 _roll_delay -= nframes;
2055 silence (nframes, offset);
2056 /* transport frame is not legal for caller to use */
2059 } else if (_roll_delay > 0) {
2061 nframes -= _roll_delay;
2063 silence (_roll_delay, offset);
2065 offset += _roll_delay;
2066 transport_frame += _roll_delay;
2075 Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick,
2076 bool can_record, bool rec_monitors_input)
2079 Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
2081 // automation snapshot can also be called from the non-rt context
2082 // and it uses the redirect list, so we take the lock out here
2083 automation_snapshot (_session.transport_frame());
2087 if ((n_outputs() == 0 && _redirects.empty()) || n_inputs() == 0 || !_active) {
2088 silence (nframes, offset);
2092 nframes_t unused = 0;
2094 if ((nframes = check_initial_delay (nframes, offset, unused)) == 0) {
2100 apply_gain_automation = false;
2103 Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK);
2105 if (am.locked() && _session.transport_rolling()) {
2107 nframes_t start_frame = end_frame - nframes;
2109 if (gain_automation_playback()) {
2110 apply_gain_automation = _gain_automation_curve.rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes);
2115 passthru (start_frame, end_frame, nframes, offset, declick, false);
2121 Route::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
2122 bool can_record, bool rec_monitors_input)
2124 silence (nframes, offset);
2129 Route::toggle_monitor_input ()
2131 for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
2132 (*i)->ensure_monitor_input(!(*i)->monitoring_input());
2137 Route::has_external_redirects () const
2139 boost::shared_ptr<const PortInsert> pi;
2141 for (RedirectList::const_iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2142 if ((pi = boost::dynamic_pointer_cast<const PortInsert>(*i)) != 0) {
2144 uint32_t no = pi->n_outputs();
2146 for (uint32_t n = 0; n < no; ++n) {
2148 string port_name = pi->output(n)->name();
2149 string client_name = port_name.substr (0, port_name.find(':'));
2151 /* only say "yes" if the redirect is actually in use */
2153 if (client_name != "ardour" && pi->active()) {
2164 Route::flush_redirects ()
2166 /* XXX shouldn't really try to take this lock, since
2167 this is called from the RT audio thread.
2170 Glib::RWLock::ReaderLock lm (redirect_lock);
2172 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2173 (*i)->deactivate ();
2179 Route::set_meter_point (MeterPoint p, void *src)
2181 if (_meter_point != p) {
2183 meter_change (src); /* EMIT SIGNAL */
2184 _session.set_dirty ();
2189 Route::update_total_latency ()
2193 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2194 if ((*i)->active ()) {
2195 _own_latency += (*i)->latency ();
2199 set_port_latency (_own_latency);
2201 /* this (virtual) function is used for pure Routes,
2202 not derived classes like AudioTrack. this means
2203 that the data processed here comes from an input
2204 port, not prerecorded material, and therefore we
2205 have to take into account any input latency.
2208 _own_latency += input_latency ();
2210 return _own_latency;
2214 Route::set_latency_delay (nframes_t longest_session_latency)
2216 _initial_delay = longest_session_latency - _own_latency;
2218 if (_session.transport_stopped()) {
2219 _roll_delay = _initial_delay;
2224 Route::automation_snapshot (nframes_t now)
2226 IO::automation_snapshot (now);
2228 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2229 (*i)->automation_snapshot (now);
2233 Route::ToggleControllable::ToggleControllable (std::string name, Route& s, ToggleType tp)
2234 : Controllable (name), route (s), type(tp)
2240 Route::ToggleControllable::set_value (float val)
2242 bool bval = ((val >= 0.5f) ? true: false);
2246 route.set_mute (bval, this);
2249 route.set_solo (bval, this);
2257 Route::ToggleControllable::get_value (void) const
2263 val = route.muted() ? 1.0f : 0.0f;
2266 val = route.soloed() ? 1.0f : 0.0f;
2276 Route::set_block_size (nframes_t nframes)
2278 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2279 (*i)->set_block_size (nframes);
2284 Route::redirect_active_proxy (Redirect* ignored, void* ignored_src)
2286 _session.update_latency_compensation (false, false);
2290 Route::protect_automation ()
2292 switch (gain_automation_state()) {
2295 set_gain_automation_state (Off);
2301 switch (panner().automation_state ()) {
2304 panner().set_automation_state (Off);
2310 for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
2311 boost::shared_ptr<PluginInsert> pi;
2312 if ((pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) != 0) {
2313 pi->protect_automation ();
2319 Route::set_pending_declick (int declick)
2322 /* this call is not allowed to turn off a pending declick unless "force" is true */
2324 _pending_declick = declick;
2326 // cerr << _name << ": after setting to " << declick << " pending declick = " << _pending_declick << endl;
2328 _pending_declick = 0;