From 0a87941c706a03b43ccebc229bf1df3a7a362b46 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 27 Oct 2011 23:36:42 +0000 Subject: [PATCH] Minor cleanups to IO. git-svn-id: svn://localhost/ardour2/branches/3.0@10322 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/io.h | 15 ++++++------- libs/ardour/ardour/route.h | 2 ++ libs/ardour/io.cc | 23 +++++++------------- libs/ardour/route.cc | 43 +++++++------------------------------- 4 files changed, 24 insertions(+), 59 deletions(-) diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 5a54b903e5..e318258e19 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -170,12 +170,10 @@ class IO : public SessionObject, public Latent */ PBD::Signal1 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 PortCountChanged; // emitted when the number of ports changes + static PBD::Signal1 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; ///< a bundle representing our ports struct UserBundleInfo { - UserBundleInfo (IO*, boost::shared_ptr b); - boost::shared_ptr bundle; - PBD::ScopedConnection changed; + UserBundleInfo (IO*, boost::shared_ptr b); + boost::shared_ptr bundle; + PBD::ScopedConnection changed; }; std::vector _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&, const PortSet&); void bundle_changed (Bundle::Change); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 8dc3ea1b75..bdd535f39b 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -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, bool* via_send_only = 0); static uint32_t order_key_cnt; diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index ca34b7db61..7655f9d656 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -118,22 +118,15 @@ IO::silence (framecnt_t nframes) } } +/** 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_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. - */ -void -IO::check_bundles (std::vector& list, const PortSet& ports) { std::vector new_list; - for (std::vector::iterator i = list.begin(); i != list.end(); ++i) { + for (std::vector::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& 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& 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); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index a7fb05ec15..a897f5a813 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2673,7 +2673,7 @@ Route::clear_fed_by () } bool -Route::feeds (boost::shared_ptr other, bool* via_sends_only) +Route::sub_feeds (Fedby const & fed_by, boost::shared_ptr other, bool* via_sends_only) { const FedBy& fed_by (other->fed_by()); @@ -2694,42 +2694,15 @@ Route::feeds (boost::shared_ptr other, bool* via_sends_only) } bool -Route::direct_feeds (boost::shared_ptr other, bool* only_send) +Route::feeds (boost::shared_ptr other, bool* via_sends_only) { - DEBUG_TRACE (DEBUG::Graph, string_compose ("Feeds? %1\n", _name)); + return sub_feeds (other->fed_by (), other, via_sends_only); +} - 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 iop; - - if ((iop = boost::dynamic_pointer_cast(*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())); - } - - } - - DEBUG_TRACE (DEBUG::Graph, string_compose ("\tdoes NOT feed %1\n", other->name())); - return false; +bool +Route::direct_feeds (boost::shared_ptr 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 */