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

The native (Pulp Processor::create_view()) backing for HostParamSurface, implemented over a StateStore. More...

#include <host_param_surface.hpp>

Public Types

using KeyResolver = std::function<std::optional<state::ParamID>(std::string_view key)>
 Resolve a design param_key to a registered ParamID, or nullopt if the store carries no such parameter.

Public Member Functions

 StateStoreHostParamSurface (state::StateStore &store, KeyResolver resolver={})
 StateStoreHostParamSurface (state::StateStore &store, runtime::AliveToken::Handle owner_alive, KeyResolver resolver={})
 Owner-lifetime-aware form used by format adapters.
bool has_param (std::string_view key)
 Live membership test — the single source of truth for "is this key bound right now".
double get_param (std::string_view key)
 Current normalized [0, 1] value of key.
void set_param (std::string_view key, double normalized)
 Write a normalized [0, 1] value.
void begin_gesture (std::string_view key)
void end_gesture (std::string_view key)
std::string param_display_text (std::string_view key, double normalized)
 Host-formatted display of a normalized value, e.g.
int param_step_count (std::string_view key)
 Number of distinct values the HOST's parameter exposes for key — the authoritative cardinality of a discrete/choice/toggle parameter.

Protected Member Functions

bool do_has_param (std::string_view key) override
double do_get_param (std::string_view key) override
void do_set_param (std::string_view key, double normalized) override
void do_begin_gesture (std::string_view key) override
void do_end_gesture (std::string_view key) override
std::string do_param_display_text (std::string_view key, double normalized) override
int do_param_step_count (std::string_view key) override
 Defaults to 0 ("continuous / no index domain") so a host surface implemented outside this repo keeps compiling and degrades to the pre-existing behavior rather than reporting a wrong cardinality.

Detailed Description

The native (Pulp Processor::create_view()) backing for HostParamSurface, implemented over a StateStore.

Keys are resolved to ParamIDs by a caller- supplied resolver; the default resolver matches ParamInfo::name == key, which is the convention the greenfield param generator (readDesignParams) already follows. Display text uses ParamInfo::to_string when set, otherwise a numeric+unit fallback so params that don't declare a formatter still read sensibly. Step count comes from the author-declared ParamKind/value_labels cardinality (state::param_value_count), so a range that merely quantizes via range.step stays continuous here — matching how format adapters expose it.

Member Typedef Documentation

◆ KeyResolver

using pulp::dataplane::StateStoreHostParamSurface::KeyResolver = std::function<std::optional<state::ParamID>(std::string_view key)>

Resolve a design param_key to a registered ParamID, or nullopt if the store carries no such parameter.

ParamID 0 is a valid id, so the optional (not a sentinel id) carries the "unknown" signal.

Constructor & Destructor Documentation

◆ StateStoreHostParamSurface() [1/2]

Parameters
storebacking store (must outlive this surface)
resolverkey→ParamID map; default matches ParamInfo::name == key

◆ StateStoreHostParamSurface() [2/2]

Owner-lifetime-aware form used by format adapters.

A host may retain an editor after destroying its plugin instance; once owner_alive retires every operation fails closed without touching the dangling store.

Member Function Documentation

◆ begin_gesture()

void pulp::dataplane::HostParamSurface::begin_gesture ( std::string_view key)
inlineinherited

◆ do_begin_gesture()

void pulp::dataplane::StateStoreHostParamSurface::do_begin_gesture ( std::string_view key)
overrideprotectedvirtual

◆ do_end_gesture()

void pulp::dataplane::StateStoreHostParamSurface::do_end_gesture ( std::string_view key)
overrideprotectedvirtual

◆ do_get_param()

double pulp::dataplane::StateStoreHostParamSurface::do_get_param ( std::string_view key)
overrideprotectedvirtual

◆ do_has_param()

bool pulp::dataplane::StateStoreHostParamSurface::do_has_param ( std::string_view key)
overrideprotectedvirtual

◆ do_param_display_text()

std::string pulp::dataplane::StateStoreHostParamSurface::do_param_display_text ( std::string_view key,
double normalized )
overrideprotectedvirtual

◆ do_param_step_count()

int pulp::dataplane::StateStoreHostParamSurface::do_param_step_count ( std::string_view key)
overrideprotectedvirtual

Defaults to 0 ("continuous / no index domain") so a host surface implemented outside this repo keeps compiling and degrades to the pre-existing behavior rather than reporting a wrong cardinality.

Reimplemented from pulp::dataplane::HostParamSurface.

◆ do_set_param()

void pulp::dataplane::StateStoreHostParamSurface::do_set_param ( std::string_view key,
double normalized )
overrideprotectedvirtual

◆ end_gesture()

void pulp::dataplane::HostParamSurface::end_gesture ( std::string_view key)
inlineinherited

◆ get_param()

double pulp::dataplane::HostParamSurface::get_param ( std::string_view key)
inlineinherited

Current normalized [0, 1] value of key.

Undefined (returns 0) if the key is unknown — gate with has_param() first.

◆ has_param()

bool pulp::dataplane::HostParamSurface::has_param ( std::string_view key)
inlineinherited

Live membership test — the single source of truth for "is this key bound right now".

Cheap; safe to call every tick for every keyed element.

◆ param_display_text()

std::string pulp::dataplane::HostParamSurface::param_display_text ( std::string_view key,
double normalized )
inlineinherited

Host-formatted display of a normalized value, e.g.

"500 ms". Backed by the host's own formatter (ParamInfo::to_string / getText / GetDisplay) with a default numeric+unit fallback when none is set. Memoize the result per (key, normalized) pair — the host formatter may be arbitrary plugin code.

◆ param_step_count()

int pulp::dataplane::HostParamSurface::param_step_count ( std::string_view key)
inlineinherited

Number of distinct values the HOST's parameter exposes for key — the authoritative cardinality of a discrete/choice/toggle parameter.

Returns 0 for a continuous parameter and for an unknown key. 0 is deliberately unambiguous: it means "this parameter has no index domain", so a caller must never treat it as a denominator and must never divide by it. Use param_index_to_normalized(), which encodes that guard.

This counts VALUES, not intervals — a 6-way waveform selector returns 6, a toggle returns 2. It matches ParamKind/value_labels cardinality (state::param_value_count), which is what the AU and AAX adapters advertise directly. It is NOT VST3's stepCount field, which counts intervals and is therefore this value minus one; the VST3 adapter applies that -1 at its own boundary. "Step count" is overloaded across plug-in APIs — this accessor is values, always.

The count comes from the PARAMETER, never from a view's option list. A control that renders 3 visible positions may be bound to a 6-value parameter; the divisor is this count, not the number of things drawn. A view whose option count disagrees with this is mis-scaled — that mismatch is worth asserting on loudly rather than silently emitting wrong normalized values.

◆ set_param()

void pulp::dataplane::HostParamSurface::set_param ( std::string_view key,
double normalized )
inlineinherited

Write a normalized [0, 1] value.

Bracket a continuous drag with begin_gesture / end_gesture so the host can group one undo step.


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