Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_function.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020, 2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
12#ifndef __AUDIO_MIDI_FUNCTION_H__
13#define __AUDIO_MIDI_FUNCTION_H__
14
15#include "dsp/curve.h"
16#include "utils/types.h"
17#include "utils/yaml.h"
18
19#include <glib/gi18n.h>
20
22
29enum class MidiFunctionType
30{
31 MIDI_FUNCTION_CRESCENDO,
32 MIDI_FUNCTION_FLAM,
33 MIDI_FUNCTION_FLIP_HORIZONTAL,
34 MIDI_FUNCTION_FLIP_VERTICAL,
35 MIDI_FUNCTION_LEGATO,
36 MIDI_FUNCTION_PORTATO,
37 MIDI_FUNCTION_STACCATO,
38 MIDI_FUNCTION_STRUM,
39};
40
41typedef struct MidiFunctionOpts
42{
43 midi_byte_t start_vel;
44 midi_byte_t end_vel;
45 midi_byte_t vel;
46
47 bool ascending;
48 double time;
49 double amount;
50
51 CurveAlgorithm curve_algo;
52 double curviness;
53
55
56static inline const char *
57midi_function_type_to_string (MidiFunctionType type)
58{
59 static const char * midi_function_type_strings[] = {
60 N_ ("Crescendo"), N_ ("Flam"), N_ ("Flip H"), N_ ("Flip V"),
61 N_ ("Legato"), N_ ("Portato"), N_ ("Staccato"), N_ ("Strum"),
62 };
63
64 return midi_function_type_strings[static_cast<int> (type)];
65}
66
70char *
71midi_function_type_to_string_id (MidiFunctionType type);
72
76MidiFunctionType
78
85int
88 MidiFunctionType type,
90 GError ** error);
91
96#endif
Curves.
int midi_function_apply(ArrangerSelections *sel, MidiFunctionType type, MidiFunctionOpts opts, GError **error)
Applies the given action to the given selections.
CurveAlgorithm
The algorithm to use for curves.
Definition curve.h:40
MidiFunctionType midi_function_string_id_to_type(const char *id)
Returns a string identifier for the type.
char * midi_function_type_to_string_id(MidiFunctionType type)
Returns a string identifier for the type.
uint8_t midi_byte_t
MIDI byte.
Definition types.h:36
Custom types.
YAML utils.