comparison DPF-Prymula-audioplugins/dpf/distrho/src/clap/plugin.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 "private/macros.h"
4 #include "host.h"
5 #include "process.h"
6 #include "plugin-features.h"
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 typedef struct clap_plugin_descriptor {
13 clap_version_t clap_version; // initialized to CLAP_VERSION
14
15 // Mandatory fields must be set and must not be blank.
16 // Otherwise the fields can be null or blank, though it is safer to make them blank.
17 const char *id; // eg: "com.u-he.diva", mandatory
18 const char *name; // eg: "Diva", mandatory
19 const char *vendor; // eg: "u-he"
20 const char *url; // eg: "https://u-he.com/products/diva/"
21 const char *manual_url; // eg: "https://dl.u-he.com/manuals/plugins/diva/Diva-user-guide.pdf"
22 const char *support_url; // eg: "https://u-he.com/support/"
23 const char *version; // eg: "1.4.4"
24 const char *description; // eg: "The spirit of analogue"
25
26 // Arbitrary list of keywords.
27 // They can be matched by the host indexer and used to classify the plugin.
28 // The array of pointers must be null terminated.
29 // For some standard features see plugin-features.h
30 const char **features;
31 } clap_plugin_descriptor_t;
32
33 typedef struct clap_plugin {
34 const clap_plugin_descriptor_t *desc;
35
36 void *plugin_data; // reserved pointer for the plugin
37
38 // Must be called after creating the plugin.
39 // If init returns false, the host must destroy the plugin instance.
40 // [main-thread]
41 bool(CLAP_ABI *init)(const struct clap_plugin *plugin);
42
43 // Free the plugin and its resources.
44 // It is required to deactivate the plugin prior to this call.
45 // [main-thread & !active]
46 void(CLAP_ABI *destroy)(const struct clap_plugin *plugin);
47
48 // Activate and deactivate the plugin.
49 // In this call the plugin may allocate memory and prepare everything needed for the process
50 // call. The process's sample rate will be constant and process's frame count will included in
51 // the [min, max] range, which is bounded by [1, INT32_MAX].
52 // Once activated the latency and port configuration must remain constant, until deactivation.
53 //
54 // [main-thread & !active_state]
55 bool(CLAP_ABI *activate)(const struct clap_plugin *plugin,
56 double sample_rate,
57 uint32_t min_frames_count,
58 uint32_t max_frames_count);
59 // [main-thread & active_state]
60 void(CLAP_ABI *deactivate)(const struct clap_plugin *plugin);
61
62 // Call start processing before processing.
63 // [audio-thread & active_state & !processing_state]
64 bool(CLAP_ABI *start_processing)(const struct clap_plugin *plugin);
65
66 // Call stop processing before sending the plugin to sleep.
67 // [audio-thread & active_state & processing_state]
68 void(CLAP_ABI *stop_processing)(const struct clap_plugin *plugin);
69
70 // - Clears all buffers, performs a full reset of the processing state (filters, oscillators,
71 // enveloppes, lfo, ...) and kills all voices.
72 // - The parameter's value remain unchanged.
73 // - clap_process.steady_time may jump backward.
74 //
75 // [audio-thread & active_state]
76 void(CLAP_ABI *reset)(const struct clap_plugin *plugin);
77
78 // process audio, events, ...
79 // [audio-thread & active_state & processing_state]
80 clap_process_status(CLAP_ABI *process)(const struct clap_plugin *plugin,
81 const clap_process_t *process);
82
83 // Query an extension.
84 // The returned pointer is owned by the plugin.
85 // [thread-safe]
86 const void *(CLAP_ABI *get_extension)(const struct clap_plugin *plugin, const char *id);
87
88 // Called by the host on the main thread in response to a previous call to:
89 // host->request_callback(host);
90 // [main-thread]
91 void(CLAP_ABI *on_main_thread)(const struct clap_plugin *plugin);
92 } clap_plugin_t;
93
94 #ifdef __cplusplus
95 }
96 #endif