#include "ardour/session.h"
#include "ardour/unknown_processor.h"
#include "ardour/utils.h"
+#include "ardour/vca.h"
#include "i18n.h"
/** Base class for all routable/mixable objects (tracks and busses) */
Route::Route (Session& sess, string name, Flag flg, DataType default_type)
- : SessionObject (sess, name)
+ : Stripable (sess, name)
, Automatable (sess)
, GraphNode (sess._process_graph)
, _active (true)
_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 ()));
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);
return _gain_control;
}
-boost::shared_ptr<GainControl>
+boost::shared_ptr<AutomationControl>
Route::trim_control() const
{
return _trim_control;
}
-boost::shared_ptr<Route::PhaseControllable>
+boost::shared_ptr<AutomationControl>
Route::phase_control() const
{
if (phase_invert().size()) {
/* 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);
+}
+
+void
+Route::vca_assign (boost::shared_ptr<VCA> vca)
+{
+ _gain_control->add_master (vca);
+ vca->add_solo_mute_target (shared_from_this());
+}
+
+void
+Route::vca_unassign (boost::shared_ptr<VCA> vca)
+{
+ if (!vca) {
+ /* unassign from all */
+ _gain_control->clear_masters ();
+ /* XXXX need to remove from solo/mute target lists */
+ } else {
+ _gain_control->remove_master (vca);
+ vca->remove_solo_mute_target (shared_from_this());
+ }
+}