Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
mixer_selections_action.h
1// SPDX-FileCopyrightText: © 2019-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __UNDO_MIXER_SELECTIONS_ACTION_H__
5#define __UNDO_MIXER_SELECTIONS_ACTION_H__
6
11#include "utils/yaml.h"
12
13typedef struct Plugin Plugin;
14typedef struct Track Track;
15typedef struct MixerSelections MixerSelections;
16
17typedef enum MixerSelectionsActionType
18{
20 MIXER_SELECTIONS_ACTION_COPY,
22 MIXER_SELECTIONS_ACTION_PASTE,
24 MIXER_SELECTIONS_ACTION_CREATE,
25 MIXER_SELECTIONS_ACTION_DELETE,
26 MIXER_SELECTIONS_ACTION_MOVE,
27 MIXER_SELECTIONS_ACTION_CHANGE_STATUS,
28 MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR,
29} MixerSelectionsActionType;
30
31static const cyaml_strval_t mixer_selections_action_type_strings[] = {
32 {"Copy", MIXER_SELECTIONS_ACTION_COPY },
33 { "Paste", MIXER_SELECTIONS_ACTION_PASTE },
34 { "Create", MIXER_SELECTIONS_ACTION_CREATE },
35 { "Delete", MIXER_SELECTIONS_ACTION_DELETE },
36 { "Move", MIXER_SELECTIONS_ACTION_MOVE },
37 { "Change Status", MIXER_SELECTIONS_ACTION_CHANGE_STATUS },
38 { "Change Load Behavior", MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR},
39};
40
122
123void
124mixer_selections_action_init_loaded (MixerSelectionsAction * self);
125
136WARN_UNUSED_RESULT UndoableAction *
137mixer_selections_action_new (
138 const MixerSelections * ms,
139 const PortConnectionsManager * connections_mgr,
140 MixerSelectionsActionType type,
141 PluginSlotType slot_type,
142 unsigned int to_track_name_hash,
143 int to_slot,
144 PluginSetting * setting,
145 int num_plugins,
146 int new_val,
147 CarlaBridgeMode new_bridge_mode,
148 GError ** error);
149
150#define mixer_selections_action_new_create( \
151 slot_type, to_tr, to_slot, setting, num_plugins, error) \
152 mixer_selections_action_new ( \
153 NULL, NULL, MIXER_SELECTIONS_ACTION_CREATE, slot_type, to_tr, to_slot, \
154 setting, num_plugins, 0, CARLA_BRIDGE_NONE, error)
155
156#define mixer_selections_action_new_copy( \
157 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
158 mixer_selections_action_new ( \
159 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_COPY, slot_type, to_tr, \
160 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
161
162#define mixer_selections_action_new_paste( \
163 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
164 mixer_selections_action_new ( \
165 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_PASTE, slot_type, to_tr, \
166 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
167
168#define mixer_selections_action_new_move( \
169 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
170 mixer_selections_action_new ( \
171 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_MOVE, slot_type, to_tr, \
172 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
173
174#define mixer_selections_action_new_delete(ms, port_connections_mgr, error) \
175 mixer_selections_action_new ( \
176 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_DELETE, 0, 0, 0, NULL, \
177 0, 0, CARLA_BRIDGE_NONE, error)
178
179#define mixer_selections_action_new_change_status(ms, new_val, error) \
180 mixer_selections_action_new ( \
181 ms, NULL, MIXER_SELECTIONS_ACTION_CHANGE_STATUS, 0, 0, 0, NULL, 0, \
182 new_val, CARLA_BRIDGE_NONE, error)
183
184#define mixer_selections_action_new_change_load_behavior( \
185 ms, new_bridge_mode, error) \
186 mixer_selections_action_perform ( \
187 ms, NULL, MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR, 0, 0, 0, NULL, 0, \
188 0, new_bridge_mode, error)
189
190NONNULL MixerSelectionsAction *
191mixer_selections_action_clone (const MixerSelectionsAction * src);
192
193bool
194mixer_selections_action_perform (
195 const MixerSelections * ms,
196 const PortConnectionsManager * connections_mgr,
197 MixerSelectionsActionType type,
198 PluginSlotType slot_type,
199 unsigned int to_track_name_hash,
200 int to_slot,
201 PluginSetting * setting,
202 int num_plugins,
203 int new_val,
204 CarlaBridgeMode new_bridge_mode,
205 GError ** error);
206
207#define mixer_selections_action_perform_create( \
208 slot_type, to_tr, to_slot, setting, num_plugins, error) \
209 mixer_selections_action_perform ( \
210 NULL, NULL, MIXER_SELECTIONS_ACTION_CREATE, slot_type, to_tr, to_slot, \
211 setting, num_plugins, 0, CARLA_BRIDGE_NONE, error)
212
213#define mixer_selections_action_perform_copy( \
214 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
215 mixer_selections_action_perform ( \
216 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_COPY, slot_type, to_tr, \
217 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
218
219#define mixer_selections_action_perform_paste( \
220 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
221 mixer_selections_action_perform ( \
222 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_PASTE, slot_type, to_tr, \
223 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
224
225#define mixer_selections_action_perform_move( \
226 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
227 mixer_selections_action_perform ( \
228 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_MOVE, slot_type, to_tr, \
229 to_slot, NULL, 0, 0, CARLA_BRIDGE_NONE, error)
230
231#define mixer_selections_action_perform_delete(ms, port_connections_mgr, error) \
232 mixer_selections_action_perform ( \
233 ms, port_connections_mgr, MIXER_SELECTIONS_ACTION_DELETE, 0, 0, 0, NULL, \
234 0, 0, CARLA_BRIDGE_NONE, error)
235
236#define mixer_selections_action_perform_change_status(ms, new_val, error) \
237 mixer_selections_action_perform ( \
238 ms, NULL, MIXER_SELECTIONS_ACTION_CHANGE_STATUS, 0, 0, 0, NULL, 0, \
239 new_val, CARLA_BRIDGE_NONE, error)
240
241#define mixer_selections_action_perform_change_load_behavior( \
242 ms, new_bridge_mode, error) \
243 mixer_selections_action_perform ( \
244 ms, NULL, MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR, 0, 0, 0, NULL, 0, \
245 0, new_bridge_mode, error)
246
247int
248mixer_selections_action_do (MixerSelectionsAction * self, GError ** error);
249
250int
251mixer_selections_action_undo (MixerSelectionsAction * self, GError ** error);
252
253char *
254mixer_selections_action_stringize (MixerSelectionsAction * self);
255
256void
257mixer_selections_action_free (MixerSelectionsAction * self);
258
259#endif
Automation track.
CarlaBridgeMode
Carla bridge mode.
PluginSlotType
Mixer selections.
Port connections manager.
Restrict selections to a channel.
CarlaBridgeMode new_bridge_mode
Used when changing load behavior.
unsigned int to_track_name_hash
To track position.
PluginSetting * setting
PluginSetting to use when creating.
bool new_channel
Whether the plugins will be copied/moved into a new channel, if applicable.
AutomationTrack * ats[16000]
Automation tracks associated with the plugins.
PortConnectionsManager * connections_mgr_after
A clone of the port connections after applying the action.
MixerSelections * deleted_ms
Deleted plugins (ie, plugins replaced during move/copy).
MixerSelections * ms_before
Clone of mixer selections at start.
PortConnectionsManager * connections_mgr_before
A clone of the port connections at the start of the action.
AutomationTrack * deleted_ats[16000]
Automation tracks associated with the deleted plugins.
int new_val
Used when changing status.
int to_slot
Starting target slot.
PluginSlotType slot_type
Type of starting slot to move plugins to.
int num_plugins
Number of plugins to create, when creating new plugins.
Selections to be used for the timeline's current selections, copying, undoing, etc.
A setting for a specific plugin descriptor.
The base plugin Inheriting plugins must have this as a child.
Definition plugin.h:74
Port connections manager.
Track to be inserted into the Project's Tracklist.
Definition track.h:186
Base struct to be inherited by implementing undoable actions.
Undoable actions.
YAML utils.