Skip to content

Commit

Permalink
mini-curve-display: support stacked mini curves
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed Mar 8, 2025
1 parent 074211f commit dd63a14
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions include/clap/ext/draft/mini-curve-display.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,28 @@ typedef struct clap_mini_display_curve_hints {

} clap_mini_display_curve_hints_t;


typedef struct clap_plugin_mini_curve_display {
// Returns the number of curves the plugin wants to paint.
// Be aware that the space to display those curves will be small, and too much data will make
// the output hard to read.
uint32_t(CLAP_ABI *get_curve_count)(const clap_plugin_t *plugin);

// Renders the curve into the data buffer.
// The value 0 will be at the bottom of the curve and UINT16_MAX will be at the top.
// The value at index 0 will be the leftmost and the value at index data_size -1 will be the
// rightmost.
//
// The host will "stack" the curves, from the first one to the last one.
// data[0] is the first curve to be painted.
// data[n + 1] will be painted over data[n].
// The data[n][0] will be the leftmost value and data[n][data_size -1] will be the rightmost
// value.
//
// The value 0 and UINT16_MAX won't be painted.
// The value 1 will be at the bottom of the curve and UINT16_MAX - 1 will be at the top.
//
// [main-thread]
bool(CLAP_ABI *render)(const clap_plugin_t *plugin, uint16_t *data, uint32_t data_size);
bool(CLAP_ABI *render)(const clap_plugin_t *plugin,
uint32_t curve_count,
uint16_t *const *data,
uint32_t data_size);

// Tells the plugin if the curve is currently observed or not.
// When it isn't observed render() can't be called.
Expand Down Expand Up @@ -97,8 +111,8 @@ typedef struct clap_host_mini_curve_display {
// true if succesful. If not, return false.
// [main-thread]
bool(CLAP_ABI *get)(const clap_host_t *host,
uint32_t kind,
clap_mini_display_curve_hints_t *hints);
uint32_t kind,
clap_mini_display_curve_hints_t *hints);

// Mark the curve as being static or dynamic.
// The curve is initially considered as static, though the plugin should explicitely
Expand Down

0 comments on commit dd63a14

Please sign in to comment.