maiacore 1.10.1
Music analisys library
key.h
1#pragma once
2#include <string>
3
11class Key {
12 public:
18 Key(int fifthCircle = 0, bool isMajorMode = true);
19
24 Key(const std::string& key);
25
30 void setFifthCircle(int fifthCircle);
31
36 int getFifthCircle() const;
37
43
48 int isMajorMode() const;
49
54 std::string getName() const;
55
60 std::string getRelativeKeyName() const;
61
62 private:
63 int _fifthCircle;
64 bool _isMajorMode;
65};
Represents a musical key signature (tonality), including circle of fifths and mode (major/minor).
Definition: key.h:11
void setFifthCircle(int fifthCircle)
Sets the fifth circle value (number of accidentals).
Key(int fifthCircle=0, bool isMajorMode=true)
Constructs a Key from a fifth circle value and mode.
int getFifthCircle() const
Returns the fifth circle value (number of accidentals).
void setIsMajorMode(bool isMajorMode)
Sets the mode of the key (major or minor).
std::string getName() const
Returns the key name as a string (e.g., "C", "Gm").
Key(const std::string &key)
Constructs a Key from a key name string (e.g., "C", "Gm").
int isMajorMode() const
Returns true if the key is major, false if minor.
std::string getRelativeKeyName() const
Returns the relative key name (e.g., for C major returns "Am", for Am returns "C").