LMMS
Loading...
Searching...
No Matches
params.h
Go to the documentation of this file.
1#pragma once
2
3#include "../plugin.h"
4#include "../string-sizes.h"
5
76
77static CLAP_CONSTEXPR const char CLAP_EXT_PARAMS[] = "clap.params";
78
79#ifdef __cplusplus
80extern "C" {
81#endif
82
83enum {
84 // Is this param stepped? (integer values only)
85 // if so the double value is converted to integer using a cast (equivalent to trunc).
87
88 // Useful for for periodic parameters like a phase
90
91 // The parameter should not be shown to the user, because it is currently not used.
92 // It is not necessary to process automation for this parameter.
94
95 // The parameter can't be changed by the host.
97
98 // This parameter is used to merge the plugin and host bypass button.
99 // It implies that the parameter is stepped.
100 // min: 0 -> bypass off
101 // max: 1 -> bypass on
103
104 // When set:
105 // - automation can be recorded
106 // - automation can be played back
107 //
108 // The host can send live user changes for this parameter regardless of this flag.
109 //
110 // If this parameters affect the internal processing structure of the plugin, ie: max delay, fft
111 // size, ... and the plugins needs to re-allocate its working buffers, then it should call
112 // host->request_restart(), and perform the change once the plugin is re-activated.
114
115 // Does this parameter support per note automations?
117
118 // Does this parameter support per key automations?
120
121 // Does this parameter support per channel automations?
123
124 // Does this parameter support per port automations?
126
127 // Does this parameter support the modulation signal?
129
130 // Does this parameter support per note modulations?
132
133 // Does this parameter support per key modulations?
135
136 // Does this parameter support per channel modulations?
138
139 // Does this parameter support per port modulations?
141
142 // Any change to this parameter will affect the plugin output and requires to be done via
143 // process() if the plugin is active.
144 //
145 // A simple example would be a DC Offset, changing it will change the output signal and must be
146 // processed.
148};
150
151/* This describes a parameter */
152typedef struct clap_param_info {
153 // stable parameter identifier, it must never change.
155
157
158 // This value is optional and set by the plugin.
159 // Its purpose is to provide a fast access to the plugin parameter:
160 //
161 // Parameter *p = findParameter(param_id);
162 // param_info->cookie = p;
163 //
164 // /* and later on */
165 // Parameter *p = (Parameter *)cookie;
166 //
167 // It is invalidated on clap_host_params->rescan(CLAP_PARAM_RESCAN_ALL) and when the plugin is
168 // destroyed.
169 void *cookie;
170
171 // the display name
173
174 // the module path containing the param, eg:"oscillators/wt1"
175 // '/' will be used as a separator to show a tree like structure.
177
178 double min_value; // minimum plain value
179 double max_value; // maximum plain value
180 double default_value; // default plain value
182
183typedef struct clap_plugin_params {
184 // Returns the number of parameters.
185 // [main-thread]
187
188 // Copies the parameter's info to param_info and returns true on success.
189 // [main-thread]
190 bool (CLAP_ABI *get_info)(const clap_plugin_t *plugin,
193
194 // Gets the parameter plain value.
195 // [main-thread]
196 bool (CLAP_ABI *get_value)(const clap_plugin_t *plugin, clap_id param_id, double *value);
197
198 // Formats the display text for the given parameter value.
199 // The host should always format the parameter value to text using this function
200 // before displaying it to the user.
201 // [main-thread]
202 bool (CLAP_ABI *value_to_text)(
203 const clap_plugin_t *plugin, clap_id param_id, double value, char *display, uint32_t size);
204
205 // Converts the display text to a parameter value.
206 // [main-thread]
207 bool (CLAP_ABI *text_to_value)(const clap_plugin_t *plugin,
209 const char *display,
210 double *value);
211
212 // Flushes a set of parameter changes.
213 // This method must not be called concurrently to clap_plugin->process().
214 //
215 // [active ? audio-thread : main-thread]
220
221enum {
222 // The parameter values did change, eg. after loading a preset.
223 // The host will scan all the parameters value.
224 // The host will not record those changes as automation points.
225 // New values takes effect immediately.
227
228 // The value to text conversion changed, and the text needs to be rendered again.
230
231 // The parameter info did change, use this flag for:
232 // - name change
233 // - module change
234 // - is_periodic (flag)
235 // - is_hidden (flag)
236 // New info takes effect immediately.
238
239 // Invalidates everything the host knows about parameters.
240 // It can only be used while the plugin is deactivated.
241 // If the plugin is activated use clap_host->restart() and delay any change until the host calls
242 // clap_plugin->deactivate().
243 //
244 // You must use this flag if:
245 // - some parameters were added or removed.
246 // - some parameters had critical changes:
247 // - is_per_note (flag)
248 // - is_per_channel (flag)
249 // - is_readonly (flag)
250 // - is_bypass (flag)
251 // - is_stepped (flag)
252 // - is_modulatable (flag)
253 // - min_value
254 // - max_value
255 // - cookie
257};
259
260enum {
261 // Clears all possible references to a parameter
263
264 // Clears all automations to a parameter
266
267 // Clears all modulations to a parameter
269};
271
272typedef struct clap_host_params {
273 // Rescan the full list of parameters according to the flags.
274 // [main-thread]
276
277 // Clears references to a parameter.
278 // [main-thread]
280
281 // Request a parameter flush.
282 //
283 // The host will then schedule a call to either:
284 // - clap_plugin.process()
285 // - clap_plugin_params->flush()
286 //
287 // This function is always safe to use and should not be called from an [audio-thread] as the
288 // plugin would already be within process() or flush().
289 //
290 // [thread-safe,!audio-thread]
291 void (CLAP_ABI *request_flush)(const clap_host_t *host);
293
294#ifdef __cplusplus
295}
296#endif
struct clap_input_events clap_input_events_t
struct clap_output_events clap_output_events_t
struct clap_host clap_host_t
uint32_t clap_id
Definition id.h:6
#define CLAP_ABI
Definition macros.h:24
#define CLAP_CONSTEXPR
Definition macros.h:32
unsigned int uint32_t
Definition mid.cpp:100
struct clap_plugin_params clap_plugin_params_t
uint32_t clap_param_clear_flags
Definition params.h:270
@ CLAP_PARAM_CLEAR_ALL
Definition params.h:262
@ CLAP_PARAM_CLEAR_AUTOMATIONS
Definition params.h:265
@ CLAP_PARAM_CLEAR_MODULATIONS
Definition params.h:268
struct clap_host_params clap_host_params_t
@ CLAP_PARAM_IS_MODULATABLE_PER_PORT
Definition params.h:140
@ CLAP_PARAM_IS_STEPPED
Definition params.h:86
@ CLAP_PARAM_IS_READONLY
Definition params.h:96
@ CLAP_PARAM_IS_MODULATABLE_PER_KEY
Definition params.h:134
@ CLAP_PARAM_IS_AUTOMATABLE
Definition params.h:113
@ CLAP_PARAM_IS_MODULATABLE_PER_CHANNEL
Definition params.h:137
@ CLAP_PARAM_IS_AUTOMATABLE_PER_KEY
Definition params.h:119
@ CLAP_PARAM_IS_HIDDEN
Definition params.h:93
@ CLAP_PARAM_IS_AUTOMATABLE_PER_NOTE_ID
Definition params.h:116
@ CLAP_PARAM_IS_AUTOMATABLE_PER_CHANNEL
Definition params.h:122
@ CLAP_PARAM_IS_AUTOMATABLE_PER_PORT
Definition params.h:125
@ CLAP_PARAM_IS_MODULATABLE_PER_NOTE_ID
Definition params.h:131
@ CLAP_PARAM_IS_BYPASS
Definition params.h:102
@ CLAP_PARAM_REQUIRES_PROCESS
Definition params.h:147
@ CLAP_PARAM_IS_MODULATABLE
Definition params.h:128
@ CLAP_PARAM_IS_PERIODIC
Definition params.h:89
uint32_t clap_param_info_flags
Definition params.h:149
uint32_t clap_param_rescan_flags
Definition params.h:258
static CLAP_CONSTEXPR const char CLAP_EXT_PARAMS[]
Definition params.h:77
@ CLAP_PARAM_RESCAN_TEXT
Definition params.h:229
@ CLAP_PARAM_RESCAN_ALL
Definition params.h:256
@ CLAP_PARAM_RESCAN_VALUES
Definition params.h:226
@ CLAP_PARAM_RESCAN_INFO
Definition params.h:237
struct clap_param_info clap_param_info_t
struct clap_plugin clap_plugin_t
@ CLAP_NAME_SIZE
Definition string-sizes.h:9
@ CLAP_PATH_SIZE
Definition string-sizes.h:16
Definition params.h:272
clap_id param_id
Definition params.h:279
void(CLAP_ABI *request_flush)(const clap_host_t *host)
clap_param_rescan_flags flags
Definition params.h:275
Definition params.h:152
void * cookie
Definition params.h:169
char name[CLAP_NAME_SIZE]
Definition params.h:172
char module[CLAP_PATH_SIZE]
Definition params.h:176
clap_param_info_flags flags
Definition params.h:156
clap_id id
Definition params.h:154
double max_value
Definition params.h:179
double default_value
Definition params.h:180
double min_value
Definition params.h:178
Definition params.h:183
bool(CLAP_ABI *get_value)(const clap_plugin_t *plugin
clap_id param_id
Definition params.h:196
const clap_input_events_t const clap_output_events_t * out
Definition params.h:218
uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin)
bool(CLAP_ABI *get_info)(const clap_plugin_t *plugin
void(CLAP_ABI *flush)(const clap_plugin_t *plugin
clap_id double char * display
Definition params.h:203
uint32_t param_index
Definition params.h:191
clap_id double * value
Definition params.h:196
bool(CLAP_ABI *value_to_text)(const clap_plugin_t *plugin
bool(CLAP_ABI *text_to_value)(const clap_plugin_t *plugin
clap_id double char uint32_t size
Definition params.h:203
const clap_input_events_t * in
Definition params.h:217
uint32_t clap_param_info_t * param_info
Definition params.h:192
int flush(__G__ rawbuf, size, unshrink) __GDEF uch *rawbuf
#define void
Definition unzip.h:396
_WDL_CSTRING_PREFIX void INT_PTR count
Definition wdlcstring.h:263