|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A ChordDescriptor describes a chord and is not linked to any specific object by itself. More...
#include <src/dsp/chord_descriptor.h>
Public Member Functions | |
| ChordDescriptor (MusicalNote root, bool has_bass, MusicalNote bass, ChordType type, ChordAccent accent, int inversion) | |
| Creates a ChordDescriptor. | |
| int | get_max_inversion () const |
| int | get_min_inversion () const |
| bool | is_key_in_chord (MusicalNote key) const |
| Returns if the given key is in the chord represented by the given ChordDescriptor. | |
| bool | is_key_bass (MusicalNote key) const |
| Returns if key is the bass or root note of chord. | |
| utils::Utf8String | to_string () const |
| Returns the chord in human readable string. | |
| void | update_notes () |
| Updates the notes array based on the current settings. | |
Static Public Member Functions | |
| static utils::Utf8String | chord_type_to_string (ChordType type) |
| Returns the chord type as a string (eg. | |
| static utils::Utf8String | chord_accent_to_string (ChordAccent accent) |
| Returns the chord accent as a string (eg. | |
| static utils::Utf8String | note_to_string (MusicalNote note) |
| Returns the musical note as a string (eg. | |
Data Fields | |
| bool | has_bass_ = false |
| Has bass note or not. | |
| MusicalNote | root_note_ = MusicalNote::C |
| Root note. | |
| MusicalNote | bass_note_ = MusicalNote::C |
| Bass note 1 octave below. | |
| ChordType | type_ = ChordType::None |
| Chord type. | |
| ChordAccent | accent_ = ChordAccent::None |
| Chord accent. | |
| std::array< bool, MAX_NOTES > | notes_ {} |
| Only used if custom chord. | |
| int | inversion_ = 0 |
| 0 no inversion, less than 0 highest note(s) drop an octave, greater than 0 lowest note(s) receive an octave. | |
Static Public Attributes | |
| static constexpr size_t | MAX_NOTES = 48 |
Friends | |
| bool | operator== (const ChordDescriptor &lhs, const ChordDescriptor &rhs) |
| void | to_json (nlohmann::json &j, const ChordDescriptor &c) |
| void | from_json (const nlohmann::json &j, ChordDescriptor &c) |
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
Chord objects should include a ChordDescriptor.
Definition at line 87 of file chord_descriptor.h.
|
inline |
Creates a ChordDescriptor.
Definition at line 98 of file chord_descriptor.h.
|
static |
Returns the chord accent as a string (eg.
"j7").
|
static |
Returns the chord type as a string (eg.
"aug").
|
inline |
Definition at line 111 of file chord_descriptor.h.
|
inline |
Definition at line 138 of file chord_descriptor.h.
| bool zrythm::dsp::ChordDescriptor::is_key_bass | ( | MusicalNote | key | ) | const |
Returns if key is the bass or root note of chord.
| key | A note inside a single octave (0-11). |
| bool zrythm::dsp::ChordDescriptor::is_key_in_chord | ( | MusicalNote | key | ) | const |
Returns if the given key is in the chord represented by the given ChordDescriptor.
| key | A note inside a single octave (0-11). |
|
static |
Returns the musical note as a string (eg.
"C3").
|
friend |
Definition at line 182 of file chord_descriptor.h.
| ChordAccent zrythm::dsp::ChordDescriptor::accent_ = ChordAccent::None |
| MusicalNote zrythm::dsp::ChordDescriptor::bass_note_ = MusicalNote::C |
Bass note 1 octave below.
Definition at line 201 of file chord_descriptor.h.
| bool zrythm::dsp::ChordDescriptor::has_bass_ = false |
Has bass note or not.
Definition at line 195 of file chord_descriptor.h.
| int zrythm::dsp::ChordDescriptor::inversion_ = 0 |
0 no inversion, less than 0 highest note(s) drop an octave, greater than 0 lowest note(s) receive an octave.
Definition at line 228 of file chord_descriptor.h.
|
staticconstexpr |
Definition at line 90 of file chord_descriptor.h.
| std::array<bool, MAX_NOTES> zrythm::dsp::ChordDescriptor::notes_ {} |
Only used if custom chord.
4 octaves, 1st octave is where bass note is, but bass note should not be part of this.
Starts at C always, from MIDI pitch 36.
Definition at line 221 of file chord_descriptor.h.
| MusicalNote zrythm::dsp::ChordDescriptor::root_note_ = MusicalNote::C |
Root note.
Definition at line 198 of file chord_descriptor.h.
| ChordType zrythm::dsp::ChordDescriptor::type_ = ChordType::None |
Chord type.
Definition at line 204 of file chord_descriptor.h.