diff options
author | Robin Gareus <robin@gareus.org> | 2017-09-28 06:31:12 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-09-29 05:03:48 +0200 |
commit | 8139becb1898187729b0ea57f145302d4975bf3a (patch) | |
tree | 79638d87c587765784fe56eeb530ff792442e0c5 /libs/ardour/ardour/session.h | |
parent | 8ff3b5ecf6bd2b7d69b8f154ba8d21eb4fe86304 (diff) |
Ongoing work on latency compensation
The general goal is to align transport-sample to be the audible frame
and use that as "anchor" for all processing.
transport_sample cannot become negative (00:00:00:00 is the first audible
frame).
Internally transport pre-rolls (read-ahead) before the transport starts
to move. This allows inputs and disk to prefill the pipeline.
When starting to roll, the session counts down a global "remaning preroll"
counter, which is the worst-latency from in-to-out.
Each route in turn will start processing at its own output-latency.
Route::process_output_buffers() - which does the actual processing
incl disk i/o - begins by offsetting the "current sample" by the
route's process-latency and decrements the offset for each latent
processor. At the end of the function the output will be aligned
and match transport-sample - downstream-playback-latency (if any).
PS. This commit is a first step only: transport looping & vari-speed have
not yet been implemented/updated.
Diffstat (limited to 'libs/ardour/ardour/session.h')
-rw-r--r-- | libs/ardour/ardour/session.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 69c823720c..e04e99de88 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -478,7 +478,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop samplecnt_t worst_input_latency () const { return _worst_input_latency; } samplecnt_t worst_track_latency () const { return _worst_track_latency; } samplecnt_t worst_track_out_latency () const { return _worst_track_out_latency; } - samplecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; } + samplecnt_t worst_playback_latency () const { return std::max (_worst_output_latency, _worst_track_latency); } + samplecnt_t worst_latency_preroll () const; struct SaveAs { std::string new_parent_folder; /* parent folder where new session folder will be created */ @@ -684,6 +685,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop samplepos_t requested_return_sample() const { return _requested_return_sample; } void set_requested_return_sample(samplepos_t return_to); + samplecnt_t remaining_latency_preroll () const { return _remaining_latency_preroll; } + enum PullupFormat { pullup_Plus4Plus1, pullup_Plus4, @@ -721,7 +724,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop double transport_speed() const { return _count_in_samples > 0 ? 0. : _transport_speed; } bool transport_stopped() const { return _transport_speed == 0.0; } - bool transport_rolling() const { return _transport_speed != 0.0 && _count_in_samples == 0; } + bool transport_rolling() const { return _transport_speed != 0.0 && _count_in_samples == 0 && _remaining_latency_preroll == 0; } bool silent () { return _silent; } @@ -1248,6 +1251,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool _session_range_end_is_free; Slave* _slave; bool _silent; + samplecnt_t _remaining_latency_preroll; // varispeed playback double _transport_speed; |