forked from free-audio/clap
/
audio-ports-config.h
73 lines (59 loc) · 2.41 KB
/
audio-ports-config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include "../chmap.h"
#include "../string-sizes.h"
#include "../plugin.h"
/// @page Audio Ports Config
///
/// This extension provides a way for the plugin to describe possible ports configurations, for
/// example mono, stereo, surround, ... and a way for the host to select a configuration.
///
/// After the plugin initialization, the host may scan the list of configurations and eventually
/// select one that fits the plugin context. The host can only select a configuration if the plugin
/// is deactivated.
///
/// A configuration is a very simple description of the audio ports:
/// - it describes the main input and output ports
/// - it has a name that can be displayed to the user
///
/// The idea behind the configurations, is to let the user choose one via a menu.
///
/// Plugin with very complex configuration possibilities should let the user configure the ports
/// from the plugin GUI, and call @ref clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_ALL).
static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_CONFIG[] = "clap.audio-ports-config";
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, CLAP_ALIGN)
// Minimalistic description of ports configuration
typedef struct clap_audio_ports_config {
alignas(4) clap_id id;
alignas(1) char name[CLAP_NAME_SIZE];
// main input info
alignas(4) uint32_t input_channel_count;
alignas(4) clap_chmap input_channel_map;
// main output info
alignas(4) uint32_t output_channel_count;
alignas(4) clap_chmap output_channel_map;
} clap_audio_ports_config_t;
// The audio ports config scan has to be done while the plugin is deactivated.
typedef struct clap_plugin_audio_ports_config {
// gets the number of available configurations
// [main-thread]
uint32_t (*count)(const clap_plugin_t *plugin);
// gets information about a configuration
// [main-thread]
bool (*get)(const clap_plugin_t *plugin, uint32_t index, clap_audio_ports_config_t *config);
// selects the configuration designated by id
// returns true if the configuration could be applied
// [main-thread,plugin-deactivated]
bool (*select)(const clap_plugin_t *plugin, clap_id config_id);
} clap_plugin_audio_ports_config_t;
typedef struct clap_host_audio_ports_config {
// Rescan the full list of configs.
// [main-thread]
void (*rescan)(const clap_host_t *host);
} clap_host_audio_ports_config_t;
#pragma pack(pop)
#ifdef __cplusplus
}
#endif