13#include <nlohmann/json_fwd.hpp>
19enum class MusicalNote : std::uint8_t
34Q_ENUM_NS (MusicalNote)
39enum class ChordType : std::uint8_t
55enum class ChordAccent : std::uint8_t
73 FlatFifthSharpEleventh,
75 SharpFifthFlatThirteenth,
79Q_ENUM_NS (ChordAccent)
90 static constexpr size_t MAX_NOTES = 48;
93 ChordDescriptor () =
default;
111 int get_max_inversion ()
const
116 case ChordAccent::None:
118 case ChordAccent::Seventh:
119 case ChordAccent::MajorSeventh:
120 case ChordAccent::FlatNinth:
121 case ChordAccent::Ninth:
122 case ChordAccent::SharpNinth:
123 case ChordAccent::Eleventh:
126 case ChordAccent::FlatFifthSharpEleventh:
127 case ChordAccent::SharpFifthFlatThirteenth:
128 case ChordAccent::SixthThirteenth:
138 int get_min_inversion ()
const {
return -get_max_inversion (); }
182 operator== (
const ChordDescriptor &lhs,
const ChordDescriptor &rhs)
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
void update_notes()
Updates the notes array based on the current settings.
ChordAccent accent_
Chord accent.
MusicalNote root_note_
Root note.
int inversion_
0 no inversion, less than 0 highest note(s) drop an octave, greater than 0 lowest note(s) receive an ...
ChordType type_
Chord type.
utils::Utf8String to_string() const
Returns the chord in human readable string.
ChordDescriptor(MusicalNote root, bool has_bass, MusicalNote bass, ChordType type, ChordAccent accent, int inversion)
Creates a ChordDescriptor.
static utils::Utf8String chord_type_to_string(ChordType type)
Returns the chord type as a string (eg.
std::array< bool, MAX_NOTES > notes_
Only used if custom chord.
static utils::Utf8String note_to_string(MusicalNote note)
Returns the musical note as a string (eg.
MusicalNote bass_note_
Bass note 1 octave below.
bool is_key_bass(MusicalNote key) const
Returns if key is the bass or root note of chord.
bool is_key_in_chord(MusicalNote key) const
Returns if the given key is in the chord represented by the given ChordDescriptor.
static utils::Utf8String chord_accent_to_string(ChordAccent accent)
Returns the chord accent as a string (eg.
bool has_bass_
Has bass note or not.
Lightweight UTF-8 string wrapper with safe conversions.