Skip to content

Commit 533e849

Browse files
baconpaulabique
authored andcommitted
Add some of the feedback from the Auburn/DPlug port
basically expand some comments around ranges, meaning, and so on.
1 parent ab54bc5 commit 533e849

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

include/clap/events.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ extern "C" {
99
#endif
1010

1111
// event header
12-
// must be the first attribute of the event
12+
// All clap events start with an event header to determine the overall
13+
// size of the event and its type and space (a namespacing for types).
14+
// clap_event objects are contiguous regions of memory which can be copied
15+
// with a memcpy of `size` bytes starting at the top of the header. As
16+
// such, be very careful when desiginig clap events with internal pointers
17+
// and other non-value-types to consider the lifetime of those members.
1318
typedef struct clap_event_header {
1419
uint32_t size; // event size including this header, eg: sizeof (clap_event_note)
1520
uint32_t time; // sample offset within the buffer for this event
@@ -266,6 +271,12 @@ enum clap_transport_flags {
266271
CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL = 1 << 7,
267272
};
268273

274+
// clap_event_transport provides song position, tempo, and similar information
275+
// from the host to the plugin. There are two ways a host communicates these values.
276+
// In the `clap_process` structure sent to each processing block, the host must
277+
// provide a transport structure which indicates the available information at the
278+
// start of the block. If the host provides sample-accurate tempo or transport changes,
279+
// it can also provide subsequent inter-block transport updates by delivering a new event.
269280
typedef struct clap_event_transport {
270281
clap_event_header_t header;
271282

include/clap/ext/gui.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
/// Embedding the window gives more control to the host, and feels more integrated.
1414
/// Floating window are sometimes the only option due to technical limitations.
1515
///
16+
/// The Embedding protocol is by far the most common, supported by all hosts to date,
17+
/// and a plugin author should support at least that case.
18+
///
1619
/// Showing the GUI works as follow:
1720
/// 1. clap_plugin_gui->is_api_supported(), check what can work
1821
/// 2. clap_plugin_gui->create(), allocates gui resources
@@ -85,7 +88,10 @@ typedef struct clap_gui_resize_hints {
8588
bool can_resize_horizontally;
8689
bool can_resize_vertically;
8790

88-
// only if can resize horizontally and vertically
91+
// if both horizontal and vertical resize are available, do we preserve the
92+
// aspect ratio, and if so, what is the width x height aspect ratio to preserve.
93+
// These flags are unused if can_resize_horizontally or vertically are false,
94+
// and ratios are unused if preserve is false.
8995
bool preserve_aspect_ratio;
9096
uint32_t aspect_ratio_width;
9197
uint32_t aspect_ratio_height;
@@ -94,7 +100,8 @@ typedef struct clap_gui_resize_hints {
94100
// Size (width, height) is in pixels; the corresponding windowing system extension is
95101
// responsible for defining if it is physical pixels or logical pixels.
96102
typedef struct clap_plugin_gui {
97-
// Returns true if the requested gui api is supported
103+
// Returns true if the requested gui api is supported, either in floating (plugin-created)
104+
// or non-floating (embedded) mode.
98105
// [main-thread]
99106
bool(CLAP_ABI *is_api_supported)(const clap_plugin_t *plugin, const char *api, bool is_floating);
100107

include/clap/ext/params.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ typedef struct clap_param_info {
246246
// '/' will be used as a separator to show a tree-like structure.
247247
char module[CLAP_PATH_SIZE];
248248

249-
double min_value; // Minimum plain value
250-
double max_value; // Maximum plain value
251-
double default_value; // Default plain value
249+
double min_value; // Minimum plain value. Must be finite (`std::isfinite` true)
250+
double max_value; // Maximum plain value. Must be finite
251+
double default_value; // Default plain value. Must be in [min, max] range.
252252
} clap_param_info_t;
253253

254254
typedef struct clap_plugin_params {

0 commit comments

Comments
 (0)