Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
state_inspector.hpp
Go to the documentation of this file.
1// state_inspector.hpp — Parameter state monitoring and editing for the inspector
2#pragma once
3
9
10#include <chrono>
11#include <mutex>
12#include <span>
13#include <string>
14#include <vector>
15
16namespace pulp::inspect {
17
18using namespace pulp::state;
19
26public:
28
32 StateStore& store() const noexcept { return store_; }
33
38 void set_value_channels(std::span<const view::ValueChannelInfo> channels) {
39 value_channels_.assign(channels.begin(), channels.end());
40 }
41 std::span<const view::ValueChannelInfo> value_channels() const noexcept {
42 return value_channels_;
43 }
45
48
52 std::string name;
53 std::string unit;
54 float value;
56 float modulated;
58 float min, max, step;
59 std::string display_value; // from to_string, if available
60 };
61
63 struct ParamChange {
65 float value;
66 std::chrono::steady_clock::time_point time;
67 };
68
70 std::vector<ParamSnapshot> all_params() const;
71
73 std::vector<ParamChange> recent_changes() const;
74
85 bool set_param(ParamID id, float value, bool normalized = false);
86
87private:
88 StateStore& store_;
89 std::vector<view::ValueChannelInfo> value_channels_;
90 mutable std::mutex changes_mutex_;
91 std::vector<ParamChange> changes_;
92 ListenerToken listener_token_;
93 static constexpr size_t kMaxChanges = 100;
94};
95
96} // namespace pulp::inspect
A processor's declared channels.
Definition value_channel_set.hpp:61
std::vector< ParamChange > recent_changes() const
Get recent parameter changes (ring buffer, last 100).
bool set_param(ParamID id, float value, bool normalized=false)
Set a parameter value (for live editing from inspector / agents).
StateInspector(const StateInspector &)=delete
void set_value_channels(view::ValueChannelSet *channels)
Snapshot the hosting processor's declared value-channel metadata.
void set_value_channels(std::span< const view::ValueChannelInfo > channels)
Definition state_inspector.hpp:38
StateStore & store() const noexcept
The store this inspector observes.
Definition state_inspector.hpp:32
std::span< const view::ValueChannelInfo > value_channels() const noexcept
Definition state_inspector.hpp:41
StateInspector & operator=(const StateInspector &)=delete
StateInspector(StateStore &store)
std::vector< ParamSnapshot > all_params() const
Get snapshots of all parameters.
RAII handle for a registered parameter-change listener.
Definition listener_token.hpp:47
Centralized parameter storage with lock-free value access.
Definition store.hpp:164
Forward declarations for the editor data plane, plus their pulp::view spellings.
Definition agent_context.hpp:7
uint32_t ParamID
Unique parameter identifier, stable across plugin versions.
Definition parameter.hpp:55
@ value
the widget's primary value (Knob, Fader, RangeSlider, Toggle, ProgressBar)
Definition binding_diagnostics.hpp:19
Recent change entry.
Definition state_inspector.hpp:63
float value
Definition state_inspector.hpp:65
std::chrono::steady_clock::time_point time
Definition state_inspector.hpp:66
ParamID id
Definition state_inspector.hpp:64
Parameter snapshot for display.
Definition state_inspector.hpp:50
float default_value
Definition state_inspector.hpp:57
std::string display_value
Definition state_inspector.hpp:59
float modulated
Definition state_inspector.hpp:56
float value
Definition state_inspector.hpp:54
float min
Definition state_inspector.hpp:58
std::string unit
Definition state_inspector.hpp:53
ParamID id
Definition state_inspector.hpp:51
float normalized
Definition state_inspector.hpp:55
float step
Definition state_inspector.hpp:58
float max
Definition state_inspector.hpp:58
std::string name
Definition state_inspector.hpp:52
Source-compatible spelling of <pulp/dataplane/value_channel_telemetry.hpp>.