comparison DPF-Prymula-audioplugins/dpf/distrho/src/clap/ext/note-ports.h @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 #pragma once
2
3 #include "../plugin.h"
4 #include "../string-sizes.h"
5
6 /// @page Note Ports
7 ///
8 /// This extension provides a way for the plugin to describe its current note ports.
9 /// If the plugin does not implement this extension, it won't have note input or output.
10 /// The plugin is only allowed to change its note ports configuration while it is deactivated.
11
12 static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_PORTS[] = "clap.note-ports";
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 enum clap_note_dialect {
19 // Uses clap_event_note and clap_event_note_expression.
20 CLAP_NOTE_DIALECT_CLAP = 1 << 0,
21
22 // Uses clap_event_midi, no polyphonic expression
23 CLAP_NOTE_DIALECT_MIDI = 1 << 1,
24
25 // Uses clap_event_midi, with polyphonic expression (MPE)
26 CLAP_NOTE_DIALECT_MIDI_MPE = 1 << 2,
27
28 // Uses clap_event_midi2
29 CLAP_NOTE_DIALECT_MIDI2 = 1 << 3,
30 };
31
32 typedef struct clap_note_port_info {
33 // id identifies a port and must be stable.
34 // id may overlap between input and output ports.
35 clap_id id;
36 uint32_t supported_dialects; // bitfield, see clap_note_dialect
37 uint32_t preferred_dialect; // one value of clap_note_dialect
38 char name[CLAP_NAME_SIZE]; // displayable name, i18n?
39 } clap_note_port_info_t;
40
41 // The note ports scan has to be done while the plugin is deactivated.
42 typedef struct clap_plugin_note_ports {
43 // number of ports, for either input or output
44 // [main-thread]
45 uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin, bool is_input);
46
47 // get info about about a note port.
48 // [main-thread]
49 bool(CLAP_ABI *get)(const clap_plugin_t *plugin,
50 uint32_t index,
51 bool is_input,
52 clap_note_port_info_t *info);
53 } clap_plugin_note_ports_t;
54
55 enum {
56 // The ports have changed, the host shall perform a full scan of the ports.
57 // This flag can only be used if the plugin is not active.
58 // If the plugin active, call host->request_restart() and then call rescan()
59 // when the host calls deactivate()
60 CLAP_NOTE_PORTS_RESCAN_ALL = 1 << 0,
61
62 // The ports name did change, the host can scan them right away.
63 CLAP_NOTE_PORTS_RESCAN_NAMES = 1 << 1,
64 };
65
66 typedef struct clap_host_note_ports {
67 // Query which dialects the host supports
68 // [main-thread]
69 uint32_t(CLAP_ABI *supported_dialects)(const clap_host_t *host);
70
71 // Rescan the full list of note ports according to the flags.
72 // [main-thread]
73 void(CLAP_ABI *rescan)(const clap_host_t *host, uint32_t flags);
74 } clap_host_note_ports_t;
75
76 #ifdef __cplusplus
77 }
78 #endif