MCC
Loading...
Searching...
No Matches
MCC::Scale Class Reference

A scale pattern spelled from a root note name. More...

#include <Scale.h>

Collaboration diagram for MCC::Scale:
Collaboration graph

Public Member Functions

constexpr Scale () noexcept
 Creates the invalid scale (SPEC-ERR-2).
constexpr Scale (NoteName root, ScalePattern pattern) noexcept
 Spells pattern from root; invalid when either is invalid.
constexpr bool IsValid () const noexcept
 Returns true unless this is the invalid scale.
constexpr NoteName Root () const noexcept
 Returns the root note name.
constexpr ScalePattern Pattern () const noexcept
 Returns the root-independent pattern.
MCC_CONSTEXPR14 uint8_t DegreeCount () const noexcept
 Returns the number of degrees, or 0 for the invalid scale.
MCC_CONSTEXPR14 NoteName NoteAt (int32_t degree) const noexcept
 Returns the note name of degree (1-based), or the invalid note name outside the scale or when it cannot be spelled.
MCC_CONSTEXPR14 MCC::Pitch PitchAt (int32_t degree, int32_t rootOctave) const noexcept
 Returns the pitch of degree when the root is placed in rootOctave; degrees above the root may fall in the next octave.
MCC_CONSTEXPR14 uint8_t DegreeOf (NoteName noteName) const noexcept
 Returns the 1-based degree written exactly as noteName, or 0 when no degree has that spelling.
MCC_CONSTEXPR14 bool Contains (NoteName noteName) const noexcept
 Returns true when a degree is written exactly as noteName.
constexpr bool ContainsPitchClass (MCC::PitchClass pitchClass) const noexcept
 Returns true when any degree sounds as pitchClass, regardless of spelling (explicit enharmonic membership, SPEC-EQ-2).

Static Public Member Functions

static constexpr Scale Invalid () noexcept
 Returns the invalid scale.

Friends

constexpr bool operator== (const Scale &a, const Scale &b) noexcept
 Compares roots by spelling and patterns by degrees.
constexpr bool operator!= (const Scale &a, const Scale &b) noexcept
 Negation of operator==.

Detailed Description

A scale pattern spelled from a root note name.

Degrees are 1-based. Each degree is the root transposed by the pattern's interval, so spelling follows the pattern (SPEC-SCL-2): E major contains G#, never Ab. A degree whose spelling would need an accidental outside [-4, +4] is the invalid note name (SPEC-ACC-3, SPEC-SCL-3).

Membership is written by default (Contains) and enharmonic only on request (ContainsPitchClass), following SPEC-EQ-1..2.


The documentation for this class was generated from the following file: