From a7a938275f0f7bd92d60d4ebbfd9a17e5004bd9b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 18 Jul 2020 22:59:43 +0200 Subject: [PATCH] Add API to query if an instrument was fanned out Since fan-out happens (interactively) in the GUI thread, we need to keep track of this, in order to prevent later auto-connection of the track to the master-bus. --- libs/ardour/ardour/route.h | 2 ++ libs/ardour/route.cc | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index bbf0fd2273..7f71e35156 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -511,6 +511,7 @@ public: */ boost::shared_ptr the_instrument() const; InstrumentInfo& instrument_info() { return _instrument_info; } + bool instrument_fanned_out () const { return _instrument_fanned_out;} /* "well-known" controls. @@ -661,6 +662,7 @@ protected: FedBy _fed_by; InstrumentInfo _instrument_info; + bool _instrument_fanned_out; Location* _loop_location; virtual ChanCount input_streams () const; diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index e6baf0f811..1822889b91 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -123,6 +123,7 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType , _recordable (true) , _have_internal_generator (false) , _default_type (default_type) + , _instrument_fanned_out (false) , _loop_location (NULL) , _track_number (0) , _strict_io (false) @@ -1158,6 +1159,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr && boost::dynamic_pointer_cast (the_instrument ()) == fanout) { /* This adds new tracks or busses, and changes connections. * This cannot be done here, and needs to be delegated to the GUI thread. */ + _instrument_fanned_out = true; FanOut (boost::dynamic_pointer_cast(shared_from_this())); /* EMIT SIGNAL */ } return 0; @@ -1698,6 +1700,9 @@ void Route::reset_instrument_info () { boost::shared_ptr instr = the_instrument(); + if (!instr) { + _instrument_fanned_out = false; + } _instrument_info.set_internal_instrument (instr); }