Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::timeline_editor::UiPlayhead Struct Reference

One complete reading of where playback is. More...

#include <sequencer_ui_host.hpp>

Public Member Functions

constexpr bool moving () const noexcept
 Whether the position advances on its own.
constexpr bool operator== (const UiPlayhead &) const =default

Public Attributes

std::uint64_t program_generation = 0
 Identity of the compiled program this reading came from.
std::uint64_t sequence = 0
 Monotonic per publish.
std::uint64_t continuity_epoch = 0
 Identity of the continuous interval this reading's position belongs to.
timebase::TickPosition position {}
 Document position. This is the value a ruler and a playhead line draw.
timebase::LoopRegion loop {}
UiTransportState state = UiTransportState::Stopped
double tempo_bpm = 120.0

Detailed Description

One complete reading of where playback is.

Every field is a value. Holding a UiPlayhead across a program swap, a seek, or the destruction of the host's engine is defined: the reading goes stale, never invalid. program_generation is how a view tells stale from live without holding anything a swap can invalidate — it changes on every program adoption, so a view comparing two readings knows whether they describe the same compiled world.

continuity_epoch answers the other question a view has about two readings, and program_generation cannot answer it: whether the position moved continuously between them. A loop wrap, a seek, and a latched scrub anchor all break continuity without recompiling anything, so the generation is unchanged across exactly the discontinuities a drawn playhead must not smooth over.

Member Function Documentation

◆ moving()

bool pulp::timeline_editor::UiPlayhead::moving ( ) const
inlineconstexprnoexcept

Whether the position advances on its own.

True while scrubbing, because a scrub moves the playhead even though the musical transport is stopped.

◆ operator==()

bool pulp::timeline_editor::UiPlayhead::operator== ( const UiPlayhead & ) const
constexprdefault

Member Data Documentation

◆ continuity_epoch

std::uint64_t pulp::timeline_editor::UiPlayhead::continuity_epoch = 0

Identity of the continuous interval this reading's position belongs to.

A view must not interpolate position across a change in this value: the two readings name positions in different intervals, and a line drawn between them travels ground the playhead never covered — backwards through the whole timeline, on a loop wrap. Hold the newer reading's position outright instead, and resume interpolating from there.

◆ loop

timebase::LoopRegion pulp::timeline_editor::UiPlayhead::loop {}

◆ position

timebase::TickPosition pulp::timeline_editor::UiPlayhead::position {}

Document position. This is the value a ruler and a playhead line draw.

◆ program_generation

std::uint64_t pulp::timeline_editor::UiPlayhead::program_generation = 0

Identity of the compiled program this reading came from.

Monotonic; a change means the engine adopted a different program between readings.

◆ sequence

std::uint64_t pulp::timeline_editor::UiPlayhead::sequence = 0

Monotonic per publish.

Two readings with the same value are the same reading, which is how a view skips redundant repaints.

◆ state

UiTransportState pulp::timeline_editor::UiPlayhead::state = UiTransportState::Stopped

◆ tempo_bpm

double pulp::timeline_editor::UiPlayhead::tempo_bpm = 120.0

The documentation for this struct was generated from the following file: