maiacore 1.10.1
Music analisys library
clef.h
1#pragma once
2
3#include <string>
4
9enum class ClefSign { G, F, C, PERCUSSION };
10
19class Clef {
20 private:
21 ClefSign _sign;
22 int _line;
23 bool _isClefChanged;
24
29 void setClefChanged(bool isClefChanged);
30
31 public:
37 Clef(const ClefSign sign = ClefSign::G, int line = -1);
38
43
48 int getLine() const;
49
55 void setLine(int line);
56
61 ClefSign getSign() const;
62
67 void setSign(const ClefSign sign);
68
73 bool isClefChanged() const;
74
79 std::string getClefSignStr() const;
80
86 static ClefSign clefSignStr2ClefSign(const std::string& clefStr);
87
94 std::string toXML(const int clefNumber = -1, const int identSize = 2) const;
95};
Represents a musical clef for a staff, including sign, line, and change status.
Definition: clef.h:19
Clef(const ClefSign sign=ClefSign::G, int line=-1)
Constructs a Clef with a given sign and line.
int getLine() const
Returns the staff line for the clef.
std::string toXML(const int clefNumber=-1, const int identSize=2) const
Serializes the clef to MusicXML format.
static ClefSign clefSignStr2ClefSign(const std::string &clefStr)
Converts a clef sign string to a ClefSign enum value.
~Clef()
Destructor.
ClefSign getSign() const
Returns the clef sign (G, F, C, percussion).
void setSign(const ClefSign sign)
Sets the clef sign and updates the staff line accordingly.
bool isClefChanged() const
Returns true if the clef has changed in the current measure.
void setLine(int line)
Sets the staff line for the clef.
std::string getClefSignStr() const
Returns the clef sign as a string ("G", "F", "C", "percussion").