X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Finternal_return.cc;h=a162628853afd323afa70f39b1ad31af89989ed7;hb=96b4a85fed3a7d6aafa2957d7fa359c5dfd08cc0;hp=19f677f368d662c1b2165f33e4d792fdbc724239;hpb=bbf028880f0fbcfea332f62ca2248da2335e37e5;p=ardour.git diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 19f677f368..a162628853 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -16,16 +16,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include -#include "pbd/failed_constructor.h" - -#include "ardour/audio_buffer.h" #include "ardour/internal_return.h" -#include "ardour/mute_master.h" -#include "ardour/session.h" #include "ardour/internal_send.h" -#include "ardour/audioengine.h" +#include "ardour/route.h" using namespace std; using namespace ARDOUR; @@ -37,17 +32,19 @@ InternalReturn::InternalReturn (Session& s) } void -InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool) +InternalReturn::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool) { if (!_active && !_pending_active) { return; } - /* _sends is only modified with the process lock held, so this is ok, I think */ + Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK); - for (list::iterator i = _sends.begin(); i != _sends.end(); ++i) { - if ((*i)->active ()) { - bufs.merge_from ((*i)->get_buffers(), nframes); + if (lm.locked ()) { + for (list::iterator i = _sends.begin(); i != _sends.end(); ++i) { + if ((*i)->active () && (!(*i)->source_route() || (*i)->source_route()->active())) { + bufs.merge_from ((*i)->get_buffers(), nframes); + } } } @@ -57,34 +54,39 @@ InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*e void InternalReturn::add_send (InternalSend* send) { - Glib::Mutex::Lock lm (_session.engine().process_lock()); + Glib::Threads::Mutex::Lock lm (_sends_mutex); _sends.push_back (send); } void InternalReturn::remove_send (InternalSend* send) { - Glib::Mutex::Lock lm (_session.engine().process_lock()); + Glib::Threads::Mutex::Lock lm (_sends_mutex); _sends.remove (send); } -XMLNode& -InternalReturn::state (bool full) +void +InternalReturn::set_playback_offset (samplecnt_t cnt) { - XMLNode& node (Return::state (full)); - /* override type */ - node.add_property("type", "intreturn"); - return node; + Processor::set_playback_offset (cnt); + + Glib::Threads::Mutex::Lock lm (_sends_mutex); // TODO reader lock + for (list::iterator i = _sends.begin(); i != _sends.end(); ++i) { + (*i)->set_delay_out (cnt); + } } XMLNode& -InternalReturn::get_state() +InternalReturn::state () { - return state (true); + XMLNode& node (Return::state ()); + /* override type */ + node.set_property("type", "intreturn"); + return node; } bool -InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out) const +InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out) { out = in; return true;