|
maiacore 1.10.1
Music analisys library
|
Represents a musical clef for a staff, including sign, line, and change status. More...
#include <clef.h>
Public Member Functions | |
| Clef (const ClefSign sign=ClefSign::G, int line=-1) | |
| Constructs a Clef with a given sign and line. More... | |
| ~Clef () | |
| Destructor. | |
| int | getLine () const |
| Returns the staff line for the clef. More... | |
| void | setLine (int line) |
| Sets the staff line for the clef. More... | |
| ClefSign | getSign () const |
| Returns the clef sign (G, F, C, percussion). More... | |
| void | setSign (const ClefSign sign) |
| Sets the clef sign and updates the staff line accordingly. More... | |
| bool | isClefChanged () const |
| Returns true if the clef has changed in the current measure. More... | |
| std::string | getClefSignStr () const |
| Returns the clef sign as a string ("G", "F", "C", "percussion"). More... | |
| std::string | toXML (const int clefNumber=-1, const int identSize=2) const |
| Serializes the clef to MusicXML format. More... | |
Static Public Member Functions | |
| static ClefSign | clefSignStr2ClefSign (const std::string &clefStr) |
| Converts a clef sign string to a ClefSign enum value. More... | |
Represents a musical clef for a staff, including sign, line, and change status.
The Clef class provides methods for setting and querying the clef sign (G, F, C, percussion), the staff line on which the clef appears, and whether the clef has changed in the current measure. It supports MusicXML serialization and is designed for music analysis, computational musicology, and MusicXML processing.
| Clef::Clef | ( | const ClefSign | sign = ClefSign::G, |
| int | line = -1 |
||
| ) |
|
static |
Converts a clef sign string to a ClefSign enum value.
| clefStr | Clef sign string ("G", "F", "C", "percussion"). |
| std::string Clef::getClefSignStr | ( | ) | const |
Returns the clef sign as a string ("G", "F", "C", "percussion").
| int Clef::getLine | ( | ) | const |
Returns the staff line for the clef.
| ClefSign Clef::getSign | ( | ) | const |
Returns the clef sign (G, F, C, percussion).
| bool Clef::isClefChanged | ( | ) | const |
Returns true if the clef has changed in the current measure.
| void Clef::setLine | ( | int | line | ) |
Sets the staff line for the clef.
Only applicable for C and percussion clefs.
| line | New staff line. |
| void Clef::setSign | ( | const ClefSign | sign | ) |
Sets the clef sign and updates the staff line accordingly.
| sign | New clef sign. |
| std::string Clef::toXML | ( | const int | clefNumber = -1, |
| const int | identSize = 2 |
||
| ) | const |
Serializes the clef to MusicXML format.
| clefNumber | Clef number (default: -1 for single staff). |
| identSize | Indentation size (default: 2). |