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

Binds a MeterSource channel and caches the latest frame for paint. More...

#include <value_source_binding.hpp>

Public Member Functions

 MeterSourceBinding (View &owner)
void set_source (std::shared_ptr< MeterSource > source, int channel)
 Bind a source (or nullptr to unbind, which drops the subscription so the view stops holding the editor's frames alive once nothing feeds it).
void set_active (bool active)
 Owner-level gate, ANDed with having a source: false parks the binding (unsubscribed, reading zero) without forgetting the source.
bool active () const
void refresh ()
 Re-evaluate the subscription against the owner's reachable clock.
void stop ()
const MeterFrame & frame () const
 The most recent frame snapshotted on the clock.
bool has_source () const
int channel () const
bool subscribed () const
FrameClock * subscribed_clock () const

Detailed Description

Binds a MeterSource channel and caches the latest frame for paint.

Lifetime: the bound FrameClock must outlive the binding, OR the host must clear it (root->set_frame_clock(nullptr)) / detach the view before destroying the clock — both drop the subscription first, for every binding on the detached subtree. Pulp's GPU hosts clear the root clock during teardown, so this holds for them; a custom host that owns a clock must observe the same order.

Constructor & Destructor Documentation

◆ MeterSourceBinding()

pulp::view::MeterSourceBinding::MeterSourceBinding ( View & owner)
inlineexplicit

Member Function Documentation

◆ active()

bool pulp::view::MeterSourceBinding::active ( ) const
inline

◆ channel()

int pulp::view::MeterSourceBinding::channel ( ) const
inline

◆ frame()

const MeterFrame & pulp::view::MeterSourceBinding::frame ( ) const
inline

The most recent frame snapshotted on the clock.

Paint-safe: a plain member read, no lock and no allocation. Zeroed until the first frame.

◆ has_source()

bool pulp::view::MeterSourceBinding::has_source ( ) const
inline

◆ refresh()

void pulp::view::MeterSourceBinding::refresh ( )
inline

Re-evaluate the subscription against the owner's reachable clock.

◆ set_active()

void pulp::view::MeterSourceBinding::set_active ( bool active)

Owner-level gate, ANDed with having a source: false parks the binding (unsubscribed, reading zero) without forgetting the source.

For an owner whose bindings outlive the thing they feed — a DesignFrameView element binding whose param_key the active frame does not declare.

◆ set_source()

void pulp::view::MeterSourceBinding::set_source ( std::shared_ptr< MeterSource > source,
int channel )

Bind a source (or nullptr to unbind, which drops the subscription so the view stops holding the editor's frames alive once nothing feeds it).

Either way the cached frame is dropped: it belongs to the OLD source, and painting it on would show a reading no source is producing.

◆ stop()

void pulp::view::MeterSourceBinding::stop ( )
inline

◆ subscribed()

bool pulp::view::MeterSourceBinding::subscribed ( ) const
inline

◆ subscribed_clock()

FrameClock * pulp::view::MeterSourceBinding::subscribed_clock ( ) const
inline

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