Fix copy+paste error for mb32c filter freq.
[ardour.git] / libs / ardour / route.cc
index ec54f83a9a28a7e26d96acac2ff5ca8d2035f1c1..41d85bcda5a9161b32958a3ecd2708e9309adb03 100644 (file)
@@ -89,7 +89,6 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType
        : Stripable (sess, name, PresentationInfo (flag))
        , GraphNode (sess._process_graph)
        , Muteable (sess, name)
-       , Automatable (sess)
        , _active (true)
        , _signal_latency (0)
        , _signal_latency_at_amp_position (0)
@@ -121,7 +120,7 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType
 
 boost::weak_ptr<Route>
 Route::weakroute () {
-       return boost::weak_ptr<Route> (shared_from_this ());
+       return boost::weak_ptr<Route> (boost::dynamic_pointer_cast<Route> (shared_from_this ()));
 }
 
 int
@@ -970,7 +969,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
                flags &= mask;
 
                if (flags != None) {
-                       boost::optional<int> rv = PluginSetup (shared_from_this (), pi, flags);  /* EMIT SIGNAL */
+                       boost::optional<int> rv = PluginSetup (boost::dynamic_pointer_cast<Route>(shared_from_this ()), pi, flags);  /* EMIT SIGNAL */
                        int mode = rv.get_value_or (0);
                        switch (mode & 3) {
                                case 1:
@@ -3283,13 +3282,13 @@ Route::direct_feeds_according_to_reality (boost::shared_ptr<Route> other, bool*
 bool
 Route::direct_feeds_according_to_graph (boost::shared_ptr<Route> other, bool* via_send_only)
 {
-       return _session._current_route_graph.has (shared_from_this (), other, via_send_only);
+       return _session._current_route_graph.has (boost::dynamic_pointer_cast<Route> (shared_from_this ()), other, via_send_only);
 }
 
 bool
 Route::feeds_according_to_graph (boost::shared_ptr<Route> other)
 {
-       return _session._current_route_graph.feeds (shared_from_this (), other);
+       return _session._current_route_graph.feeds (boost::dynamic_pointer_cast<Route> (shared_from_this ()), other);
 }
 
 /** Called from the (non-realtime) butler thread when the transport is stopped */
@@ -3338,7 +3337,7 @@ Route::input_change_handler (IOChange change, void * /*src*/)
                                        continue;
                                }
                                bool sends_only;
-                               bool does_feed = (*i)->direct_feeds_according_to_reality (shared_from_this(), &sends_only);
+                               bool does_feed = (*i)->direct_feeds_according_to_reality (boost::dynamic_pointer_cast<Route> (shared_from_this()), &sends_only);
                                if (does_feed && !sends_only) {
                                        if ((*i)->soloed()) {
                                                ++sbou;
@@ -3452,7 +3451,7 @@ Route::output_change_handler (IOChange change, void * /*src*/)
                                _solo_control->mod_solo_by_others_downstream (delta);
                                // Session::route_solo_changed() does not propagate indirect solo-changes
                                // propagate upstream to tracks
-                               boost::shared_ptr<Route> shared_this = shared_from_this();
+                               boost::shared_ptr<Route> shared_this = boost::dynamic_pointer_cast<Route> (shared_from_this());
                                for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
                                        if ((*i).get() == this || !can_solo()) {
                                                continue;
@@ -4969,7 +4968,7 @@ Route::eq_band_cnt () const
                if (is_master() || mixbus()) {
                        return 3;
                } else {
-                       return 4;
+                       return 6;
                }
 #else
                return 3;
@@ -5002,10 +5001,10 @@ Route::eq_gain_controllable (uint32_t band) const
        } else {
 #ifdef MIXBUS32C
                switch (band) {
-                       case 0: port_number = 14; break;
-                       case 1: port_number = 12; break;
-                       case 2: port_number = 10; break;
-                       case 3: port_number =  8; break;
+                       case 2: port_number = 14; break;
+                       case 3: port_number = 12; break;
+                       case 4: port_number = 10; break;
+                       case 5: port_number =  8; break;
                        default:
                                return boost::shared_ptr<AutomationControl>();
                }
@@ -5043,10 +5042,12 @@ Route::eq_freq_controllable (uint32_t band) const
        uint32_t port_number;
 #ifdef MIXBUS32C
        switch (band) {
-               case 0: port_number = 13; break;
-               case 1: port_number = 11; break;
-               case 2: port_number = 9; break;
-               case 3: port_number = 7; break;
+               case 0: port_number = 5; break; // HPF
+               case 1: port_number = 6; break; // LPF
+               case 2: port_number = 13; break; // lo
+               case 3: port_number = 11; break; // lo mid
+               case 4: port_number = 9; break; // hi mid
+               case 5: port_number = 7; break; // hi
                default:
                        return boost::shared_ptr<AutomationControl>();
        }
@@ -5104,7 +5105,7 @@ Route::eq_hpf_controllable () const
                return boost::shared_ptr<AutomationControl>();
        }
 #ifdef MIXBUS32C
-       return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 3)));
+       return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 5)));
 #else
        return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2)));
 #endif
@@ -5114,6 +5115,38 @@ Route::eq_hpf_controllable () const
 #endif
 }
 
+boost::shared_ptr<AutomationControl>
+Route::eq_lpf_controllable () const
+{
+#ifdef MIXBUS32C
+       boost::shared_ptr<PluginInsert> eq = ch_eq();
+
+       if (is_master() || mixbus() || !eq) {
+               return boost::shared_ptr<AutomationControl>();
+       }
+
+       return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 4)));
+#else
+       return boost::shared_ptr<AutomationControl>();
+#endif
+}
+
+boost::shared_ptr<AutomationControl>
+Route::filter_enable_controllable () const
+{
+#ifdef MIXBUS32C
+       boost::shared_ptr<PluginInsert> eq = ch_eq();
+
+       if (is_master() || mixbus() || !eq) {
+               return boost::shared_ptr<AutomationControl>();
+       }
+
+       return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2)));
+#else
+       return boost::shared_ptr<AutomationControl>();
+#endif
+}
+
 string
 Route::eq_band_name (uint32_t band) const
 {
@@ -5133,10 +5166,12 @@ Route::eq_band_name (uint32_t band) const
 #ifdef MIXBUS32C
        } else {
                switch (band) {
-                       case 0: return _("lo");
-                       case 1: return _("lo mid");
-                       case 2: return _("hi mid");
-                       case 3: return _("hi");
+                       case 0: return _("HPF");
+                       case 1: return _("LPF");
+                       case 2: return _("lo");
+                       case 3: return _("lo mid");
+                       case 4: return _("hi mid");
+                       case 5: return _("hi");
                        default: return string();
                }
        }
@@ -5451,3 +5486,23 @@ Route::clear_all_solo_state ()
 {
        _solo_control->clear_all_solo_state ();
 }
+
+boost::shared_ptr<AutomationControl>
+Route::automation_control_recurse (PBD::ID const & id) const
+{
+       boost::shared_ptr<AutomationControl> ac = Automatable::automation_control (id);
+
+       if (ac) {
+               return ac;
+       }
+
+       Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+
+       for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
+               if ((ac = (*i)->automation_control (id))) {
+                       return ac;
+               }
+       }
+
+       return boost::shared_ptr<AutomationControl> ();
+}