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

Exact written time signature and its simple/compound interpretation. More...

#include <Meter.h>

Collaboration diagram for MCC::Meter:
Collaboration graph

Public Member Functions

constexpr Meter () noexcept
 Creates the invalid meter (SPEC-ERR-2).
MCC_CONSTEXPR14 Meter (int32_t numerator, int32_t denominator) noexcept
 Creates the written signature numerator / denominator.
constexpr Meter (int32_t numerator, MCC::NoteValue pulseValue) noexcept
 Creates a meter from its numerator and undotted denominator unit.
constexpr bool IsValid () const noexcept
 Returns true unless this is the invalid meter.
constexpr uint8_t Numerator () const noexcept
 Returns the written numerator, or 0 for the invalid meter.
constexpr uint16_t Denominator () const noexcept
 Returns the written denominator, or 0 for the invalid meter.
constexpr MCC::NoteValue PulseValue () const noexcept
 Returns the denominator unit, or the invalid NoteValue.
constexpr uint8_t PulseCount () const noexcept
 Returns the number of denominator units in the measure.
constexpr MeterKind Kind () const noexcept
 Classifies this meter as simple, compound, irregular or invalid.
constexpr bool IsSimple () const noexcept
constexpr bool IsCompound () const noexcept
constexpr bool IsIrregular () const noexcept
constexpr uint8_t BeatCount () const noexcept
 Returns the interpreted beat count, or 0 for irregular/invalid.
MCC_CONSTEXPR14 MCC::NoteValue BeatValue () const noexcept
 Returns the beat value, or invalid for irregular/invalid meters.
MCC_CONSTEXPR14 uint16_t MeasureNumerator () const noexcept
 Reduced numerator of the measure length in whole notes.
MCC_CONSTEXPR14 uint16_t MeasureDenominator () const noexcept
 Reduced denominator of the measure length in whole notes.

Static Public Member Functions

static constexpr Meter Invalid () noexcept
 Returns the invalid meter.
static MCC_CONSTEXPR14 Meter CommonTime () noexcept
 Returns common time (4/4).
static MCC_CONSTEXPR14 Meter CutTime () noexcept
 Returns cut time (2/2).
static constexpr Meter Simple (int32_t beatCount, MCC::NoteValue beatValue=MCC::NoteValue::Quarter()) noexcept
 Creates a simple meter from one to four undotted beats.
static MCC_CONSTEXPR14 Meter Compound (int32_t beatCount, MCC::NoteValue beatValue=MCC::NoteValue::Quarter(1)) noexcept
 Creates a compound meter from dotted beats.

Friends

constexpr bool operator== (Meter a, Meter b) noexcept
 Written equality; equivalent durations need not be equal.
constexpr bool operator!= (Meter a, Meter b) noexcept
constexpr bool operator< (Meter a, Meter b) noexcept
 Written order by numerator then denominator; invalid sorts last.
constexpr bool operator> (Meter a, Meter b) noexcept
constexpr bool operator<= (Meter a, Meter b) noexcept
constexpr bool operator>= (Meter a, Meter b) noexcept

Detailed Description

Exact written time signature and its simple/compound interpretation.

The numerator counts denominator units in one measure. The denominator is an undotted power-of-two NoteValue from whole through 256th. Simple meters have one denominator unit per beat; compound meters have three and expose the corresponding dotted beat. Other numerators are valid irregular meters, but their beat grouping is deliberately unspecified.

Meter contains no tempo, wall-clock duration, MIDI clock or PPQN state.

Constructor & Destructor Documentation

◆ Meter()

MCC_CONSTEXPR14 MCC::Meter::Meter ( int32_t numerator,
int32_t denominator )
inlinenoexcept

Creates the written signature numerator / denominator.

The numerator must be in [1, 255]; the denominator must be one of 1, 2, 4, ..., 256. Compound meters require denominator 2 or greater because NoteValue does not represent a dotted value longer than a whole.

Member Function Documentation

◆ BeatValue()

MCC_CONSTEXPR14 MCC::NoteValue MCC::Meter::BeatValue ( ) const
inlinenoexcept

Returns the beat value, or invalid for irregular/invalid meters.

The beat equals one pulse in simple meter and three pulses in compound meter, such as dotted quarter in 6/8.

◆ Compound()

MCC_CONSTEXPR14 Meter MCC::Meter::Compound ( int32_t beatCount,
MCC::NoteValue beatValue = MCC::NoteValue::Quarter(1) )
inlinestaticnoexcept

Creates a compound meter from dotted beats.

Compound(2, NoteValue::Quarter(1)) is 6/8. The beat count must be in [2, 85]; beatValue must have exactly one dot and a base from whole through 128th.

◆ Simple()

constexpr Meter MCC::Meter::Simple ( int32_t beatCount,
MCC::NoteValue beatValue = MCC::NoteValue::Quarter() )
inlinestaticconstexprnoexcept

Creates a simple meter from one to four undotted beats.

Simple(3, NoteValue::Quarter()) is 3/4.


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