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 (MixerSelections, type, plugin_slot_type_strings),
62 CYAML_FIELD_SEQUENCE_COUNT (
63 "plugins",
64 CYAML_FLAG_DEFAULT,
66 plugins,
67 num_slots,
68 &plugin_schema,
69 0,
70 CYAML_UNLIMITED),
71 YAML_FIELD_UINT (MixerSelections, track_name_hash),
72 YAML_FIELD_INT (MixerSelections, has_any),
73
74 CYAML_FIELD_END
75};
76
77static const cyaml_schema_value_t mixer_selections_schema = {
78 YAML_VALUE_PTR (MixerSelections, mixer_selections_fields_schema),
79};
80
81void
82mixer_selections_init_loaded (MixerSelections * ms, bool is_project);
83
85mixer_selections_new (void);
86
87void
88mixer_selections_init (MixerSelections * self);
89
97mixer_selections_clone (const MixerSelections * src, bool src_is_project);
98
102int
104
108int
110
114int
116
117void
118mixer_selections_post_deserialize (MixerSelections * self);
119
124NONNULL bool
126 MixerSelections * self,
127 Channel * ch,
128 PluginSlotType type,
129 int slot);
130
135NONNULL void
137 MixerSelections * ms,
138 Channel * ch,
139 PluginSlotType type,
140 int slot);
141
145Track *
147
151bool
153 MixerSelections * ms,
154 PluginSlotType type,
155 int slot);
156
160bool
162
163bool
164mixer_selections_contains_uninstantiated_plugin (
165 const MixerSelections * const self);
166
178void
180 MixerSelections * ms,
181 Track * track,
182 PluginSlotType type,
183 int slot,
184 bool clone_pl,
185 const bool fire_events);
186
193NONNULL void
195 MixerSelections * ms,
196 int slot,
197 PluginSlotType type,
198 bool publish_events);
199
205NONNULL void
207
212NONNULL Plugin *
214
220int
222 const MixerSelections * const self,
223 GPtrArray * arr,
224 bool from_cache);
225
226NONNULL bool
227mixer_selections_validate (MixerSelections * self);
228
232NONNULL void
233mixer_selections_clear (MixerSelections * ms, const int pub_events);
234
235NONNULL void
236mixer_selections_free (MixerSelections * self);
237
242#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.
MixerSelections * mixer_selections_clone(const MixerSelections *src, bool src_is_project)
Clone the struct for copying, undoing, etc.
bool mixer_selections_contains_slot(MixerSelections *ms, PluginSlotType type, int slot)
Returns if the slot is selected or not.
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: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
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:61
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:71
Track to be inserted into the Project's Tracklist.
Definition track.h:186
YAML utils.