Skip to content

Commit ef40453

Browse files
roelofvkrabique
authored andcommitted
Add mini-curve-display-hints extension.
This extension allows the plugin to optionally query the host for hints as to how a curve of a certain kind will be displayed.
1 parent 0b84cc2 commit ef40453

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

include/clap/all.h

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "ext/draft/extensible-audio-ports.h"
99
#include "ext/draft/gain-adjustment-metering.h"
1010
#include "ext/draft/mini-curve-display.h"
11+
#include "ext/draft/mini-curve-display-hints.h"
1112
#include "ext/draft/project-location.h"
1213
#include "ext/draft/resource-directory.h"
1314
#include "ext/draft/scratch-memory.h"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#pragma once
2+
3+
#include "../../plugin.h"
4+
5+
// This extension can be optionally provided by a host as an addition to clap.mini-curve-display
6+
// in order to give the plugin more knowledge about how the mini curve display will be
7+
// displayed.
8+
9+
static CLAP_CONSTEXPR const char CLAP_EXT_MINI_CURVE_DISPLAY_HINTS[] =
10+
"clap.mini-curve-display-hints/1";
11+
12+
#ifdef __cplusplus
13+
extern "C" {
14+
#endif
15+
16+
enum clap_mini_curve_display_curve_kind {
17+
// The mini curve is intended to draw the total gain response of the plugin.
18+
// In this case the y values are in dB and the x values are in hz (logarithmic).
19+
// This would be useful in for example an equalizer.
20+
CLAP_MINI_CURVE_DISPLAY_CURVE_KIND_GAIN_RESPONSE = 1,
21+
22+
// The mini curve is intended to draw the total phase response of the plugin.
23+
// In this case the y values are in radians and the x values are in hz (logarithmic).
24+
// This would be useful in for example an equalizer.
25+
CLAP_MINI_CURVE_DISPLAY_CURVE_KIND_PHASE_RESPONSE = 2,
26+
27+
// The mini curve is intended to draw the transfer curve of the plugin.
28+
// In this case the both x and y values are in dB.
29+
// This would be useful in for example a compressor or distortion plugin.
30+
CLAP_MINI_CURVE_DISPLAY_CURVE_KIND_TRANSFER_CURVE = 3,
31+
32+
// This mini curve is intended to draw gain reduction over time. In this case
33+
// x refers to the window in seconds and y refers to level in dB, x_min is
34+
// always 0, and x_max would be the duration of the window.
35+
// This would be useful in for example a compressor or limiter.
36+
CLAP_MINI_CURVE_DISPLAY_CURVE_KIND_GAIN_REDUCTION = 4,
37+
38+
// This curve is intended as a generic time series plot. In this case
39+
// x refers to the window in seconds. x_min is always 0, and x_max would be the duration of the
40+
// window.
41+
// Y is not specified and up to the plugin.
42+
CLAP_MINI_CURVE_DISPLAY_CURVE_KIND_TIME_SERIES = 5,
43+
};
44+
45+
typedef struct clap_mini_display_curve_hints {
46+
47+
// Range for the x axis.
48+
double x_min;
49+
double x_max;
50+
51+
// Range for the y axis.
52+
double y_min;
53+
double y_max;
54+
55+
} clap_mini_display_curve_hints_t;
56+
57+
typedef struct clap_host_mini_curve_display_hints {
58+
// Fills in the given clap_mini_display_curve_hints_t structure and returns
59+
// true if succesful. If not, return false.
60+
// [main-thread]
61+
bool(CLAP_ABI *get)(const clap_host_t *host,
62+
uint32_t kind,
63+
clap_mini_display_curve_hints_t *hints);
64+
} clap_host_mini_curve_display_hints_t;
65+
66+
#ifdef __cplusplus
67+
}
68+
#endif
69+

0 commit comments

Comments
 (0)