Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_editor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __GUI_BACKEND_CHORD_EDITOR_H__
11#define __GUI_BACKEND_CHORD_EDITOR_H__
12
14#include "dsp/scale.h"
16#include "utils/yaml.h"
17
18typedef struct ChordDescriptor ChordDescriptor;
19typedef struct ChordPreset ChordPreset;
20
27#define CHORD_EDITOR_SCHEMA_VERSION 1
28
29#define CHORD_EDITOR (CLIP_EDITOR->chord_editor)
30
31#define CHORD_EDITOR_NUM_CHORDS 12
32
36typedef struct ChordEditor
37{
38 int schema_version;
39
47 int num_chords;
48
49 EditorSettings editor_settings;
51
52static const cyaml_schema_field_t chord_editor_fields_schema[] = {
53 YAML_FIELD_INT (ChordEditor, schema_version),
56 chords,
57 chord_descriptor_schema),
60 editor_settings,
61 editor_settings_fields_schema),
62
63 CYAML_FIELD_END
64};
65
66static const cyaml_schema_value_t chord_editor_schema = {
67 CYAML_VALUE_MAPPING (CYAML_FLAG_POINTER, ChordEditor, chord_editor_fields_schema),
68};
69
74void
76
80void
82
84chord_editor_clone (ChordEditor * src);
85
86void
87chord_editor_apply_single_chord (
88 ChordEditor * self,
89 const ChordDescriptor * chord,
90 const int idx,
91 bool undoable);
92
93void
94chord_editor_apply_chords (
95 ChordEditor * self,
96 const ChordDescriptor ** chords,
97 bool undoable);
98
99void
100chord_editor_apply_preset (ChordEditor * self, ChordPreset * pset, bool undoable);
101
102void
103chord_editor_apply_preset_from_scale (
104 ChordEditor * self,
105 MusicalScaleType scale,
106 MusicalNote root_note,
107 bool undoable);
108
109void
110chord_editor_transpose_chords (ChordEditor * self, bool up, bool undoable);
111
117NONNULL ChordDescriptor *
119 const ChordEditor * self,
120 midi_byte_t note_number);
121
122NONNULL int
123chord_editor_get_chord_index (
124 const ChordEditor * self,
125 const ChordDescriptor * chord);
126
128chord_editor_new (void);
129
130void
131chord_editor_free (ChordEditor * self);
132
137#endif
Descriptors for chords.
Common editor settings.
MusicalScaleType
Scale type (name) eg Aeolian.
Definition scale.h:33
void chord_editor_init_loaded(ChordEditor *self)
Inits the ChordEditor after a Project has been loaded.
void chord_editor_init(ChordEditor *self)
Initializes the ChordEditor.
NONNULL ChordDescriptor * chord_editor_get_chord_from_note_number(const ChordEditor *self, midi_byte_t note_number)
Returns the ChordDescriptor for the given note number, otherwise NULL if the given note number is not...
#define YAML_FIELD_MAPPING_EMBEDDED(owner, member, schema)
Mapping embedded inside the struct.
Definition yaml.h:31
uint8_t midi_byte_t
MIDI byte.
Definition types.h:32
#define YAML_FIELD_FIXED_SIZE_PTR_ARRAY_VAR_COUNT(owner, member, schema)
Fixed-width array of pointers with variable count.
Definition yaml.h:55
Musical scales.
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
Backend for the chord editor.
ChordDescriptor * chords[128]
The chords to show on the left.
A preset of chord descriptors.
Common editor settings.
YAML utils.