Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
mixer_selections.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __GUI_BACKEND_MIXER_SELECTIONS_H__
11#define __GUI_BACKEND_MIXER_SELECTIONS_H__
12
14#include "dsp/channel.h"
15#include "dsp/midi_region.h"
16#include "dsp/region.h"
17#include "utils/yaml.h"
18
19typedef struct Plugin Plugin;
20
27#define MIXER_SELECTIONS_SCHEMA_VERSION 1
28
29#define MIXER_SELECTIONS (PROJECT->mixer_selections)
30
31#define MIXER_SELECTIONS_MAX_SLOTS 60
32
37typedef struct MixerSelections
38{
39 int schema_version;
40
41 PluginSlotType type;
42
44 int slots[MIXER_SELECTIONS_MAX_SLOTS];
45
47 Plugin * plugins[MIXER_SELECTIONS_MAX_SLOTS];
48
49 int num_slots;
50
52 unsigned int track_name_hash;
53
57
58static const cyaml_schema_field_t mixer_selections_fields_schema[] = {
59 YAML_FIELD_INT (MixerSelections, schema_version),
60 YAML_FIELD_ENUM (
62 type,
63 plugin_slot_type_strings),
66 slots,
67 int_schema),
68 CYAML_FIELD_SEQUENCE_COUNT (
69 "plugins",
70 CYAML_FLAG_DEFAULT,
72 plugins,
73 num_slots,
74 &plugin_schema,
75 0,
76 CYAML_UNLIMITED),
77 YAML_FIELD_UINT (MixerSelections, track_name_hash),
78 YAML_FIELD_INT (MixerSelections, has_any),
79
80 CYAML_FIELD_END
81};
82
83static const cyaml_schema_value_t mixer_selections_schema = {
86 mixer_selections_fields_schema),
87};
88
89void
90mixer_selections_init_loaded (
91 MixerSelections * ms,
92 bool is_project);
93
95mixer_selections_new (void);
96
97void
98mixer_selections_init (MixerSelections * self);
99
108 MixerSelections * src,
109 bool src_is_project);
110
114int
116
120int
122
126int
128
129void
130mixer_selections_post_deserialize (MixerSelections * self);
131
136NONNULL bool
138 MixerSelections * self,
139 Channel * ch,
140 PluginSlotType type,
141 int slot);
142
147NONNULL void
149 MixerSelections * ms,
150 Channel * ch,
151 PluginSlotType type,
152 int slot);
153
157Track *
159 const MixerSelections * const self);
160
164bool
166 MixerSelections * ms,
167 PluginSlotType type,
168 int slot);
169
173bool
175 MixerSelections * ms,
176 Plugin * pl);
177
178bool
179mixer_selections_contains_uninstantiated_plugin (
180 const MixerSelections * const self);
181
193void
195 MixerSelections * ms,
196 Track * track,
197 PluginSlotType type,
198 int slot,
199 bool clone_pl,
200 const bool fire_events);
201
208NONNULL void
210 MixerSelections * ms,
211 int slot,
212 PluginSlotType type,
213 bool publish_events);
214
220NONNULL void
222
227NONNULL Plugin *
229
234int
236 const MixerSelections * const self,
237 GPtrArray * arr,
238 bool from_cache);
239
240NONNULL bool
241mixer_selections_validate (MixerSelections * self);
242
246NONNULL void
248 MixerSelections * ms,
249 const int pub_events);
250
251NONNULL void
252mixer_selections_free (MixerSelections * self);
253
258#endif
Automation point API.
API for Channel, representing a channel strip on the mixer.
A region in the timeline.
Track * mixer_selections_get_track(const MixerSelections *const self)
Get current Track.
NONNULL Plugin * mixer_selections_get_first_plugin(MixerSelections *self)
Returns the first selected plugin if any is selected, otherwise NULL.
int mixer_selections_get_lowest_slot(MixerSelections *ms)
Gets lowest slot in the selections.
NONNULL void mixer_selections_remove_slot(MixerSelections *ms, int slot, PluginSlotType type, bool publish_events)
Removes a slot from the selections.
NONNULL void mixer_selections_paste_to_slot(MixerSelections *ms, Channel *ch, PluginSlotType type, int slot)
Paste the selections starting at the slot in the given channel.
bool mixer_selections_contains_slot(MixerSelections *ms, PluginSlotType type, int slot)
Returns if the slot is selected or not.
MixerSelections * mixer_selections_clone(MixerSelections *src, bool src_is_project)
Clone the struct for copying, undoing, etc.
NONNULL void mixer_selections_sort(MixerSelections *self, bool asc)
Sorts the selections by slot index.
int mixer_selections_has_any(MixerSelections *ms)
Returns if there are any selections.
bool mixer_selections_contains_plugin(MixerSelections *ms, Plugin *pl)
Returns if the plugin is selected or not.
NONNULL bool mixer_selections_can_be_pasted(MixerSelections *self, Channel *ch, PluginSlotType type, int slot)
Returns whether the selections can be pasted to MixerWidget.paste_slot.
void mixer_selections_add_slot(MixerSelections *ms, Track *track, PluginSlotType type, int slot, bool clone_pl, const bool fire_events)
Adds a slot to the selections.
NONNULL void mixer_selections_clear(MixerSelections *ms, const int pub_events)
Clears selections.
int mixer_selections_get_plugins(const MixerSelections *const self, GPtrArray *arr, bool from_cache)
Fills in the array with the plugins in the selections.
int mixer_selections_get_highest_slot(MixerSelections *ms)
Gets highest slot in the selections.
PluginSlotType
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:221
#define YAML_FIELD_FIXED_SIZE_PTR_ARRAY_VAR_COUNT(owner, member, schema)
Fixed-width array of pointers with variable count.
Definition yaml.h:60
API for Region's specific to instrument Track's.
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
Definition channel.h:63
Selections to be used for the timeline's current selections, copying, undoing, etc.
int slots[MIXER_SELECTIONS_MAX_SLOTS]
Slots selected.
Plugin * plugins[MIXER_SELECTIONS_MAX_SLOTS]
Cache, used in actions.
int has_any
Whether any slot is selected.
unsigned int track_name_hash
Channel selected.
The base plugin Inheriting plugins must have this as a child.
Definition plugin.h:72
Track to be inserted into the Project's Tracklist.
Definition track.h:193
YAML utils.