Improve params documentation; related to and
@@ -234,29 +234,33 @@ typedef struct clap_plugin_params {
// [main-thread]
uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin);
- // Copies the parameter's info to param_info and returns true on success.
+ // Copies the parameter's info to param_info. Returns true on success.
// [main-thread]
bool(CLAP_ABI *get_info)(const clap_plugin_t *plugin,
uint32_t param_index,
clap_param_info_t *param_info);
- // Gets the parameter plain value.
+ // Writes the parameter's current value to out_value. Returns true on success.
// [main-thread]
- bool(CLAP_ABI *get_value)(const clap_plugin_t *plugin, clap_id param_id, double *value);
+ bool(CLAP_ABI *get_value)(const clap_plugin_t *plugin, clap_id param_id, double *out_value);
- // Formats the display text for the given parameter value.
- // The host should always format the parameter value to text using this function
- // before displaying it to the user.
- // [main-thread]
- bool(CLAP_ABI *value_to_text)(
- const clap_plugin_t *plugin, clap_id param_id, double value, char *display, uint32_t size);
+ // Fills out_buffer with a null-terminated UTF-8 string that represents the parameter at the
+ // given 'value' argument. eg: "2.3 kHz". Returns true on success. Returns false if the text +
+ // null-terminator is greater than out_buffer_capacity. The host should always use this to format
+ // parameter values before displaying it to the user. [main-thread]
+ bool(CLAP_ABI *value_to_text)(const clap_plugin_t *plugin,
+ clap_id param_id,
+ double value,
+ char *out_buffer,
+ uint32_t out_buffer_capacity);
- // Converts the display text to a parameter value.
+ // Converts the null-terminated UTF-8 param_value_text into a double and writes it to out_value.
+ // Returns true on success. The host can use this to convert user input into a parameter value.
// [main-thread]
bool(CLAP_ABI *text_to_value)(const clap_plugin_t *plugin,
clap_id param_id,
- const char *display,
- double *value);
+ const char *param_value_text,
+ double *out_value);
// Flushes a set of parameter changes.
// This method must not be called concurrently to clap_plugin->process().
