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
17enum class 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};
30
112
113void
114mixer_selections_action_init_loaded (MixerSelectionsAction * self);
115
126WARN_UNUSED_RESULT UndoableAction *
127mixer_selections_action_new (
128 const MixerSelections * ms,
129 const PortConnectionsManager * connections_mgr,
130 MixerSelectionsActionType type,
131 ZPluginSlotType slot_type,
132 unsigned int to_track_name_hash,
133 int to_slot,
134 PluginSetting * setting,
135 int num_plugins,
136 int new_val,
137 CarlaBridgeMode new_bridge_mode,
138 GError ** error);
139
140#define mixer_selections_action_new_create( \
141 slot_type, to_tr, to_slot, setting, num_plugins, error) \
142 mixer_selections_action_new ( \
143 NULL, NULL, MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CREATE, \
144 slot_type, to_tr, to_slot, setting, num_plugins, 0, CarlaBridgeMode::None, \
145 error)
146
147#define mixer_selections_action_new_copy( \
148 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
149 mixer_selections_action_new ( \
150 ms, port_connections_mgr, \
151 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_COPY, slot_type, to_tr, \
152 to_slot, NULL, 0, 0, CarlaBridgeMode::None, error)
153
154#define mixer_selections_action_new_paste( \
155 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
156 mixer_selections_action_new ( \
157 ms, port_connections_mgr, \
158 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_PASTE, slot_type, \
159 to_tr, to_slot, NULL, 0, 0, CarlaBridgeMode::None, error)
160
161#define mixer_selections_action_new_move( \
162 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
163 mixer_selections_action_new ( \
164 ms, port_connections_mgr, \
165 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_MOVE, slot_type, to_tr, \
166 to_slot, NULL, 0, 0, CarlaBridgeMode::None, error)
167
168#define mixer_selections_action_new_delete(ms, port_connections_mgr, error) \
169 mixer_selections_action_new ( \
170 ms, port_connections_mgr, \
171 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_DELETE, 0, 0, 0, NULL, \
172 0, 0, CarlaBridgeMode::None, error)
173
174#define mixer_selections_action_new_change_status(ms, new_val, error) \
175 mixer_selections_action_new ( \
176 ms, NULL, MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CHANGE_STATUS, \
177 0, 0, 0, NULL, 0, new_val, CarlaBridgeMode::None, error)
178
179#define mixer_selections_action_new_change_load_behavior( \
180 ms, new_bridge_mode, error) \
181 mixer_selections_action_perform ( \
182 ms, NULL, \
183 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR, \
184 0, 0, 0, NULL, 0, 0, new_bridge_mode, error)
185
186NONNULL MixerSelectionsAction *
187mixer_selections_action_clone (const MixerSelectionsAction * src);
188
189bool
190mixer_selections_action_perform (
191 const MixerSelections * ms,
192 const PortConnectionsManager * connections_mgr,
193 MixerSelectionsActionType type,
194 ZPluginSlotType slot_type,
195 unsigned int to_track_name_hash,
196 int to_slot,
197 PluginSetting * setting,
198 int num_plugins,
199 int new_val,
200 CarlaBridgeMode new_bridge_mode,
201 GError ** error);
202
203#define mixer_selections_action_perform_create( \
204 slot_type, to_tr, to_slot, setting, num_plugins, error) \
205 mixer_selections_action_perform ( \
206 NULL, NULL, MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CREATE, \
207 slot_type, to_tr, to_slot, setting, num_plugins, 0, CarlaBridgeMode::None, \
208 error)
209
210#define mixer_selections_action_perform_copy( \
211 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
212 mixer_selections_action_perform ( \
213 ms, port_connections_mgr, \
214 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_COPY, slot_type, to_tr, \
215 to_slot, NULL, 0, 0, CarlaBridgeMode::None, error)
216
217#define mixer_selections_action_perform_paste( \
218 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
219 mixer_selections_action_perform ( \
220 ms, port_connections_mgr, \
221 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_PASTE, slot_type, \
222 to_tr, to_slot, NULL, 0, 0, CarlaBridgeMode::None, error)
223
224#define mixer_selections_action_perform_move( \
225 ms, port_connections_mgr, slot_type, to_tr, to_slot, error) \
226 mixer_selections_action_perform ( \
227 ms, port_connections_mgr, \
228 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_MOVE, slot_type, to_tr, \
229 to_slot, NULL, 0, 0, CarlaBridgeMode::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, \
234 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_DELETE, \
235 ENUM_INT_TO_VALUE (ZPluginSlotType, 0), 0, 0, NULL, 0, 0, \
236 CarlaBridgeMode::None, error)
237
238#define mixer_selections_action_perform_change_status(ms, new_val, error) \
239 mixer_selections_action_perform ( \
240 ms, NULL, MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CHANGE_STATUS, \
241 ENUM_INT_TO_VALUE (ZPluginSlotType, 0), 0, 0, NULL, 0, new_val, \
242 CarlaBridgeMode::None, error)
243
244#define mixer_selections_action_perform_change_load_behavior( \
245 ms, new_bridge_mode, error) \
246 mixer_selections_action_perform ( \
247 ms, NULL, \
248 MixerSelectionsActionType::MIXER_SELECTIONS_ACTION_CHANGE_LOAD_BEHAVIOR, \
249 ENUM_INT_TO_VALUE (ZPluginSlotType, 0), 0, 0, NULL, 0, 0, new_bridge_mode, \
250 error)
251
252int
253mixer_selections_action_do (MixerSelectionsAction * self, GError ** error);
254
255int
256mixer_selections_action_undo (MixerSelectionsAction * self, GError ** error);
257
258char *
259mixer_selections_action_stringize (MixerSelectionsAction * self);
260
261void
262mixer_selections_action_free (MixerSelectionsAction * self);
263
264#endif
Automation track.
CarlaBridgeMode
Carla bridge mode.
ZPluginSlotType
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.
ZPluginSlotType slot_type
Type of starting slot to move plugins to.
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.
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:177
Base struct to be inherited by implementing undoable actions.
Undoable actions.
YAML utils.