From d33cc4a3dd7385e80075d596aff7c2b4afd2ca9d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 12 Jun 2020 05:02:06 +0200 Subject: [PATCH] Document transport state semantics This also adds transport_state_rolling() which can be used from a TransportStateChanged callback. --- libs/ardour/ardour/session.h | 10 ++++++++++ libs/ardour/session_transport.cc | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 81a5bf02f0..ae88437230 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -790,8 +790,18 @@ public: return 0; } double transport_speed() const { return _count_in_samples > 0 ? 0. : _transport_speed; } + /** @return true if the transport state (TFSM) is stopped */ bool transport_stopped() const; + /** @return true if the transport state (TFSM) is stopped or stopping */ bool transport_stopped_or_stopping() const; + /** @return true if the transport state (TFSM) is rolling. + * Note: the transport may not yet move if pre-roll or count-in in ongoing. + */ + bool transport_state_rolling() const; + /** @return true if the the transport is actively (audible) rolling. + * playback speed is not zero, and count-in as well as latency-preroll is complete, + * and _transport_sample changes every process cycle. + */ bool transport_rolling() const; bool transport_will_roll_forwards() const; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 92ab447179..5e8a0cb0a2 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1999,6 +1999,12 @@ Session::transport_stopped_or_stopping() const return _transport_fsm->stopped() || _transport_fsm->stopping(); } +bool +Session::transport_state_rolling() const +{ + return _transport_fsm->rolling(); +} + bool Session::transport_rolling() const {