#include "ardour/session.h"
#include "ardour/unknown_processor.h"
#include "ardour/utils.h"
+#include "ardour/vca.h"
#include "i18n.h"
_output->changed.connect_same_thread (*this, boost::bind (&Route::output_change_handler, this, _1, _2));
_output->PortCountChanging.connect_same_thread (*this, boost::bind (&Route::output_port_count_changing, this, _1));
-#if 0 // not used - just yet
- if (!is_master() && !is_monitor() && !is_auditioner()) {
- _delayline.reset (new DelayLine (_session, _name));
- add_processor (_delayline, PreFader);
- }
-#endif
-
- /* add amp processor */
+ /* add the amp/fader processor.
+ * it should be the first processor to be added on every route.
+ */
_gain_control = boost::shared_ptr<GainControllable> (new GainControllable (_session, GainAutomation, shared_from_this ()));
add_control (_gain_control);
_amp->set_display_name (_("Monitor"));
}
+#if 0 // not used - just yet
+ if (!is_master() && !is_monitor() && !is_auditioner()) {
+ _delayline.reset (new DelayLine (_session, _name));
+ add_processor (_delayline, PreFader);
+ }
+#endif
+
/* and input trim */
_trim_control = boost::shared_ptr<GainControllable> (new GainControllable (_session, TrimAutomation, shared_from_this ()));
node->add_child_nocopy (_pannable->state (full_state));
}
- for (i = _processors.begin(); i != _processors.end(); ++i) {
- if (!full_state) {
- /* template save: do not include internal sends functioning as
- aux sends because the chance of the target ID
- in the session where this template is used
- is not very likely.
-
- similarly, do not save listen sends which connect to
- the monitor section, because these will always be
- added if necessary.
- */
- boost::shared_ptr<InternalSend> is;
+ {
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+ for (i = _processors.begin(); i != _processors.end(); ++i) {
+ if (!full_state) {
+ /* template save: do not include internal sends functioning as
+ aux sends because the chance of the target ID
+ in the session where this template is used
+ is not very likely.
+
+ similarly, do not save listen sends which connect to
+ the monitor section, because these will always be
+ added if necessary.
+ */
+ boost::shared_ptr<InternalSend> is;
- if ((is = boost::dynamic_pointer_cast<InternalSend> (*i)) != 0) {
- if (is->role() == Delivery::Listen) {
- continue;
+ if ((is = boost::dynamic_pointer_cast<InternalSend> (*i)) != 0) {
+ if (is->role() == Delivery::Listen) {
+ continue;
+ }
}
}
+ node->add_child_nocopy((*i)->state (full_state));
}
- node->add_child_nocopy((*i)->state (full_state));
}
if (_extra_xml) {
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- XMLProperty const * prop = (*niter)->property ("type");
+ XMLProperty* prop = (*niter)->property ("type");
if (prop->value() == "amp") {
_amp->set_state (**niter, Stateful::current_state_version);
/* find the amp */
- ProcessorList::iterator amp = new_processors.begin ();
- while (amp != new_processors.end() && *amp != _amp) {
- ++amp;
- }
+ ProcessorList::iterator amp = find (new_processors.begin(), new_processors.end(), _amp);
- assert (amp != new_processors.end ());
+ if (amp == new_processors.end ()) {
+ error << string_compose (_("Amp/Fader on Route '%1' went AWOL. Re-added."), name()) << endmsg;
+ new_processors.push_front (_amp);
+ amp = find (new_processors.begin(), new_processors.end(), _amp);
+ }
/* and the processor after the amp */
return boost::shared_ptr<AutomationControl>();
#endif
}
+
+bool
+Route::slaved_to (boost::shared_ptr<VCA> vca) const
+{
+ if (!vca || !_gain_control) {
+ return false;
+ }
+
+ return _gain_control->slaved_to (vca);
+}