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

Key signature: zero to seven sharps or flats (SPEC-KEY-1). More...

#include <KeySignature.h>

Collaboration diagram for MCC::KeySignature:
Collaboration graph

Public Member Functions

constexpr KeySignature () noexcept
 Creates the invalid signature (SPEC-ERR-2).
constexpr KeySignature (int32_t fifths) noexcept
 Creates a signature of fifths sharps (positive) or flats (negative).
constexpr bool IsValid () const noexcept
 Returns true unless this is the invalid signature.
constexpr int8_t Fifths () const noexcept
 Returns sharps as positive and flats as negative; 0 when invalid.
constexpr uint8_t Sharps () const noexcept
 Returns the number of sharps.
constexpr uint8_t Flats () const noexcept
 Returns the number of flats.
MCC_CONSTEXPR14 MCC::Accidental AccidentalOf (Letter letter) const noexcept
 Returns the accidental the signature applies to letter: sharp, flat or natural; invalid for the invalid signature.

Static Public Member Functions

static constexpr KeySignature Invalid () noexcept
 Returns the invalid signature.

Friends

constexpr bool operator== (KeySignature a, KeySignature b) noexcept
 Compares signatures.
constexpr bool operator!= (KeySignature a, KeySignature b) noexcept
 Negation of operator==.

Detailed Description

Key signature: zero to seven sharps or flats (SPEC-KEY-1).

Stored as a signed position on the circle of fifths: positive values count sharps (F C G D A E B), negative values count flats (B E A D G C F). Values outside [-7, 7] produce the single invalid signature.


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