diff options
author | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2016-07-15 01:43:14 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-07-14 21:55:49 -0400 |
commit | 8af589b322408aba38413dc2c85dc77ae1c9f2e4 (patch) | |
tree | a8b99e1462efe92f6a9c6b40ba9e9f59fb56436b | |
parent | bfc6b6a3ab737da3073d69284b7438bfa65a72ec (diff) |
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.
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 7 | ||||
-rw-r--r-- | libs/ardour/midi_track.cc | 7 | ||||
-rw-r--r-- | libs/ardour/route.cc | 27 | ||||
-rw-r--r-- | libs/ardour/track.cc | 7 |
5 files changed, 20 insertions, 30 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index bef1a54569..f415e9725c 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -588,6 +588,8 @@ public: pframes_t nframes, int declick, bool gain_automation_ok); + void flush_processor_buffers_locked (framecnt_t nframes); + virtual void bounce_process (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes, boost::shared_ptr<Processor> endpoint, bool include_endpoint, diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 8f83c19161..3a653a0efe 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -394,12 +394,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram process_output_buffers (bufs, start_frame, end_frame, nframes, declick, (!diskstream->record_enabled() && _session.transport_rolling())); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); need_butler = diskstream->commit (playback_distance); diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index c96254eeb2..b79a1cf52c 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -444,12 +444,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame process_output_buffers (bufs, start_frame, end_frame, nframes, declick, (!diskstream->record_enabled() && !_session.transport_stopped())); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); need_butler = diskstream->commit (playback_distance); 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<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*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<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*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<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); + return 0; } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 71eabc5b28..7b81397e04 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -466,12 +466,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, passthru (bufs, start_frame, end_frame, nframes, false); } - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i); - if (d) { - d->flush_buffers (nframes); - } - } + flush_processor_buffers_locked (nframes); return 0; } |