1#ifndef MCC_PITCH_CHROMATIC_INDEX_H
2#define MCC_PITCH_CHROMATIC_INDEX_H
4#include <MCC_BuildSettings.h>
8#include <Foundation/Math/Arithmetic.h>
10#include <MCC/Pitch/PitchClass.h>
53 ?
static_cast<int16_t
>(value)
68 constexpr int16_t
Value() const noexcept {
return _value; }
98 return a._value == b._value;
107 return a._value < b._value;
Absolute semitone position of a pitch, with origin C-1 = 0.
Definition ChromaticIndex.h:26
static constexpr int16_t Minimum
Lowest valid index: Cbbbb in octave -128.
Definition ChromaticIndex.h:29
static constexpr int16_t Maximum
Highest valid index: B#### in octave 127.
Definition ChromaticIndex.h:32
friend constexpr bool operator<(ChromaticIndex a, ChromaticIndex b) noexcept
Orders by value; invalid sorts last.
Definition ChromaticIndex.h:106
constexpr int16_t Value() const noexcept
Returns the semitone position, or InvalidValue for the invalid index (SPEC-ERR-7).
Definition ChromaticIndex.h:68
constexpr bool IsValid() const noexcept
Returns true unless this is the invalid index.
Definition ChromaticIndex.h:62
MCC_CONSTEXPR14 ChromaticIndex Transposed(int32_t semitones) const noexcept
Returns this index moved by semitones. The result is invalid when this index is invalid or the result...
Definition ChromaticIndex.h:87
friend constexpr bool operator==(ChromaticIndex a, ChromaticIndex b) noexcept
Equality; all invalid indices are equal (SPEC-ERR-6).
Definition ChromaticIndex.h:97
constexpr ChromaticIndex(int32_t value) noexcept
Creates the index value; values outside [Minimum, Maximum] produce the invalid index (SPEC-ERR-3).
Definition ChromaticIndex.h:51
MCC_CONSTEXPR14 MCC::PitchClass PitchClass() const noexcept
Returns the pitch class Value() mod 12 (SPEC-ORD-4); the invalid index yields the invalid class (SPEC...
Definition ChromaticIndex.h:74
static constexpr int16_t InvalidValue
Sentinel returned by Value() for the invalid index (SPEC-ERR-7). Do not rely on it; check IsValid().
Definition ChromaticIndex.h:38
static constexpr ChromaticIndex Invalid() noexcept
Returns the invalid index.
Definition ChromaticIndex.h:57
constexpr ChromaticIndex() noexcept
Creates the invalid index (SPEC-ERR-2).
Definition ChromaticIndex.h:45
Pitch class 0-11 with spelling discarded (C = 0).
Definition PitchClass.h:21
static constexpr uint8_t Count
Number of pitch classes in an octave.
Definition PitchClass.h:24
static constexpr PitchClass Invalid() noexcept
Returns the invalid pitch class.
Definition PitchClass.h:49
Music Composition Core public namespace.
Definition Version.h:4