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

1-based interval number: 1 unison, 3 third, 8 octave, 10 tenth (SPEC-INT-2, SPEC-INT-3). More...

#include <IntervalNumber.h>

Collaboration diagram for MCC::IntervalNumber:
Collaboration graph

Public Member Functions

constexpr IntervalNumber () noexcept
 Creates the invalid number (SPEC-ERR-2).
constexpr IntervalNumber (int32_t value) noexcept
 Creates the number value; values outside [1, Maximum] produce the invalid number (SPEC-ERR-3).
constexpr bool IsValid () const noexcept
 Returns true unless this is the invalid number.
constexpr uint16_t Value () const noexcept
 Returns the number, or InvalidValue (SPEC-ERR-7).
constexpr bool IsSimple () const noexcept
 Returns true for numbers 1-8 (SPEC-INT-3).
constexpr bool IsCompound () const noexcept
 Returns true for numbers above 8 (SPEC-INT-3).
MCC_CONSTEXPR14 IntervalNumber Simple () const noexcept
 Returns the simple number obtained by removing octaves (SPEC-INT-3): 9 -> 2, 10 -> 3, 15 -> 8. Simple numbers are returned unchanged.
MCC_CONSTEXPR14 bool IsPerfectType () const noexcept
 Returns true when the simple number is a unison, fourth, fifth or octave, which take perfect qualities (SPEC-INT-4).
MCC_CONSTEXPR14 IntervalNumber Inverted () const noexcept
 Returns the inverted simple number, 9 - Simple() (SPEC-INT-6).

Static Public Member Functions

static constexpr IntervalNumber Invalid () noexcept
 Returns the invalid number.

Static Public Attributes

static constexpr uint16_t Maximum = 1792
 Widest number: Cbbbb-128 to B####127 spans 1791 steps.
static constexpr uint16_t InvalidValue = 0xFFFF
 Sentinel returned by Value() for the invalid number (SPEC-ERR-7). Do not rely on it; check IsValid().

Friends

constexpr bool operator== (IntervalNumber a, IntervalNumber b) noexcept
 Equality; all invalid numbers are equal (SPEC-ERR-6).
constexpr bool operator!= (IntervalNumber a, IntervalNumber b) noexcept
constexpr bool operator< (IntervalNumber a, IntervalNumber b) noexcept
 Orders by value; the invalid number sorts last.

Detailed Description

1-based interval number: 1 unison, 3 third, 8 octave, 10 tenth (SPEC-INT-2, SPEC-INT-3).

Numbers range from 1 to Maximum, the widest span between two writable pitches. Default construction and out-of-range input produce the single invalid value (SPEC-ERR-2, SPEC-ERR-3).


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