Skip to content

Commit 4e07127

Browse files
committed
mini-curve-display: support stacked mini curves
1 parent 41e83c9 commit 4e07127

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

include/clap/ext/draft/mini-curve-display.h

+31-6
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,38 @@ typedef struct clap_mini_display_curve_hints {
5454

5555
} clap_mini_display_curve_hints_t;
5656

57+
// A set of points representing the curve to be painted.
58+
typedef struct clap_mini_display_curve_data {
59+
// Indicates the kind of curve those values represent, the host can use this
60+
// information to paint the curve using a meaningful color.
61+
int32_t curve_kind;
62+
63+
// values[0] will be the leftmost value and values[data_size -1] will be the rightmost
64+
// value.
65+
//
66+
// The value 0 and UINT16_MAX won't be painted.
67+
// The value 1 will be at the bottom of the curve and UINT16_MAX - 1 will be at the top.
68+
uint16_t *values;
69+
uint32_t values_count;
70+
} clap_mini_display_curve_data_t;
5771

5872
typedef struct clap_plugin_mini_curve_display {
73+
// Returns the number of curves the plugin wants to paint.
74+
// Be aware that the space to display those curves will be small, and too much data will make
75+
// the output hard to read.
76+
uint32_t(CLAP_ABI *get_curve_count)(const clap_plugin_t *plugin);
77+
5978
// Renders the curve into the data buffer.
60-
// The value 0 will be at the bottom of the curve and UINT16_MAX will be at the top.
61-
// The value at index 0 will be the leftmost and the value at index data_size -1 will be the
62-
// rightmost.
79+
//
80+
// The host will "stack" the curves, from the first one to the last one.
81+
// data[0] is the first curve to be painted.
82+
// data[n + 1] will be painted over data[n].
83+
//
84+
// Returns the number of curves rendered.
6385
// [main-thread]
64-
bool(CLAP_ABI *render)(const clap_plugin_t *plugin, uint16_t *data, uint32_t data_size);
86+
uint32_t(CLAP_ABI *render)(const clap_plugin_t *plugin,
87+
clap_mini_display_curve_data_t *data,
88+
uint32_t data_size);
6589

6690
// Tells the plugin if the curve is currently observed or not.
6791
// When it isn't observed render() can't be called.
@@ -77,6 +101,7 @@ typedef struct clap_plugin_mini_curve_display {
77101
// Returns true on success, if the name capacity was sufficient.
78102
// [main-thread]
79103
bool(CLAP_ABI *get_axis_name)(const clap_plugin_t *plugin,
104+
uint32_t curve_index,
80105
char *x_name,
81106
char *y_name,
82107
uint32_t name_capacity);
@@ -97,8 +122,8 @@ typedef struct clap_host_mini_curve_display {
97122
// true if succesful. If not, return false.
98123
// [main-thread]
99124
bool(CLAP_ABI *get)(const clap_host_t *host,
100-
uint32_t kind,
101-
clap_mini_display_curve_hints_t *hints);
125+
uint32_t kind,
126+
clap_mini_display_curve_hints_t *hints);
102127

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

0 commit comments

Comments
 (0)