Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::FrameClock Class Reference

#include <frame_clock.hpp>

Public Member Functions

void tick (float dt)
 Advance the clock by dt seconds. Called once per frame by the host.
float time () const
 Current elapsed time (seconds since first tick).
float dt () const
 Delta since last tick.
uint64_t frame () const
 Monotonic frame counter.
int subscribe (std::function< bool(float dt)> callback)
 Subscribe to frame ticks.
void unsubscribe (int id)
 Remove a subscription by ID.
bool has_active_subscribers () const
 True if any subscribers are still active (drives repaint/invalidation).
int subscribe_activity (std::function< void(float dt)> callback)
 Subscribe an activity probe.
void unsubscribe_activity (int id)
 Remove an activity subscription by id.
bool has_activity_subscribers () const
 True if any activity probe is registered.
void pump_activity (float dt)
 Fire every activity probe with dt.
void reset ()
 Reset all state (for testing).
std::weak_ptr< const void > liveness_token () const
 Liveness token for holders that keep a raw FrameClock*.

Member Function Documentation

◆ dt()

float pulp::view::FrameClock::dt ( ) const
inline

Delta since last tick.

◆ frame()

uint64_t pulp::view::FrameClock::frame ( ) const
inline

Monotonic frame counter.

◆ has_active_subscribers()

bool pulp::view::FrameClock::has_active_subscribers ( ) const

True if any subscribers are still active (drives repaint/invalidation).

◆ has_activity_subscribers()

bool pulp::view::FrameClock::has_activity_subscribers ( ) const

True if any activity probe is registered.

Deliberately does NOT feed the repaint decision — an activity-only view idles at 0 fps.

◆ liveness_token()

std::weak_ptr< const void > pulp::view::FrameClock::liveness_token ( ) const
inline

Liveness token for holders that keep a raw FrameClock*.

The token expires when the clock is destroyed, so a long-lived observer (the process-wide motion coordinator, for instance) can tell a live clock from a stale pointer to one that has already gone out of scope.

◆ pump_activity()

void pulp::view::FrameClock::pump_activity ( float dt)

Fire every activity probe with dt.

Call once per host tick, on the UI thread, BEFORE the host's repaint decision. Never advances the render clock (time/dt/frame) and never fires render subscribers — an idle frame calls this but skips tick().

◆ reset()

void pulp::view::FrameClock::reset ( )

Reset all state (for testing).

◆ subscribe()

int pulp::view::FrameClock::subscribe ( std::function< bool(float dt)> callback)

Subscribe to frame ticks.

Callback receives dt. Return false from callback to unsubscribe automatically.

◆ subscribe_activity()

int pulp::view::FrameClock::subscribe_activity ( std::function< void(float dt)> callback)

Subscribe an activity probe.

Fired by pump_activity, on the UI thread. Activity probes do NOT auto-unsubscribe (no bool return); remove with unsubscribe_activity. Returns an id unique across both channels.

◆ tick()

void pulp::view::FrameClock::tick ( float dt)

Advance the clock by dt seconds. Called once per frame by the host.

◆ time()

float pulp::view::FrameClock::time ( ) const
inline

Current elapsed time (seconds since first tick).

◆ unsubscribe()

void pulp::view::FrameClock::unsubscribe ( int id)

Remove a subscription by ID.

◆ unsubscribe_activity()

void pulp::view::FrameClock::unsubscribe_activity ( int id)

Remove an activity subscription by id.


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