47 assert_call_context(
"has_param");
54 assert_call_context(
"get_param");
60 void set_param(std::string_view key,
double normalized) {
61 assert_call_context(
"set_param");
66 assert_call_context(
"begin_gesture");
71 assert_call_context(
"end_gesture");
81 assert_call_context(
"param_display_text");
108 assert_call_context(
"param_step_count");
115 virtual void do_set_param(std::string_view key,
double normalized) = 0;
131 static void assert_call_context(
const char* op);
158 const int clamped = index < 0 ? 0 : (index > step_count - 1 ? step_count - 1 : index);
159 return static_cast<double>(clamped) /
static_cast<double>(step_count - 1);
169 const double clamped = normalized < 0.0 ? 0.0 : (normalized > 1.0 ? 1.0 : normalized);
170 return static_cast<int>(std::lround(clamped *
static_cast<double>(step_count - 1)));
185 assert_call_context(
"send_host_action");
193 static void assert_call_context(
const char* op);
A framework-agnostic host command channel.
Definition host_surfaces.hpp:180
bool send_host_action(std::string_view action, std::string_view args_json)
Definition host_surfaces.hpp:184
virtual ~HostActionSurface()=default
virtual bool do_send_host_action(std::string_view action, std::string_view args_json)=0
A framework-agnostic, native-view-facing runtime parameter accessor.
Definition host_surfaces.hpp:40
std::string param_display_text(std::string_view key, double normalized)
Host-formatted display of a normalized value, e.g.
Definition host_surfaces.hpp:80
virtual void do_end_gesture(std::string_view key)=0
virtual bool do_has_param(std::string_view key)=0
virtual double do_get_param(std::string_view key)=0
virtual void do_set_param(std::string_view key, double normalized)=0
virtual std::string do_param_display_text(std::string_view key, double normalized)=0
bool has_param(std::string_view key)
Live membership test — the single source of truth for "is this keybound right now".
Definition host_surfaces.hpp:46
int param_step_count(std::string_view key)
Number of distinct values the HOST's parameter exposes for key — the authoritative cardinality of a d...
Definition host_surfaces.hpp:107
void begin_gesture(std::string_view key)
Definition host_surfaces.hpp:65
virtual int do_param_step_count(std::string_view key)
Defaults to 0 ("continuous / no index domain") so a host surface implemented outside this repo keeps ...
Definition host_surfaces.hpp:123
void set_param(std::string_view key, double normalized)
Write a normalized [0, 1] value.
Definition host_surfaces.hpp:60
virtual ~HostParamSurface()=default
void end_gesture(std::string_view key)
Definition host_surfaces.hpp:70
double get_param(std::string_view key)
Current normalized [0, 1] value of key.
Definition host_surfaces.hpp:53
virtual void do_begin_gesture(std::string_view key)=0
Definition audio_bridge.hpp:9
double param_index_to_normalized(int index, int step_count)
Map a discrete parameter's value index to a normalized [0, 1] value.
Definition host_surfaces.hpp:155
int param_normalized_to_index(double normalized, int step_count)
Inverse of param_index_to_normalized: the nearest value index for a normalized [0,...
Definition host_surfaces.hpp:166