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. | |
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.
| using pulp::format::ParamPort::Listener = std::function<void(state::ParamID id, float plain_value)> |
|
virtualdefault |
|
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.
|
pure virtual |
Open a gesture on id.
Implemented in pulp::format::StateStoreParamPort.
|
pure virtual |
Close a gesture this caller opened.
An end without a matching begin is ignored.
Implemented in pulp::format::StateStoreParamPort.
|
pure virtual |
The current plain value (the host's automation included). Any thread.
Implemented in pulp::format::StateStoreParamPort.
|
inline |
get(id) mapped to [0, 1] through the parameter's range (0 for an unknown id).
|
pure virtual |
One parameter's description, or null for an unknown id. Any thread.
Implemented in pulp::format::StateStoreParamPort.
|
pure virtual |
Every parameter, in declaration order.
Implemented in pulp::format::StateStoreParamPort.
|
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.
|
inline |
set(id, …) from a [0, 1] value through the parameter's range.
Does nothing for an unknown id.