Skip to content

Commit

Permalink
Add some of the feedback from the Auburn/DPlug port
Browse files Browse the repository at this point in the history
basically expand some comments around ranges, meaning, and so on.
  • Loading branch information
baconpaul committed Nov 19, 2024
1 parent ab54bc5 commit f225a17
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
13 changes: 12 additions & 1 deletion include/clap/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ extern "C" {
#endif

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

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

Expand Down
11 changes: 9 additions & 2 deletions include/clap/ext/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/// Embedding the window gives more control to the host, and feels more integrated.
/// Floating window are sometimes the only option due to technical limitations.
///
/// The Embedding protocol is by far the most common, supported by all hosts to date,
/// and a plugin author should support at least that case.
///
/// Showing the GUI works as follow:
/// 1. clap_plugin_gui->is_api_supported(), check what can work
/// 2. clap_plugin_gui->create(), allocates gui resources
Expand Down Expand Up @@ -85,7 +88,10 @@ typedef struct clap_gui_resize_hints {
bool can_resize_horizontally;
bool can_resize_vertically;

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

Expand Down
6 changes: 3 additions & 3 deletions include/clap/ext/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ typedef struct clap_param_info {
// '/' will be used as a separator to show a tree-like structure.
char module[CLAP_PATH_SIZE];

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

typedef struct clap_plugin_params {
Expand Down

0 comments on commit f225a17

Please sign in to comment.