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

Pre-resolved audio-thread read handle for one parameter's base value. More...

#include <store.hpp>

Public Member Functions

 ParamReader ()=default
float get () const noexcept
 Current base value (lock-free, relaxed ordering), or 0.0f if unbound.
bool valid () const noexcept
 True if this handle refers to a registered parameter.

Friends

class StateStore

Detailed Description

Pre-resolved audio-thread read handle for one parameter's base value.

StateStore::get_value() looks the ID up in a hash map on every call. A processor that reads the same parameters every block can resolve them once — typically in prepare() — and read through the handle instead: get() is an inline relaxed atomic load with no lookup and no call.

The handle stays valid while the store it came from exists, even if more parameters are registered afterwards (it holds the store and an index, not a pointer to the value). Registration must still not run concurrently with get() — the same rule as for get_value() — and the handle dangles once its StateStore is destroyed. A default-constructed handle, or one resolved from an unknown ID, reads 0.0f — the same result as get_value() for an unknown ID.

void prepare(const PrepareContext&) override {
gain_ = state().param_reader(kGain);
}
void process(...) override {
const float gain = gain_.get();
...
}
SequencerStateChannel is the audio-safe transport for a plugin's structured NON-parameter state: the ...
Definition audio_device_manager.hpp:48

Constructor & Destructor Documentation

◆ ParamReader()

pulp::state::ParamReader::ParamReader ( )
default

Member Function Documentation

◆ get()

float pulp::state::ParamReader::get ( ) const
inlinenoexcept

Current base value (lock-free, relaxed ordering), or 0.0f if unbound.

This is the value get_value() returns; it does not include the per-buffer modulation offset that get_modulated() adds.

◆ valid()

bool pulp::state::ParamReader::valid ( ) const
inlinenoexcept

True if this handle refers to a registered parameter.

◆ StateStore

friend class StateStore
friend

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/state/include/pulp/state/store.hpp