From 8af589b322408aba38413dc2c85dc77ae1c9f2e4 Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Fri, 15 Jul 2016 01:43:14 +0200 Subject: Consolidate delivery buffer flushing of all route types Route::no_roll(), Route::roll(), Track::no_roll(), AudioTrack::roll() and MidiTrack::roll() all had the exact same loop for flushing buffers of their Delivery processors. That was a lot of replicated code that had to be kept synchronised by hand. Put that code into a protected method Route::flush_processor_buffers_locked() which is called instead. --- libs/ardour/route.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'libs/ardour/route.cc') diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 01580456e4..cd670df02e 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -3391,6 +3391,17 @@ Route::pans_required () const return max (n_inputs ().n_audio(), processor_max_streams.n_audio()); } +void +Route::flush_processor_buffers_locked (framecnt_t nframes) +{ + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr d = boost::dynamic_pointer_cast (*i); + if (d) { + d->flush_buffers (nframes); + } + } +} + int Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing) { @@ -3436,12 +3447,8 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, _trim->apply_gain_automation (false); passthru (bufs, start_frame, end_frame, nframes, 0); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr d = boost::dynamic_pointer_cast (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); + return 0; } @@ -3480,12 +3487,8 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in passthru (bufs, start_frame, end_frame, nframes, declick); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr d = boost::dynamic_pointer_cast (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); + return 0; } -- cgit v1.2.3