summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-31 12:59:44 +0200
committerRobin Gareus <robin@gareus.org>2017-03-31 14:01:50 +0200
commitf2c0b0ee3f4648d6306095a0232a2a1e499ea04f (patch)
tree8ad5624ef5a0cfe80d81fd3231ac005649cd8767 /libs/ardour/session.cc
parent9436d0cb867e4a923cb5a8bc459fe62cb4d3a70e (diff)
Add an API to query if the audible frame is latent pending a locate
eg. at the end of a loop, the session may already be playing the beginning of the loop. The TransportLooped signal was emitted. Yet due to playback latency, the audible frame is still at the end of the loop. To interpolate the playhead position the UI needs to be able to know: Relying on the TransportLooped signal is not sufficient because it does not take playback latency into account.
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 2c3e1d2ef2..f55e95486e 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2067,12 +2067,15 @@ Session::maybe_enable_record (bool rt_context)
}
framepos_t
-Session::audible_frame () const
+Session::audible_frame (bool* latent_locate) const
{
framepos_t ret;
frameoffset_t offset = worst_playback_latency (); // - _engine.samples_since_cycle_start ();
offset *= transport_speed ();
+ if (latent_locate) {
+ *latent_locate = false;
+ }
if (synced_to_engine()) {
/* Note: this is basically just sync-to-JACK */
@@ -2097,14 +2100,24 @@ Session::audible_frame () const
if (!play_loop || !have_looped) {
if (ret < _last_roll_or_reversal_location) {
+ if (latent_locate) {
+ *latent_locate = true;
+ }
return _last_roll_or_reversal_location;
}
} else {
- // latent loops
+ /* the play-position wrapped at the loop-point
+ * ardour is already playing the beginning of the loop,
+ * but due to playback latency, the "audible frame"
+ * is still at the end of the loop.
+ */
Location *location = _locations->auto_loop_location();
frameoffset_t lo = location->start() - ret;
if (lo > 0) {
ret = location->end () - lo;
+ if (latent_locate) {
+ *latent_locate = true;
+ }
}
}