|
MCC
|
A chord pattern spelled from a root note name. More...
#include <Chord.h>

Public Member Functions | |
| constexpr | Chord () noexcept |
| Creates the invalid chord (SPEC-ERR-2). | |
| constexpr | Chord (NoteName root, ChordPattern pattern) noexcept |
| Spells pattern from root; invalid when either is invalid. | |
| constexpr bool | IsValid () const noexcept |
| Returns true unless this is the invalid chord. | |
| constexpr NoteName | Root () const noexcept |
| Returns the root note name. | |
| constexpr ChordPattern | Pattern () const noexcept |
| Returns the root-independent pattern. | |
| MCC_CONSTEXPR14 uint8_t | ToneCount () const noexcept |
| Returns the number of tones, or 0 for the invalid chord. | |
| MCC_CONSTEXPR14 NoteName | ToneAt (int32_t tone) const noexcept |
| Returns the note name of tone (1-based), or the invalid note name outside the chord or when it cannot be spelled. | |
| MCC_CONSTEXPR14 MCC::Pitch | PitchAt (int32_t tone, int32_t rootOctave) const noexcept |
| Returns the root-position pitch of tone when the root is placed in rootOctave; extensions keep their compound distance. | |
| MCC_CONSTEXPR14 bool | Contains (NoteName noteName) const noexcept |
| Returns true when a tone is written exactly as noteName. | |
| MCC_CONSTEXPR14 bool | ContainsPitchClass (MCC::PitchClass pitchClass) const noexcept |
| Returns true when any tone sounds as pitchClass, regardless of spelling (explicit enharmonic membership, SPEC-EQ-2). | |
| size_t | Voicing (int32_t inversion, int32_t rootOctave, MCC::Pitch *pitches, size_t capacity) const noexcept |
| Writes a close-position voicing of inversion into pitches. | |
Static Public Member Functions | |
| static constexpr Chord | Invalid () noexcept |
| Returns the invalid chord. | |
Friends | |
| constexpr bool | operator== (const Chord &a, const Chord &b) noexcept |
| Compares roots by spelling and patterns by tones. | |
| constexpr bool | operator!= (const Chord &a, const Chord &b) noexcept |
| Negation of operator==. | |
A chord pattern spelled from a root note name.
Tones are 1-based in root-position order. Each tone is the root transposed by the pattern's interval, so E major contains G# and the ninth of C9 is D (SPEC-CHD-2). A tone whose spelling would need an accidental outside [-4, +4] is the invalid note name (SPEC-ACC-3).
Membership is written by default (Contains) and enharmonic only on request (ContainsPitchClass), following SPEC-EQ-1..2.
|
inlinenoexcept |
Writes a close-position voicing of inversion into pitches.
Inversion 0 is root position; inversion k places tone k + 1 in the bass with the root in rootOctave, and raises each earlier tone by whole octaves until it lies above the previous pitch (SPEC-CHD-3). Writes at most capacity pitches and returns the number the voicing needs, or 0 for an invalid chord or an inversion outside [0, ToneCount() - 1].