Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
transport_action.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __ACTIONS_TRANSPORT_ACTION_H__
11#define __ACTIONS_TRANSPORT_ACTION_H__
12
13#include <stdbool.h>
14
16#include "dsp/transport.h"
17#include "utils/types.h"
18#include "utils/yaml.h"
19
26typedef enum TransportActionType
27{
28 TRANSPORT_ACTION_BPM_CHANGE,
29 TRANSPORT_ACTION_BEATS_PER_BAR_CHANGE,
30 TRANSPORT_ACTION_BEAT_UNIT_CHANGE,
31} TransportActionType;
32
33static const cyaml_strval_t transport_action_type_strings[] = {
34 {"BPM change", TRANSPORT_ACTION_BPM_CHANGE },
35 { "beats per bar change", TRANSPORT_ACTION_BEATS_PER_BAR_CHANGE},
36 { "beat unit change", TRANSPORT_ACTION_BEAT_UNIT_CHANGE },
37};
38
42typedef struct TransportAction
43{
44 UndoableAction parent_instance;
45
46 TransportActionType type;
47
48 bpm_t bpm_before;
49 bpm_t bpm_after;
50
51 int int_before;
52 int int_after;
53
57
62
63void
64transport_action_init_loaded (TransportAction * self);
65
66WARN_UNUSED_RESULT UndoableAction *
67transport_action_new_bpm_change (
68 bpm_t bpm_before,
69 bpm_t bpm_after,
70 bool already_done,
71 GError ** error);
72
73WARN_UNUSED_RESULT UndoableAction *
74transport_action_new_time_sig_change (
75 TransportActionType type,
76 int before,
77 int after,
78 bool already_done,
79 GError ** error);
80
81NONNULL TransportAction *
82transport_action_clone (const TransportAction * src);
83
84bool
85transport_action_perform_bpm_change (
86 bpm_t bpm_before,
87 bpm_t bpm_after,
88 bool already_done,
89 GError ** error);
90
91bool
92transport_action_perform_time_sig_change (
93 TransportActionType type,
94 int before,
95 int after,
96 bool already_done,
97 GError ** error);
98
99int
100transport_action_do (TransportAction * self, GError ** error);
101
102int
103transport_action_undo (TransportAction * self, GError ** error);
104
105char *
106transport_action_stringize (TransportAction * self);
107
108void
109transport_action_free (TransportAction * self);
110
115#endif
float bpm_t
The BPM type.
Definition types.h:50
Transport action.
bool musical_mode
Whether musical mode was enabled when this action was made.
bool already_done
Flag whether the action was already performed the first time.
Base struct to be inherited by implementing undoable actions.
Transport API.
Custom types.
Undoable actions.
YAML utils.