Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
plugin_descriptor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2018-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __PLUGINS_PLUGIN_DESCRIPTOR_H__
11#define __PLUGINS_PLUGIN_DESCRIPTOR_H__
12
13#include "zrythm-config.h"
14
15#include "utils/types.h"
16
17#include <gio/gio.h>
18#include <glib/gi18n.h>
19
20#include <CarlaBackend.h>
21
22TYPEDEF_STRUCT_UNDERSCORED (WrappedObjectWithChangeSignal);
23enum class TrackType;
24enum class ZPluginSlotType;
25
32#define PLUGIN_DESCRIPTOR_SCHEMA_VERSION 1
33
37#ifdef __cplusplus
38enum class ZPluginCategory
39#else
40typedef enum
41#endif
42{
45 Z_PLUGIN_CATEGORY_DELAY,
46 Z_PLUGIN_CATEGORY_REVERB,
47 Z_PLUGIN_CATEGORY_DISTORTION,
48 Z_PLUGIN_CATEGORY_WAVESHAPER,
49 Z_PLUGIN_CATEGORY_DYNAMICS,
50 Z_PLUGIN_CATEGORY_AMPLIFIER,
51 Z_PLUGIN_CATEGORY_COMPRESSOR,
52 Z_PLUGIN_CATEGORY_ENVELOPE,
53 Z_PLUGIN_CATEGORY_EXPANDER,
54 Z_PLUGIN_CATEGORY_GATE,
55 Z_PLUGIN_CATEGORY_LIMITER,
56 Z_PLUGIN_CATEGORY_FILTER,
57 Z_PLUGIN_CATEGORY_ALLPASS_FILTER,
58 Z_PLUGIN_CATEGORY_BANDPASS_FILTER,
59 Z_PLUGIN_CATEGORY_COMB_FILTER,
60 Z_PLUGIN_CATEGORY_EQ,
61 Z_PLUGIN_CATEGORY_MULTI_EQ,
62 Z_PLUGIN_CATEGORY_PARA_EQ,
63 Z_PLUGIN_CATEGORY_HIGHPASS_FILTER,
64 Z_PLUGIN_CATEGORY_LOWPASS_FILTER,
65 Z_PLUGIN_CATEGORY_GENERATOR,
66 Z_PLUGIN_CATEGORY_CONSTANT,
67 Z_PLUGIN_CATEGORY_INSTRUMENT,
68 Z_PLUGIN_CATEGORY_OSCILLATOR,
69 Z_PLUGIN_CATEGORY_MIDI,
70 Z_PLUGIN_CATEGORY_MODULATOR,
71 Z_PLUGIN_CATEGORY_CHORUS,
72 Z_PLUGIN_CATEGORY_FLANGER,
73 Z_PLUGIN_CATEGORY_PHASER,
74 Z_PLUGIN_CATEGORY_SIMULATOR,
75 Z_PLUGIN_CATEGORY_SIMULATOR_REVERB,
76 Z_PLUGIN_CATEGORY_SPATIAL,
77 Z_PLUGIN_CATEGORY_SPECTRAL,
78 Z_PLUGIN_CATEGORY_PITCH,
79 Z_PLUGIN_CATEGORY_UTILITY,
80 Z_PLUGIN_CATEGORY_ANALYZER,
81 Z_PLUGIN_CATEGORY_CONVERTER,
82 Z_PLUGIN_CATEGORY_FUNCTION,
83 Z_PLUGIN_CATEGORY_MIXER,
84#ifdef __cplusplus
85};
86#else
88#endif
89
93#ifdef __cplusplus
94enum class ZPluginProtocol
95#else
96typedef enum
97#endif
98{
101 Z_PLUGIN_PROTOCOL_LV2,
102 Z_PLUGIN_PROTOCOL_DSSI,
103 Z_PLUGIN_PROTOCOL_LADSPA,
104 Z_PLUGIN_PROTOCOL_VST,
105 Z_PLUGIN_PROTOCOL_VST3,
106 Z_PLUGIN_PROTOCOL_AU,
107 Z_PLUGIN_PROTOCOL_SFZ,
108 Z_PLUGIN_PROTOCOL_SF2,
109 Z_PLUGIN_PROTOCOL_CLAP,
110 Z_PLUGIN_PROTOCOL_JSFX,
111#ifdef __cplusplus
112};
113#else
115#endif
116
121{
122 Z_PLUGIN_ARCHITECTURE_32,
123 Z_PLUGIN_ARCHITECTURE_64
124};
125
130{
131 None,
132 UI,
133 Full,
134};
135
136/***
137 * A descriptor to be implemented by all plugins
138 * This will be used throughout the UI
139 */
140typedef struct PluginDescriptor
141{
142 int schema_version;
143 char * author;
144 char * name;
145 char * website;
146 ZPluginCategory category;
170 char * path;
172 char * uri;
173
175 int64_t unique_id;
176
179
180 bool has_custom_ui;
181
188 unsigned int ghash;
189
191 char * sha1;
192
196
198plugin_descriptor_new (void);
199
200const char *
201plugin_protocol_to_str (ZPluginProtocol prot);
202
204plugin_protocol_from_str (const char * str);
205
206static inline const char *
207plugin_protocol_get_icon_name (ZPluginProtocol prot)
208{
209 const char * icon = NULL;
210 switch (prot)
211 {
212 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_LV2:
213 icon = "logo-lv2";
214 break;
215 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_LADSPA:
216 icon = "logo-ladspa";
217 break;
218 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_AU:
219 icon = "logo-au";
220 break;
221 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_VST:
222 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_VST3:
223 icon = "logo-vst";
224 break;
225 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_SFZ:
226 case ZPluginProtocol::Z_PLUGIN_PROTOCOL_SF2:
227 icon = "file-music-line";
228 break;
229 default:
230 icon = "plug";
231 break;
232 }
233 return icon;
234}
235
236bool
237plugin_protocol_is_supported (ZPluginProtocol protocol);
238
239const char *
240plugin_category_to_string (ZPluginCategory category);
241
242CarlaBackend::PluginType
243plugin_descriptor_get_carla_plugin_type_from_protocol (ZPluginProtocol protocol);
244
246plugin_descriptor_get_protocol_from_carla_plugin_type (
247 CarlaBackend::PluginType ptype);
248
250plugin_descriptor_get_category_from_carla_category_str (const char * category);
251
253plugin_descriptor_get_category_from_carla_category (
254 CarlaBackend::PluginCategory carla_cat);
255
259NONNULL void
261
265NONNULL PluginDescriptor *
267
271NONNULL bool
273
277NONNULL bool
279
283NONNULL int
285
289NONNULL int
291
296NONNULL ZPluginCategory
298
299char *
300plugin_descriptor_category_to_string (ZPluginCategory category);
301
306const char *
308
313bool
315 const PluginDescriptor * self,
316 ZPluginSlotType slot_type,
317 TrackType track_type);
318
323NONNULL bool
325 const PluginDescriptor * a,
326 const PluginDescriptor * b);
327
332NONNULL bool
334
339NONNULL CarlaBridgeMode
341
352NONNULL bool
354
355NONNULL GMenuModel *
356plugin_descriptor_generate_context_menu (const PluginDescriptor * self);
357
358NONNULL void
359plugin_descriptor_free (PluginDescriptor * self);
360
361NONNULL void
362plugin_descriptor_free_closure (void * data, GClosure * closure);
363
368#endif
TrackType
The Track's type.
Definition track.h:82
NONNULL bool plugin_descriptor_is_same_plugin(const PluginDescriptor *a, const PluginDescriptor *b)
Returns whether the two descriptors describe the same plugin, ignoring irrelevant fields.
ZPluginArchitecture
32 or 64 bit.
NONNULL CarlaBridgeMode plugin_descriptor_get_min_bridge_mode(const PluginDescriptor *self)
Returns the minimum bridge mode required for this plugin.
NONNULL int plugin_descriptor_is_midi_modifier(const PluginDescriptor *const descr)
Returns if the Plugin is a midi modifier or not.
NONNULL bool plugin_descriptor_is_instrument(const PluginDescriptor *const descr)
Returns if the Plugin is an instrument or not.
NONNULL bool plugin_descriptor_is_whitelisted(const PluginDescriptor *self)
Returns whether the plugin is known to work, so it should be whitelisted.
CarlaBridgeMode
Carla bridge mode.
bool plugin_descriptor_is_valid_for_slot_type(const PluginDescriptor *self, ZPluginSlotType slot_type, TrackType track_type)
Returns if the given plugin identifier can be dropped in a slot of the given type.
NONNULL bool plugin_descriptor_is_effect(const PluginDescriptor *const descr)
Returns if the Plugin is an effect or not.
const char * plugin_descriptor_get_icon_name(const PluginDescriptor *const self)
Gets an appropriate icon name for the given descriptor.
ZPluginProtocol
Plugin protocol.
ZPluginCategory
Plugin category.
NONNULL void plugin_descriptor_copy(PluginDescriptor *dest, const PluginDescriptor *src)
Clones the plugin descriptor.
ZPluginSlotType
NONNULL PluginDescriptor * plugin_descriptor_clone(const PluginDescriptor *src)
Clones the plugin descriptor.
NONNULL ZPluginCategory plugin_descriptor_string_to_category(const char *str)
Returns the ZPluginCategory matching the given string.
NONNULL bool plugin_descriptor_has_custom_ui(const PluginDescriptor *self)
Returns if the Plugin has a supported custom UI.
NONNULL int plugin_descriptor_is_modulator(const PluginDescriptor *const descr)
Returns if the Plugin is a modulator or not.
@ Z_PLUGIN_PROTOCOL_DUMMY
Dummy protocol for tests.
@ Z_PLUGIN_CATEGORY_NONE
None specified.
CarlaBridgeMode min_bridge_mode
Minimum required bridge mode.
int num_midi_ins
Number of MIDI input ports.
int num_midi_outs
Number of MIDI output ports.
ZPluginProtocol protocol
Plugin protocol (Lv2/DSSI/LADSPA/VST/etc.).
int num_audio_outs
Number of audio output ports.
int num_cv_outs
Number of output CV ports.
char * category_str
Lv2 plugin subcategory.
WrappedObjectWithChangeSignal * gobj
Used in Gtk.
int num_ctrl_ins
Number of input control (plugin param) ports.
char * sha1
SHA1 of the file (replaces ghash).
char * path
Path, if not an Lv2Plugin which uses URIs.
unsigned int ghash
Hash of the plugin's bundle (.so/.ddl for VST) used when caching PluginDescriptor's,...
int num_ctrl_outs
Number of output control (plugin param) ports.
ZPluginArchitecture arch
Architecture (32/64bit).
int num_cv_ins
Number of input CV ports.
int64_t unique_id
Used for VST.
char * uri
Lv2Plugin URI.
int num_audio_ins
Number of audio input ports.
A GObject-ified normal C object with a signal that interested parties can listen to for changes.
Custom types.