Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::ParamPort Class Referenceabstract

Parameter access for an editor. More...

#include <editor_host.hpp>

Public Types

using Listener = std::function<void(state::ParamID id, float plain_value)>

Public Member Functions

virtual ~ParamPort ()=default
virtual std::span< const state::ParamInfo > params () const =0
 Every parameter, in declaration order.
virtual const state::ParamInfo * info (state::ParamID id) const =0
 One parameter's description, or null for an unknown id. Any thread.
virtual float get (state::ParamID id) const =0
 The current plain value (the host's automation included). Any thread.
virtual void begin (state::ParamID id)=0
 Open a gesture on id.
virtual void set (state::ParamID id, float plain_value)=0
 Write a plain value.
virtual void end (state::ParamID id)=0
 Close a gesture this caller opened.
virtual ParamSubscription add_listener (Listener listener)=0
 Be told about every change to any parameter, whoever made it (this editor, another editor, host automation, a state restore).
float get_normalized (state::ParamID id) const
 get(id) mapped to [0, 1] through the parameter's range (0 for an unknown id).
void set_normalized (state::ParamID id, float normalized)
 set(id, …) from a [0, 1] value through the parameter's range.

Detailed Description

Parameter access for an editor.

Values are in the parameter's plain domain (the ParamInfo::range units); get_normalized() and set_normalized() convert through that range.

Gestures: a continuous edit (a knob drag, a fader move) is begin(id) → set(id, v) one or more times → end(id), which the host records as one automation pass and one undo step. Every begin needs a matching end; a set outside an open gesture is a one-shot edit that the port brackets with its own begin and end. Several editors may hold the same parameter open at once: the host sees one begin when the first opens and one end when the last closes.

Edits made through a port are editor edits. They reach the host through the format adapter's existing gesture and value reporting (HostParameterEditBridge), so a port needs no host-specific code.

Member Typedef Documentation

◆ Listener

using pulp::format::ParamPort::Listener = std::function<void(state::ParamID id, float plain_value)>

Constructor & Destructor Documentation

◆ ~ParamPort()

virtual pulp::format::ParamPort::~ParamPort ( )
virtualdefault

Member Function Documentation

◆ add_listener()

virtual ParamSubscription pulp::format::ParamPort::add_listener ( Listener listener)
nodiscardpure virtual

Be told about every change to any parameter, whoever made it (this editor, another editor, host automation, a state restore).

Delivered on the main thread with the plain value; changes from the audio thread are coalesced to the latest value.

Implemented in pulp::format::StateStoreParamPort.

◆ begin()

virtual void pulp::format::ParamPort::begin ( state::ParamID id)
pure virtual

Open a gesture on id.

Implemented in pulp::format::StateStoreParamPort.

◆ end()

virtual void pulp::format::ParamPort::end ( state::ParamID id)
pure virtual

Close a gesture this caller opened.

An end without a matching begin is ignored.

Implemented in pulp::format::StateStoreParamPort.

◆ get()

virtual float pulp::format::ParamPort::get ( state::ParamID id) const
pure virtual

The current plain value (the host's automation included). Any thread.

Implemented in pulp::format::StateStoreParamPort.

◆ get_normalized()

float pulp::format::ParamPort::get_normalized ( state::ParamID id) const
inline

get(id) mapped to [0, 1] through the parameter's range (0 for an unknown id).

◆ info()

virtual const state::ParamInfo * pulp::format::ParamPort::info ( state::ParamID id) const
pure virtual

One parameter's description, or null for an unknown id. Any thread.

Implemented in pulp::format::StateStoreParamPort.

◆ params()

virtual std::span< const state::ParamInfo > pulp::format::ParamPort::params ( ) const
pure virtual

Every parameter, in declaration order.

Implemented in pulp::format::StateStoreParamPort.

◆ set()

virtual void pulp::format::ParamPort::set ( state::ParamID id,
float plain_value )
pure virtual

Write a plain value.

Inside a gesture this is one step of it; outside, a complete one-shot edit.

Implemented in pulp::format::StateStoreParamPort.

◆ set_normalized()

void pulp::format::ParamPort::set_normalized ( state::ParamID id,
float normalized )
inline

set(id, …) from a [0, 1] value through the parameter's range.

Does nothing for an unknown id.


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