Skip to content

Commit 076ddda

Browse files
Trinitouabique
authored andcommitted
draft param-origin extension
1 parent 8d8d485 commit 076ddda

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

include/clap/ext/draft/param-origin.h

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#pragma once
2+
3+
#include "../../plugin.h"
4+
5+
static CLAP_CONSTEXPR const char CLAP_EXT_PARAM_ORIGIN[] = "clap.param-origin/1";
6+
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
/// This extension provides an optional value per parameter that lets the host draw a visual
12+
/// indication for the parameter's origin.
13+
///
14+
/// examples:
15+
/// - lowpass filter cutoff parameter with an origin equal to param_info.min_value
16+
/// [--------------> ]
17+
/// 60Hz 20kHz
18+
/// min=origin max
19+
/// - highpass filter cutoff parameter with an origin equal to param_info.max_value
20+
/// [ <--------------]
21+
/// 60Hz 20kHz
22+
/// min max=origin
23+
/// - (bipolar) parameter with a range from -1.0 to +1.0 with an origin of 0.0
24+
/// [ <------| ]
25+
/// -1.0 0.0 +1.0
26+
/// min origin max
27+
/// - crossfade parameter without an origin
28+
/// [ o ]
29+
/// A B
30+
/// min max
31+
32+
typedef struct clap_plugin_param_origin {
33+
// Get the origin value for a parameter.
34+
// Returns false if the parameter has no origin, true otherwise.
35+
// The host must not call this for params with CLAP_PARAM_IS_ENUM flag set.
36+
//
37+
// out_value constraints:
38+
// - has to be in the range from param_info.min_value to param_info.max_value
39+
// - has to be an integer value if CLAP_PARAM_IS_STEPPED flag is set
40+
// [main-thread]
41+
bool(CLAP_ABI *get)(const clap_plugin_t *plugin, clap_id param_id, double *out_value);
42+
} clap_plugin_param_origin_t;
43+
44+
typedef struct clap_host_param_origin {
45+
// Informs the host that param origins have changed.
46+
//
47+
// Note: If the plugin calls params.rescan with CLAP_PARAM_RESCAN_ALL, all previously scanned
48+
// parameter origins must be considered invalid. It is thus not necessary for the plugin to call
49+
// param_origin.changed in this case.
50+
//
51+
// Note: This is useful if a parameter origin changes on-the-fly. For example a plugin might want
52+
// to change the origin of a filter cutoff frequency parameter when the corresponding filter type
53+
// (LP/BP/HP) has changed.
54+
//
55+
// [main-thread]
56+
void(CLAP_ABI *changed)(const clap_host_t *host);
57+
} clap_host_param_origin_t;
58+
59+
#ifdef __cplusplus
60+
}
61+
#endif

0 commit comments

Comments
 (0)