Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
param_contract.hpp File Reference

Parameter-contract equivalence check for DSP hot reload. More...

#include <pulp/state/parameter.hpp>
#include <pulp/state/store.hpp>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::format::reload::ParamSupersetResult
 Result of the SUPERSET contract check ("add params and stay live"): a candidate is a valid superset when every LIVE parameter is present in the candidate with an identical contract (existing automation / saved sessions stay valid), and the candidate may ALSO declare new parameters. More...

Namespaces

namespace  pulp
namespace  pulp::format
 What the product grants a device: the quota table indexed by capability tier and live thermal state.
namespace  pulp::format::reload

Functions

bool pulp::format::reload::param_contract_equal (const state::ParamInfo &a, const state::ParamInfo &b)
 True iff a and b describe the same normalization + interpretation contract for one parameter.
bool pulp::format::reload::has_unique_param_ids (const state::StateStore &store)
 True iff store registers each ParamID at most once.
std::vector< std::string > pulp::format::reload::param_contract_diff (const state::StateStore &live, const state::StateStore &candidate)
 Human-readable contract differences (diagnostics).
std::size_t pulp::format::reload::contract_param_count (const state::StateStore &store)
 Count parameters that are part of the swap contract (i.e.
bool pulp::format::reload::param_contracts_match (const state::StateStore &live, const state::StateStore &candidate)
 The gate: the candidate's parameter contract is equivalent to the live one (same set of IDs, same range/flags per ID).
ParamSupersetResult pulp::format::reload::param_contract_superset (const state::StateStore &live, const state::StateStore &candidate)
 Superset gate: relaxes param_contracts_match from "identical" to "candidate is a superset of live".
std::size_t pulp::format::reload::carry_state (const state::StateStore &live, state::StateStore &candidate)
 Copy each live parameter value into candidate for IDs the candidate also defines, so a hot-swap preserves the current sound.

Detailed Description

Parameter-contract equivalence check for DSP hot reload.

A reload builds the candidate logic's parameters into a scratch StateStore, separate from the live one. Before swapping, the candidate's parameter contract must be proven equivalent to the running plugin's: the host has automation lanes, saved sessions, and a generic editor all keyed to the live parameter IDs and their normalization ranges. If the candidate added, removed, re-ID'd, or re-ranged a parameter, a hot-swap would silently remap or clip automation — that case is a "requires full reload" boundary, not a hot-swap.

The contract compared is the automatable surface: the set of parameter IDs and, per ID, the normalization range (min/max/default/step/skew) plus the trigger flag (which changes how a value is interpreted). Display-only fields (name, unit) are intentionally NOT part of the contract — relabelling a knob is safe to hot-swap. When the contracts match, carry_state() copies the live values into the candidate so the swap is seamless.

Dependency-light by design, mirroring build_fingerprint.hpp.