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
29typedef enum 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} MidiFunctionType;
40
41static const cyaml_strval_t midi_function_type_strings[] = {
42 {N_ ("Crescendo"), MIDI_FUNCTION_CRESCENDO },
43 { N_ ("Flam"), MIDI_FUNCTION_FLAM },
44 { N_ ("Flip H"), MIDI_FUNCTION_FLIP_HORIZONTAL},
45 { N_ ("Flip V"), MIDI_FUNCTION_FLIP_VERTICAL },
46 { N_ ("Legato"), MIDI_FUNCTION_LEGATO },
47 { N_ ("Portato"), MIDI_FUNCTION_PORTATO },
48 { N_ ("Staccato"), MIDI_FUNCTION_STACCATO },
49 { N_ ("Strum"), MIDI_FUNCTION_STRUM },
50};
51
52typedef struct MidiFunctionOpts
53{
54 midi_byte_t start_vel;
55 midi_byte_t end_vel;
56 midi_byte_t vel;
57
58 bool ascending;
59 double time;
60 double amount;
61
62 CurveAlgorithm curve_algo;
63 double curviness;
64
66
67static inline const char *
68midi_function_type_to_string (MidiFunctionType type)
69{
70 return midi_function_type_strings[type].str;
71}
72
76char *
77midi_function_type_to_string_id (MidiFunctionType type);
78
82MidiFunctionType
84
91int
94 MidiFunctionType type,
96 GError ** error);
97
102#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:32
Custom types.
YAML utils.