Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
plugin_settings.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2021-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __SETTINGS_PLUGIN_SETTINGS_H__
11#define __SETTINGS_PLUGIN_SETTINGS_H__
12
13#include "zrythm-config.h"
14
15#include <stdbool.h>
16
18#include "utils/yaml.h"
19
26#define PLUGIN_SETTING_SCHEMA_VERSION 2
27#define PLUGIN_SETTINGS_SCHEMA_VERSION 5
28
32typedef struct PluginSetting
33{
34 int schema_version;
35
39
42
45
48
52 char * ui_uri;
53
57
61
62static const cyaml_schema_field_t plugin_setting_fields_schema[] = {
63 YAML_FIELD_INT (PluginSetting, schema_version),
64 YAML_FIELD_MAPPING_PTR (PluginSetting, descr, plugin_descriptor_fields_schema),
65 YAML_FIELD_INT (PluginSetting, open_with_carla),
66 YAML_FIELD_INT (PluginSetting, force_generic_ui),
67 YAML_FIELD_ENUM (PluginSetting, bridge_mode, carla_bridge_mode_strings),
68 YAML_FIELD_STRING_PTR_OPTIONAL (PluginSetting, ui_uri),
69 YAML_FIELD_INT_OPT (PluginSetting, last_instantiated_time),
70 YAML_FIELD_INT_OPT (PluginSetting, num_instantiations),
71
72 CYAML_FIELD_END
73};
74
75static const cyaml_schema_value_t plugin_setting_schema = {
76 YAML_VALUE_PTR (PluginSetting, plugin_setting_fields_schema),
77};
78
79typedef struct PluginSettings
80{
81 int schema_version;
82
85 int num_settings;
87
88static const cyaml_schema_field_t plugin_settings_fields_schema[] = {
89 YAML_FIELD_INT (PluginSettings, schema_version),
92 settings,
93 plugin_setting_schema),
94
95 CYAML_FIELD_END
96};
97
98static const cyaml_schema_value_t plugin_settings_schema = {
99 YAML_VALUE_PTR (PluginSettings, plugin_settings_fields_schema),
100};
101
107PluginSetting * NONNULL
109
110PluginSetting * NONNULL
111plugin_setting_clone (const PluginSetting * src, bool validate);
112
113bool
114plugin_setting_is_equal (const PluginSetting * a, const PluginSetting * b);
115
125NONNULL void
126plugin_setting_validate (PluginSetting * self, bool print_result);
127
128NONNULL void
129plugin_setting_print (const PluginSetting * self);
130
137NONNULL void
139
146NONNULL void
148
152NONNULL void
154
155void
156plugin_setting_free_closure (void * self, GClosure * closure);
157
163
167NONNULL void
169
175NONNULL PluginSetting *
177
187NONNULL void
189 PluginSettings * self,
190 PluginSetting * setting,
191 bool _serialize);
192
193NONNULL void
194plugin_settings_free (PluginSettings * self);
195
200#endif
CarlaBridgeMode
Carla bridge mode.
NONNULL PluginSetting * plugin_settings_find(PluginSettings *self, const PluginDescriptor *descr)
Finds a setting for the given plugin descriptor.
NONNULL void plugin_setting_validate(PluginSetting *self, bool print_result)
Makes sure the setting is valid in the current run and changes any fields to make it conform.
NONNULL void plugin_setting_increment_num_instantiations(PluginSetting *self)
Increments the number of times this plugin has been instantiated.
NONNULL void plugin_setting_activate(const PluginSetting *self)
Creates necessary tracks at the end of the tracklist.
PluginSetting *NONNULL plugin_setting_new_default(const PluginDescriptor *descr)
Creates a plugin setting with the recommended settings for the given plugin descriptor based on the c...
PluginSettings * plugin_settings_new(void)
Reads the file and fills up the object.
NONNULL void plugin_settings_serialize_to_file(PluginSettings *self)
Serializes the current settings.
NONNULL void plugin_setting_free(PluginSetting *self)
Frees the plugin setting.
NONNULL void plugin_settings_set(PluginSettings *self, PluginSetting *setting, bool _serialize)
Replaces a setting or appends a setting to the cache.
#define YAML_FIELD_MAPPING_PTR(owner, member, schema)
Mapping pointer to a struct.
Definition yaml.h:37
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:202
#define YAML_FIELD_FIXED_SIZE_PTR_ARRAY_VAR_COUNT(owner, member, schema)
Fixed-width array of pointers with variable count.
Definition yaml.h:55
A setting for a specific plugin descriptor.
CarlaBridgeMode bridge_mode
Requested carla bridge mode.
bool open_with_carla
Whether to instantiate this plugin with carla.
bool force_generic_ui
Whether to force a generic UI.
char * ui_uri
Requested UI URI (if LV2 and non-bridged and not forcing a generic UI and have a custom UI.
int num_instantiations
Number of times this plugin has been instantiated.
gint64 last_instantiated_time
Last datetime instantiated (number of microseconds since January 1, 1970 UTC).
PluginDescriptor * descr
The descriptor of the plugin this setting is for.
PluginSetting * settings[90000]
Settings.
YAML utils.