MUSX Document Model
|
Represents a single note element in an entry. More...
#include <Entries.h>
Public Types | |
enum class | NoteName : int { C = 0 , D = 1 , E = 2 , F = 3 , G = 4 , A = 5 , B = 6 } |
The available note names, in array order. | |
![]() | |
enum class | ShareMode { All , Partial , None } |
Describes how this instance is shared between part and score. More... | |
using | SharedNodes = std::set< std::string > |
The container type for shared nodes. | |
Public Member Functions | |
Note (const DocumentWeakPtr &document, NoteNumber noteId) | |
Constructor function. | |
NoteNumber | getNoteId () const |
Gets the note id for this note. This value does not change, even if the notes in a chord are rearranged (which affects the order of Entry::notes.) | |
std::pair< int, int > | calcDefaultEnharmonic (const std::shared_ptr< KeySignature > &key) const |
Calculates the default enharmonic equivalent of this note. This is the value that Finale uses when details::NoteAlterations::enharmonic is true. | |
std::tuple< NoteName, int, int, int > | calcNoteProperties (const std::shared_ptr< KeySignature > &key, ClefIndex clefIndex, const std::shared_ptr< const others::Staff > &staff=nullptr, bool respellEnharmonic=false) const |
Calculates the note name, octave number, actual alteration, and staff position. This function does not take into account percussion notes and their staff position override. | |
bool | requireAllFields () const override |
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class. | |
![]() | |
virtual | ~Base () noexcept(false)=default |
Virtual destructor for polymorphic behavior. | |
DocumentPtr | getDocument () const |
Gets a reference to the Document. | |
virtual Cmper | getPartId () const |
Gets the partId for this instance (or SCORE_PARTID for score) | |
ShareMode | getShareMode () const |
Gets the sharing mode for this instance. | |
const SharedNodes & | getUnlinkedNodes () const |
Gets the unlinked nodes for this instance. (Only populated for ShareMode::Partial ) | |
void | addUnlinkedNode (const std::string &nodeName) |
Adds a shared node for this instance. | |
virtual void | integrityCheck () |
Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes. | |
Static Public Member Functions | |
static const xml::XmlElementArray< Note > & | xmlMappingArray () |
Required for musx::factory::FieldPopulator. | |
Public Attributes | |
int | harmLev {} |
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signature tonic is not C). | |
int | harmAlt {} |
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7. | |
bool | isValid {} |
Should always be true but otherwise appears to be used internally by Finale. | |
bool | crossStaff {} |
Signifies that the note has a details::CrossStaff note detail. | |
bool | tieStart {} |
Indicates a tie starts on this note. | |
bool | tieEnd {} |
Indicates a tie ends on this note. | |
bool | upStemSecond {} |
When the entry is upstem, it is drawn on the "wrong" side of the stem. | |
bool | downStemSecond {} |
When the entry is downstem, it is drawn on the "wrong" side of the stem. | |
bool | upSplitStem {} |
bool | showAcci {} |
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set.) | |
bool | parenAcci {} |
True if the accidental has parentheses. | |
bool | freezeAcci {} |
True if the accidental should be forced on or off (based on showAcci .) | |
Static Public Attributes | |
static constexpr NoteNumber | RESTID = 31 |
Non floating rests have a note with this noteId that defines their staff positions. | |
Additional Inherited Members | |
![]() | |
Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode) | |
Constructs the base class. | |
Base (const Base &)=default | |
explicit default copy constructor | |
Base (Base &&) noexcept=default | |
explicit default move constructor | |
Base & | operator= (const Base &) |
no-op copy assignment operator allows subclasses to copy their values. | |
Base & | operator= (Base &&) noexcept |
no-op move assignment operator allows subclasses to move their values. | |
Represents a single note element in an entry.
This class is identified by the XML node name "note".
std::pair< int, int > musx::dom::Note::calcDefaultEnharmonic | ( | const std::shared_ptr< KeySignature > & | key | ) | const |
Calculates the default enharmonic equivalent of this note. This is the value that Finale uses when details::NoteAlterations::enharmonic is true.
Normally you do not have to call this function directly. It is called inside calcNoteProperties. But the function is available if you need it.
key | The key signature to use for transposition. |
std::tuple< Note::NoteName, int, int, int > musx::dom::Note::calcNoteProperties | ( | const std::shared_ptr< KeySignature > & | key, |
ClefIndex | clefIndex, | ||
const std::shared_ptr< const others::Staff > & | staff = nullptr , |
||
bool | respellEnharmonic = false |
||
) | const |
Calculates the note name, octave number, actual alteration, and staff position. This function does not take into account percussion notes and their staff position override.
Finale does not transpose correctly with microtonal key signatures. This function transposes mostly correctly for them, which means that microtonal key signatures may have different results than in Finale. Of particular note is Chromatic Transposition, which produces nonsense results in Finale but here produces correct results, provided that the alteration value is understood to be a chromatic half-step alteration rather than a step alteration in EDO divisions.
See KeySignature::setTransposition for information about differences in key signature transposition.
key | The key signature in effect. |
clefIndex | The index of the clef in effect. |
staff | If provided, the notes are transposed by any Chromatic Transposition specified for the staff. If calling calcNoteProperties for Concert Pitch (sounding pitch) values, omit this parameter. |
respellEnharmonic | If true, the notes are enharmonically respelled using the default enharmonic spelling. |
|
inlineoverridevirtual |
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class.
Some classes make it difficult to discover all the possible xml tags that might be used for all its options. An example is others::TextBlock. By overriding this function, a class can allow its members to be discovered as needed without causing error messages or throwing exceptions.
Reimplemented from musx::dom::Base.
bool musx::dom::Note::downStemSecond {} |
When the entry is downstem, it is drawn on the "wrong" side of the stem.
Indicates that this note is the lower note of a second.
bool musx::dom::Note::upSplitStem {} |
True if the stem splits on this note. To split a chord in the normal way, every note from this higher should have upSplitStem set to true
. Only takes effect if Entry::splitStem is true
.
bool musx::dom::Note::upStemSecond {} |
When the entry is upstem, it is drawn on the "wrong" side of the stem.
Indicates that this note is the upper note of a second.