Zrythm v2.0.0-alpha.1
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 <span>
7
8#include "dsp/curve.h"
9#include "utils/midi.h"
10#include "utils/utf8_string.h"
11
12namespace zrythm::structure::arrangement
13{
14class MidiNote;
15
17{
18public:
19 enum class Type
20 {
21 Crescendo,
22 Flam,
23 FlipHorizontal,
24 FlipVertical,
25 Legato,
26 Portato,
27 Staccato,
28 Strum,
29 };
30
31 class Options
32 {
33 public:
34 midi_byte_t start_vel_ = 0;
35 midi_byte_t end_vel_ = 0;
36 midi_byte_t vel_ = 0;
37
38 bool ascending_ = true;
39 double time_ = 0;
40 double amount_ = 0;
41
42 dsp::CurveOptions::Algorithm curve_algo_{};
43 double curviness_{};
44 };
45
50
54 static auto string_id_to_type (const char * id) -> Type;
55
63 static void apply (std::span<MidiNote *> sel, Type type, Options opts);
64};
65}
Algorithm
The algorithm to use for curves.
Definition curve.h:33
static void apply(std::span< MidiNote * > sel, Type type, Options opts)
Applies the given action to the given selections.
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.
A MIDI note inside a Region shown in the piano roll.
Definition midi_note.h:23
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37
MIDI utils.
std::uint8_t midi_byte_t
MIDI byte.
Definition midi.h:43