Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_function.h
1// SPDX-FileCopyrightText: © 2020, 2023-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/curve.h"
7#include "structure/arrangement/arranger_object_span.h"
8#include "utils/format.h"
9#include "utils/types.h"
10
11namespace zrythm::structure::arrangement
12{
14{
15public:
16 enum class Type
17 {
18 Crescendo,
19 Flam,
20 FlipHorizontal,
21 FlipVertical,
22 Legato,
23 Portato,
24 Staccato,
25 Strum,
26 };
27
28 class Options
29 {
30 public:
31 midi_byte_t start_vel_ = 0;
32 midi_byte_t end_vel_ = 0;
33 midi_byte_t vel_ = 0;
34
35 bool ascending_ = true;
36 double time_ = 0;
37 double amount_ = 0;
38
39 dsp::CurveOptions::Algorithm curve_algo_{};
40 double curviness_{};
41 };
42
47
51 static auto string_id_to_type (const char * id) -> Type;
52
60 static void apply (ArrangerObjectSpan sel, Type type, Options opts);
61};
62}
63DEFINE_ENUM_FORMATTER (
64 zrythm::structure::arrangement::MidiFunction::Type,
65 MidiFunctionType,
66 QT_TR_NOOP_UTF8 ("Crescendo"),
67 QT_TR_NOOP_UTF8 ("Flam"),
68 QT_TR_NOOP_UTF8 ("Flip H"),
69 QT_TR_NOOP_UTF8 ("Flip V"),
70 QT_TR_NOOP_UTF8 ("Legato"),
71 QT_TR_NOOP_UTF8 ("Portato"),
72 QT_TR_NOOP_UTF8 ("Staccato"),
73 QT_TR_NOOP_UTF8 ("Strum"));
Algorithm
The algorithm to use for curves.
Definition curve.h:32
Track span that offers helper methods on a range of tracks.
static utils::Utf8String type_to_string_id(Type type)
Returns a string identifier for the type.
static auto string_id_to_type(const char *id) -> Type
Returns a string identifier for the type.
static void apply(ArrangerObjectSpan sel, Type type, Options opts)
Applies the given action to the given selections.
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:38
uint8_t midi_byte_t
MIDI byte.
Definition types.h:55