Minor cleanups to IO.
authorCarl Hetherington <carl@carlh.net>
Thu, 27 Oct 2011 23:36:42 +0000 (23:36 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 27 Oct 2011 23:36:42 +0000 (23:36 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10322 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/io.h
libs/ardour/ardour/route.h
libs/ardour/io.cc
libs/ardour/route.cc

index 5a54b903e5b7d31e265d080b821e7c880412ee24..e318258e1928ac661779b23ab71674a63b740d75 100644 (file)
@@ -170,12 +170,10 @@ class IO : public SessionObject, public Latent
         */
        PBD::Signal1<bool, ChanCount, BoolCombiner> PortCountChanging;
 
-       static int  disable_connecting (void);
-       static int  enable_connecting (void);
-       static int  disable_ports (void);
-       static int  enable_ports (void);
+       static int disable_connecting ();
+       static int enable_connecting ();
 
-       static PBD::Signal1<void,ChanCount> PortCountChanged; // emitted when the number of ports changes
+       static PBD::Signal1<void, ChanCount> PortCountChanged; // emitted when the number of ports changes
 
        static std::string name_from_state (const XMLNode&);
        static void set_name_in_state (XMLNode&, const std::string&);
@@ -216,9 +214,9 @@ class IO : public SessionObject, public Latent
        boost::shared_ptr<Bundle> _bundle; ///< a bundle representing our ports
 
        struct UserBundleInfo {
-           UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
-           boost::shared_ptr<UserBundle> bundle;
-           PBD::ScopedConnection changed;
+               UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
+               boost::shared_ptr<UserBundle> bundle;
+               PBD::ScopedConnection changed;
        };
 
        std::vector<UserBundleInfo*> _bundles_connected; ///< user bundles connected to our ports
@@ -229,7 +227,6 @@ class IO : public SessionObject, public Latent
        int ensure_ports (ChanCount, bool clear, void *src);
 
        void check_bundles_connected ();
-       void check_bundles (std::vector<UserBundleInfo*>&, const PortSet&);
 
        void bundle_changed (Bundle::Change);
 
index 8dc3ea1b75aa815f86e4820af9ce5568f313410c..bdd535f39bde40ae587fcb0b462bcf43662aaa02 100644 (file)
@@ -468,6 +468,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
        bool           _solo_safe;
        DataType       _default_type;
        FedBy          _fed_by;
+       FedBy          _direct_fed_by;
 
        virtual ChanCount input_streams () const;
 
@@ -499,6 +500,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
   private:
        int _set_state_2X (const XMLNode&, int);
        void set_processor_state_2X (XMLNodeList const &, int);
+       bool sub_feeds (FedBy const &, boost::shared_ptr<Route>, bool* via_send_only = 0);
 
        static uint32_t order_key_cnt;
 
index ca34b7db6191f91d7f9462a51cd0b80edfa6c933..7655f9d656a05543ad12e65d8c6ae94fd9e6daab 100644 (file)
@@ -118,22 +118,15 @@ IO::silence (framecnt_t nframes)
        }
 }
 
-void
-IO::check_bundles_connected ()
-{
-       check_bundles (_bundles_connected, ports());
-}
-
-/** Check the bundles in list to see which are connected to a given PortSet,
- *  and update list with those that are connected such that every port on every
- *  bundle channel x is connected to port x in ports.
+/** Set _bundles_connected to those bundles that are connected such that every
+ *  port on every bundle channel x is connected to port x in _ports.
  */
 void
-IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
+IO::check_bundles_connected ()
 {
        std::vector<UserBundleInfo*> new_list;
 
-       for (std::vector<UserBundleInfo*>::iterator i = list.begin(); i != list.end(); ++i) {
+       for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
 
                uint32_t const N = (*i)->bundle->nchannels().n_total();
 
@@ -147,7 +140,7 @@ IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
                        /* Every port on bundle channel j must be connected to our input j */
                        Bundle::PortList const pl = (*i)->bundle->channel_ports (j);
                        for (uint32_t k = 0; k < pl.size(); ++k) {
-                               if (ports.port(j)->connected_to (pl[k]) == false) {
+                               if (_ports.port(j)->connected_to (pl[k]) == false) {
                                        ok = false;
                                        break;
                                }
@@ -165,7 +158,7 @@ IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
                }
        }
 
-       list = new_list;
+       _bundles_connected = new_list;
 }
 
 
@@ -481,7 +474,7 @@ IO::ensure_io (ChanCount count, bool clear, void* src)
 }
 
 XMLNode&
-IO::get_state (void)
+IO::get_state ()
 {
        return state (true);
 }
@@ -1258,7 +1251,7 @@ IO::enable_connecting ()
 void
 IO::bundle_changed (Bundle::Change /*c*/)
 {
-       //XXX
+       /* XXX */
 //     connect_input_ports_to_bundle (_input_bundle, this);
 }
 
index a7fb05ec15340bc5b763777fc8c63730d5fd3817..a897f5a813c46af377e3138c618c4b8c002d1042 100644 (file)
@@ -2673,7 +2673,7 @@ Route::clear_fed_by ()
 }
 
 bool
-Route::feeds (boost::shared_ptr<Route> other, bool* via_sends_only)
+Route::sub_feeds (Fedby const & fed_by, boost::shared_ptr<Route> other, bool* via_sends_only)
 {
        const FedBy& fed_by (other->fed_by());
 
@@ -2694,42 +2694,15 @@ Route::feeds (boost::shared_ptr<Route> other, bool* via_sends_only)
 }
 
 bool
-Route::direct_feeds (boost::shared_ptr<Route> other, bool* only_send)
+Route::feeds (boost::shared_ptr<Route> other, bool* via_sends_only)
 {
-       DEBUG_TRACE (DEBUG::Graph, string_compose ("Feeds? %1\n", _name));
-
-       if (_output->connected_to (other->input())) {
-               DEBUG_TRACE (DEBUG::Graph, string_compose ("\tdirect FEEDS %2\n", other->name()));
-               if (only_send) {
-                       *only_send = false;
-               }
-
-               return true;
-       }
-
-
-       for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) {
-
-               boost::shared_ptr<IOProcessor> iop;
-
-               if ((iop = boost::dynamic_pointer_cast<IOProcessor>(*r)) != 0) {
-                       if (iop->feeds (other)) {
-                               DEBUG_TRACE (DEBUG::Graph,  string_compose ("\tIOP %1 does feed %2\n", iop->name(), other->name()));
-                               if (only_send) {
-                                       *only_send = true;
-                               }
-                               return true;
-                       } else {
-                               DEBUG_TRACE (DEBUG::Graph,  string_compose ("\tIOP %1 does NOT feed %2\n", iop->name(), other->name()));
-                       }
-               } else {
-                       DEBUG_TRACE (DEBUG::Graph,  string_compose ("\tPROC %1 is not an IOP\n", (*r)->name()));
-               }
-
-       }
+       return sub_feeds (other->fed_by (), other, via_sends_only);
+}
 
-       DEBUG_TRACE (DEBUG::Graph,  string_compose ("\tdoes NOT feed %1\n", other->name()));
-       return false;
+bool
+Route::direct_feeds (boost::shared_ptr<Route> other, bool* via_sends_only)
+{
+       return sub_feeds (other->direct_fed_by (), other, via_sends_only);
 }
 
 /** Called from the (non-realtime) butler thread when the transport is stopped */