MUSX Document Model
Loading...
Searching...
No Matches
Entries.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <tuple>
25
26#include "musx/util/Fraction.h"
27#include "BaseClasses.h"
28#include "CommonClasses.h"
29 // do not add other dom class dependencies. Use Implementations.h for implementations that need total class access.
30
31 namespace music_theory {
32 class Transposer;
33} // namespace music_theory
34
35namespace musx {
36namespace dom {
37
38namespace others {
39class PercussionNoteInfo;
40class Staff;
41class StaffComposite;
42} // namespace others
43
44namespace details {
45class TupletDef;
46class GFrameHoldContext;
47} // namespace details
48
58std::pair<NoteType, unsigned> calcNoteInfoFromEdu(Edu duration);
59
61unsigned calcNumberOfBeamsInEdu(Edu duration);
62
69class Note : public Base
70{
71public:
73 explicit Note(const DocumentWeakPtr& document, NoteNumber noteId)
74 : Base(document, 0, ShareMode::All), m_noteId(noteId)
75 {
76 }
77
79 static constexpr NoteNumber RESTID = 31;
80
82 enum class NoteName : int
83 {
84 C = 0,
85 D = 1,
86 E = 2,
87 F = 3,
88 G = 4,
89 A = 5,
90 B = 6
91 };
92
93 int harmLev{};
94 int harmAlt{};
95 bool isValid{};
96 bool crossStaff{};
97 bool tieStart{};
98 bool tieEnd{};
99 bool upStemSecond{};
103 bool upSplitStem{};
105 bool showAcci{};
106 bool parenAcci{};
107 bool freezeAcci{};
108
111 NoteNumber getNoteId() const { return m_noteId; }
112
123 std::pair<int, int> calcDefaultEnharmonic(const std::shared_ptr<KeySignature>& key) const;
124
148 std::tuple<NoteName, int, int, int> calcNoteProperties(const std::shared_ptr<KeySignature>& key, ClefIndex clefIndex,
149 const std::shared_ptr<const others::Staff>& staff = nullptr, bool respellEnharmonic = false) const;
150
151 bool requireAllFields() const override { return false; }
152
154
155private:
156 NoteNumber m_noteId{};
157};
158
165class Entry : public Base
166{
167public:
172 explicit Entry(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
173 : Base(document, partId, shareMode), m_entnum(entnum), m_prev(prev), m_next(next)
174 {
175 }
176
186 int numNotes{};
188 bool isValid{};
189 bool isNote{};
190 bool graceNote{};
191 bool floatRest{};
192 bool isHidden{};
193 bool voice2{};
194 bool articDetail{};
195 bool noteDetail{};
196 bool dotTieAlt{};
197 bool tupletStart{};
198 bool beamExt{};
199 bool beam{};
200 bool secBeam{};
201 bool doubleStem{};
202 bool splitStem{};
204 bool crossStaff{};
205 bool freezeStem{};
206 bool upStem{};
207 bool noLeger{};
208 bool stemDetail{};
212 bool sorted{};
213 bool noPlayback{};
214 bool lyricDetail{};
216 bool freezeBeam{};
217
219 std::vector<std::shared_ptr<Note>> notes;
220
222 EntryNumber getEntryNumber() const { return m_entnum; }
223
227 std::shared_ptr<Entry> getNext() const;
228
232 std::shared_ptr<Entry> getPrevious() const;
233
237 std::pair<NoteType, unsigned> calcNoteInfo() const { return calcNoteInfoFromEdu(duration); }
238
243
246 bool hasStem() const { return duration < Edu(NoteType::Whole); }
247
248 void integrityCheck() override
249 {
250 this->Base::integrityCheck();
251 if (size_t(numNotes) != notes.size()) {
252 MUSX_INTEGRITY_ERROR("Entry " + std::to_string(m_entnum) + " has an incorrect number of notes.");
253 }
254 }
255
256 bool requireAllFields() const override { return false; }
257
258 constexpr static std::string_view XmlNodeName = "entry";
260
261private:
262 EntryNumber m_entnum;
263 EntryNumber m_prev;
264 EntryNumber m_next;
265
266};
267
268class EntryInfo;
269class EntryFrame;
270class NoteInfoPtr;
271
276{
277public:
279 EntryInfoPtr() : m_entryFrame(nullptr), m_indexInFrame(0) {}
280
286 EntryInfoPtr(const std::shared_ptr<const EntryFrame>& entryFrame, size_t index = 0)
287 : m_entryFrame(entryFrame), m_indexInFrame(index) {}
288
290 const std::shared_ptr<const EntryInfo> operator->() const;
291
293 operator bool() const;
294
297 bool isSameEntry(const EntryInfoPtr& src) const;
298
300 std::shared_ptr<const EntryFrame> getFrame() const { return m_entryFrame; }
301
303 size_t getIndexInFrame() const { return m_indexInFrame; }
304
307
309 InstCmper getStaff() const;
310
312 MeasCmper getMeasure() const;
313
316 std::shared_ptr<others::StaffComposite> createCurrentStaff(const std::optional<InstCmper>& forStaffId = std::nullopt) const;
317
319 std::shared_ptr<KeySignature> getKeySignature() const;
320
322 unsigned calcReverseGraceIndex() const;
323
325 std::optional<size_t> calcNextTupletIndex(std::optional<size_t> currentIndex) const;
326
329
333
338
342
345
350
356 EntryInfoPtr getNextInVoice(int voice) const;
357
363 EntryInfoPtr getPreviousInVoice(int voice) const;
364
366 EntryInfoPtr getNextInBeamGroup(bool includeHiddenEntries = false) const
367 { return iterateBeamGroup<&EntryInfoPtr::nextPotentialInBeam, &EntryInfoPtr::previousPotentialInBeam>(includeHiddenEntries); }
368
370 EntryInfoPtr getPreviousInBeamGroup(bool includeHiddenEntries = false) const
371 { return iterateBeamGroup<&EntryInfoPtr::previousPotentialInBeam, &EntryInfoPtr::nextPotentialInBeam>(includeHiddenEntries); }
372
375 bool calcDisplaysAsRest() const;
376
379 bool calcUnbeamed() const;
380
382 bool calcIsBeamStart() const;
383
388 bool calcIsFeatheredBeamStart(Evpu& outLeftY, Evpu& outRightY) const;
389
393
395 unsigned calcNumberOfBeams() const;
396
399 unsigned calcLowestBeamStart() const;
400
403 unsigned calcLowestBeamEnd() const;
404
407 unsigned calcLowestBeamStub() const;
408
414 bool calcBeamStubIsLeft() const;
415
418
421
423 bool canBeBeamed() const;
424
425private:
426 unsigned calcVisibleBeams() const;
427
428 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
429 std::optional<unsigned> iterateFindRestsInSecondaryBeam(const EntryInfoPtr nextOrPrevInBeam) const;
430
431 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
432 EntryInfoPtr iteratePotentialEntryInBeam() const;
433
434 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
435 bool iterateNotesExistLeftOrRight() const;
436
437 EntryInfoPtr nextPotentialInBeam(bool includeHiddenEntries) const;
438
439 EntryInfoPtr previousPotentialInBeam(bool includeHiddenEntries) const;
440
441 template<EntryInfoPtr(EntryInfoPtr::* Iterator)(bool) const, EntryInfoPtr(EntryInfoPtr::* ReverseIterator)(bool) const>
442 EntryInfoPtr iterateBeamGroup(bool includeHiddenEntries) const;
443
444 std::shared_ptr<const EntryFrame> m_entryFrame;
445 size_t m_indexInFrame{};
446};
447
454class EntryFrame : public std::enable_shared_from_this<EntryFrame>
455{
456public:
466 explicit EntryFrame(const details::GFrameHoldContext& gfhold, InstCmper staff, MeasCmper measure, LayerIndex layerIndex,
467 bool forWrittenPitch, util::Fraction timeStretch);
468
471 {
472 std::shared_ptr<const details::TupletDef> tuplet;
473 size_t startIndex;
474 size_t endIndex;
477 bool voice2;
478
480 TupletInfo(const std::weak_ptr<const EntryFrame>& parent, const std::shared_ptr<const details::TupletDef>& tup, size_t index, util::Fraction start, bool forVoice2)
481 : tuplet(tup), startIndex(index), endIndex(std::numeric_limits<size_t>::max()),
482 startDura(start), endDura(-1), voice2(forVoice2), m_parent(parent)
483 {}
484
496 bool calcIsTremolo() const;
497
511 bool calcCreatesSingletonRight() const { return calcCreatesSingleton(false); }
512
522 bool calcCreatesSingletonLeft() const { return calcCreatesSingleton(true); }
523
533
543
544 private:
545 bool calcCreatesSingleton(bool left) const;
546
547 const std::weak_ptr<const EntryFrame> m_parent;
548 };
549
556 std::vector<TupletInfo> tupletInfo;
557 std::shared_ptr<KeySignature> keySignature;
558
560 DocumentPtr getDocument() const { return m_document; }
561
563 Cmper getRequestedPartId() const { return m_requestedPartId; }
564
566 InstCmper getStaff() const { return m_staff; }
567
569 MeasCmper getMeasure() const { return m_measure; }
570
572 LayerIndex getLayerIndex() const { return m_layerIndex; }
573
576 bool isForWrittenPitch() const { return m_forWrittenPitch; }
577
580 util::Fraction getTimeStretch() const { return m_timeStretch; }
581
583 const std::vector<std::shared_ptr<const EntryInfo>>& getEntries() const
584 { return m_entries; }
585
589 EntryInfoPtr getFirstInVoice(int voice) const;
590
594 EntryInfoPtr getLastInVoice(int voice) const;
595
597 void addEntry(const std::shared_ptr<const EntryInfo>& entry)
598 { m_entries.emplace_back(entry); }
599
602 std::shared_ptr<const EntryFrame> getNext() const;
603
606 std::shared_ptr<const EntryFrame> getPrevious() const;
607
608private:
609 DocumentPtr m_document;
610 Cmper m_requestedPartId;
611 InstCmper m_staff;
612 MeasCmper m_measure;
613 LayerIndex m_layerIndex;
614 bool m_forWrittenPitch;
615 util::Fraction m_timeStretch;
616
617 std::vector<std::shared_ptr<const EntryInfo>> m_entries;
618};
619
620namespace details {
621class GFrameHold;
622} // namespace details
623
633{
638 explicit EntryInfo(const std::shared_ptr<const Entry>& entry)
639 : m_entry(entry) {}
640
641#ifndef DOXYGEN_SHOULD_IGNORE_THIS
643#endif
644
645public:
648 bool v2Launch{};
649 unsigned graceIndex{};
652
655 std::shared_ptr<const Entry> getEntry() const
656 {
657 auto retval = m_entry.lock();
658 if (!retval) {
659 throw std::logic_error("Entry pointer is no longer valid");
660 }
661 return retval;
662 }
663
664private:
665 std::weak_ptr<const Entry> m_entry;
666};
667
670{
671public:
673 NoteInfoPtr() : m_entry(), m_noteIndex(0) {}
674
678 NoteInfoPtr(const EntryInfoPtr& entryInfo, size_t noteIndex)
679 : m_entry(entryInfo), m_noteIndex(noteIndex)
680 {}
681
683 operator bool() const
684 { return m_entry && m_noteIndex < m_entry->getEntry()->notes.size(); }
685
687 bool isSameNote(const NoteInfoPtr& src) const
688 { return m_entry.isSameEntry(src.m_entry) && m_noteIndex == src.m_noteIndex; }
689
693 NoteInfoPtr findEqualPitch(const EntryInfoPtr& entry) const;
694
696 std::shared_ptr<const Note> operator->() const
697 {
698 MUSX_ASSERT_IF(m_noteIndex >= m_entry->getEntry()->notes.size()) {
699 throw std::logic_error("Note index is too large for notes array.");
700 }
701 return m_entry->getEntry()->notes[m_noteIndex];
702 }
703
706 { return m_entry; }
707
720 std::tuple<Note::NoteName, int, int, int> calcNoteProperties(const std::optional<bool>& enharmonicRespell = std::nullopt) const;
721
724 std::shared_ptr<others::PercussionNoteInfo> calcPercussionNoteInfo() const;
725
729 NoteInfoPtr calcTieTo() const;
730
734 NoteInfoPtr calcTieFrom() const;
735
737 InstCmper calcStaff() const;
738
741 std::unique_ptr<music_theory::Transposer> createTransposer() const;
742
746 {
747 if (m_noteIndex >= m_entry->getEntry()->notes.size()) {
748 return NoteInfoPtr();
749 }
750 return NoteInfoPtr(m_entry, m_noteIndex + 1);
751 }
752
756 {
757 if (m_noteIndex <= 0) {
758 return NoteInfoPtr();
759 }
760 return NoteInfoPtr(m_entry, m_noteIndex - 1);
761 }
762
763private:
767 bool isSamePitchValues(const NoteInfoPtr& src) const
768 {
769 if (!*this || !src) {
770 return false;
771 }
772 return (*this)->harmLev == src->harmLev
773 && (*this)->harmAlt == src->harmAlt;
774 }
775
776 EntryInfoPtr m_entry;
777 size_t m_noteIndex;
778};
779
780} // namespace dom
781} // namespace entries
Base class to enforce polymorphism across all DOM classes.
Definition BaseClasses.h:60
virtual void integrityCheck()
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition BaseClasses.h:132
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:68
Represents a vector of EntryInfo instances for a given frame, along with computed information.
Definition Entries.h:455
util::Fraction getTimeStretch() const
Get the time stretch in this frame. Rather than accessing this value directly, consider using EntryIn...
Definition Entries.h:580
bool isForWrittenPitch() const
Returns if this entry frame was created for written pitch.
Definition Entries.h:576
EntryInfoPtr getLastInVoice(int voice) const
Returns the last entry in the specified v1/v2 or null if none.
Definition Implementations.cpp:233
InstCmper getStaff() const
Get the staff for the entry.
Definition Entries.h:566
MeasCmper getMeasure() const
Get the measure for the entry frame.
Definition Entries.h:569
std::shared_ptr< const EntryFrame > getPrevious() const
Gets the entry frame for the previous measure with the same staff and layer.
Definition Implementations.cpp:251
void addEntry(const std::shared_ptr< const EntryInfo > &entry)
Add an entry to the list.
Definition Entries.h:597
const std::vector< std::shared_ptr< const EntryInfo > > & getEntries() const
Get the entry list.
Definition Entries.h:583
EntryInfoPtr getFirstInVoice(int voice) const
Returns the first entry in the specified v1/v2 or null if none.
Definition Implementations.cpp:216
Cmper getRequestedPartId() const
Get the requested part ID for the entry frame.
Definition Entries.h:563
std::shared_ptr< KeySignature > keySignature
this can be different than the measure key sig if the staff has independent key signatures
Definition Entries.h:557
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry frame.
Definition Entries.h:572
DocumentPtr getDocument() const
Get the document for the entry frame.
Definition Entries.h:560
std::vector< TupletInfo > tupletInfo
A list of the tuplets in the frame and their calculated starting and ending information.
Definition Entries.h:556
std::shared_ptr< const EntryFrame > getNext() const
Gets the entry frame for the next measure with the same staff and layer.
Definition Implementations.cpp:243
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:276
EntryInfoPtr getNextInFrame() const
Get the next entry in the frame.
Definition Implementations.cpp:514
EntryInfoPtr(const std::shared_ptr< const EntryFrame > &entryFrame, size_t index=0)
Constructor function.
Definition Entries.h:286
EntryInfoPtr getNextSameV() const
Get the next entry in the frame in the same voice.
Definition Implementations.cpp:522
size_t getIndexInFrame() const
Returns the index within the frame.
Definition Entries.h:303
util::Fraction calcGlobalElapsedDuration() const
Calculates the elapsed duration in global edu, removing any time stretch due to independent time sign...
Definition Implementations.cpp:823
EntryInfoPtr getPreviousInVoice(int voice) const
Returns the previous entry in the frame in the specified v1/v2 or null if none.
Definition Implementations.cpp:583
unsigned calcReverseGraceIndex() const
Caclulates the grace index counting leftward (used by other standards such as MNX)
Definition Implementations.cpp:476
bool canBeBeamed() const
Determines if this entry can be beamed.
Definition Implementations.cpp:607
std::shared_ptr< KeySignature > getKeySignature() const
Get the key signature of the entry.
Definition Implementations.cpp:468
bool isSameEntry(const EntryInfoPtr &src) const
Returns whether the input and the current instance refer to the same entry.
Definition Implementations.cpp:454
EntryInfoPtr getPreviousInLayer() const
Get the previous entry in the same layer and staff. This can be in the previous measure.
Definition Implementations.cpp:539
EntryInfoPtr getNextInLayer() const
Get the next entry in the same layer and staff. This can be in the next measure.
Definition Implementations.cpp:503
unsigned calcLowestBeamStub() const
Returns the lowest beam stub at this entry, where 2 = 16th note stub, 3 = 32nd note stub,...
Definition Implementations.cpp:764
EntryInfoPtr getNextInBeamGroup(bool includeHiddenEntries=false) const
Gets the next entry in a beamed group or nullptr if the entry is not beamed or is the last in the gro...
Definition Entries.h:366
std::shared_ptr< others::StaffComposite > createCurrentStaff(const std::optional< InstCmper > &forStaffId=std::nullopt) const
Creates the current StaffComposite for the entry.
Definition Implementations.cpp:470
unsigned calcLowestBeamStart() const
Returns the lowest beam number starting at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:711
EntryInfoPtr getPreviousInBeamGroup(bool includeHiddenEntries=false) const
Gets the previous entry in a beamed group or nullptr if the entry is not beamed or is the first in th...
Definition Entries.h:370
unsigned calcLowestBeamEnd() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:741
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Implementations.cpp:462
unsigned calcNumberOfBeams() const
Calculates the number of beams or flags on the entry.
Definition Implementations.cpp:660
EntryInfoPtr getPreviousInFrame() const
Get the previous entry in the frame.
Definition Implementations.cpp:550
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:300
bool calcDisplaysAsRest() const
Calculates if an entry displays as a rest.
Definition Implementations.cpp:593
EntryInfoPtr findBeamEnd() const
Finds the end entry of a beamed group.
Definition Implementations.cpp:627
bool calcIsBeamStart() const
Returns whether this is the start of a primary beam.
Definition Implementations.cpp:620
EntryInfoPtr getPreviousSameV() const
Get the previous entry in the frame in the same voice.
Definition Implementations.cpp:558
EntryInfoPtr getNextInVoice(int voice) const
Returns the next entry in the frame in the specified v1/v2 or null if none.
Definition Implementations.cpp:573
const std::shared_ptr< const EntryInfo > operator->() const
Allows -> access to the underlying EntryInfo instance.
Definition Implementations.cpp:438
InstCmper getStaff() const
Get the staff cmper.
Definition Implementations.cpp:464
bool calcUnbeamed() const
Returns whether this is an unbeamed entry.
Definition Implementations.cpp:598
EntryInfoPtr()
Default constructor.
Definition Entries.h:279
std::optional< size_t > calcNextTupletIndex(std::optional< size_t > currentIndex) const
Returns the next higher tuplet index that this entry starts, or std::nullopt if none.
Definition Implementations.cpp:488
bool calcBeamStubIsLeft() const
Calculates if a beam stub on this entry would go left or right. It does not check that an entry actua...
Definition Implementations.cpp:774
util::Fraction calcGlobalActualDuration() const
Calculates the actual duration in global edu, removing any time stretch due to independent time signa...
Definition Implementations.cpp:828
MeasCmper getMeasure() const
Get the measure cmper.
Definition Implementations.cpp:466
bool calcIsFeatheredBeamStart(Evpu &outLeftY, Evpu &outRightY) const
Calculates if the entry starts a feathered beam and returns information about it if so.
Definition Implementations.cpp:922
Information an entry along with the entry.
Definition Entries.h:633
bool v2Launch
indicates if this entry (which is voice1) launches a voice2 sequence
Definition Entries.h:648
unsigned graceIndex
Definition Entries.h:649
ClefIndex clefIndex
the clef index in effect for the entry.
Definition Entries.h:651
std::shared_ptr< const Entry > getEntry() const
Get the entry.
Definition Entries.h:655
util::Fraction elapsedDuration
the elapsed duration within the measure where this entry occurs (in fractions of a whole note)
Definition Entries.h:646
util::Fraction actualDuration
the actual duration of entry (in fractions of a whole note), taking into account tuplets and grace no...
Definition Entries.h:647
Represents an entry containing metadata and notes.
Definition Entries.h:166
bool splitStem
Definition Entries.h:202
bool upStem
Whether a stem is up or down. (Only reliable when freezeStem is true.)
Definition Entries.h:206
Entry(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
Constructor function.
Definition Entries.h:172
EntryNumber getEntryNumber() const
Gets the entry number for this entry.
Definition Entries.h:222
bool articDetail
Indicates there is an articulation on the entry.
Definition Entries.h:194
std::pair< NoteType, unsigned > calcNoteInfo() const
Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu....
Definition Entries.h:237
bool isNote
If this value is false, the entry is a rest.
Definition Entries.h:189
bool noLeger
Hide ledger lines.
Definition Entries.h:207
bool freezeStem
Freeze stem flag (upStem gives the direction.)
Definition Entries.h:205
bool noPlayback
Indicates that the entry should not be played back.
Definition Entries.h:213
bool voice2
This is a V2 note. (xml node <v2>)
Definition Entries.h:193
bool beamExt
Indicates that there is a beam extension on the entry.
Definition Entries.h:198
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Entries.h:258
bool secBeam
Signifies a secondary beam break occurs on the entry.
Definition Entries.h:200
void integrityCheck() override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Entries.h:248
bool stemDetail
Indicates there are stem modifications.
Definition Entries.h:208
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:188
Evpu hOffset
Manual offset created with the Note Position Tool. (xml node is <posi>.)
Definition Entries.h:187
std::vector< std::shared_ptr< Note > > notes
Collection of notes that comprise the entry. These are in order from lowest to highest.
Definition Entries.h:219
bool requireAllFields() const override
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class...
Definition Entries.h:256
bool noteDetail
Indicates there is a note detail or EntrySize record for the entry.
Definition Entries.h:195
util::Fraction calcFraction() const
Calculates the duration as a util::Fraction of a whole note.
Definition Entries.h:242
static const xml::XmlElementArray< Entry > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool hasStem() const
Returns true if the entry's duration has a stem.
Definition Entries.h:246
bool crossStaff
Signifies that at least one note in the entry has been cross staffed.
Definition Entries.h:204
bool floatRest
Is floating rest. If false, the first note element gives the staff position of the rest.
Definition Entries.h:191
bool smartShapeDetail
Indicates this entry has a smart shape assignment.
Definition Entries.h:211
Edu duration
Duration of the entry, not taking into account tuplets.
Definition Entries.h:185
bool isHidden
Indicates the entry is hidden, (xml node is <ignore>)
Definition Entries.h:192
bool tupletStart
Indicates that a tuplet start on the entry.
Definition Entries.h:197
bool lyricDetail
Indicates there is a lyric assignment on the entry.
Definition Entries.h:214
int numNotes
Number of notes in the entry. There is an error if this is not the same as notes.size().
Definition Entries.h:186
bool sorted
Sorted flag.
Definition Entries.h:212
bool reverseDownStem
Indicates that a stem normally down is reversed.
Definition Entries.h:210
bool reverseUpStem
Indicates that a stem normally up is reversed.
Definition Entries.h:209
bool doubleStem
Creates a double stem on the entry. (Appears to be exclusive with splitStem.)
Definition Entries.h:201
bool beam
Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry....
Definition Entries.h:199
bool performanceData
Indicates there is performance data on the entry.
Definition Entries.h:215
bool dotTieAlt
Indicates dot or tie alterations are present.
Definition Entries.h:196
bool freezeBeam
Freeze beam flag (Derived from the presence of <freezeBeam> node.)
Definition Entries.h:216
std::shared_ptr< Entry > getNext() const
Gets the next entry in this list or nullptr if none.
Definition Implementations.cpp:159
bool graceNote
Indicate the entry is a grace note.
Definition Entries.h:190
std::shared_ptr< Entry > getPrevious() const
Gets the previous entry in this list or nullptr if none.
Definition Implementations.cpp:169
Wraps an EntryInfo instance and a note index.
Definition Entries.h:670
InstCmper calcStaff() const
Calculates the staff number, taking into account cross staffing.
Definition Implementations.cpp:2106
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:705
bool isSameNote(const NoteInfoPtr &src) const
Returns whether the input and the current instance refer to the same note.
Definition Entries.h:687
std::tuple< Note::NoteName, int, int, int > calcNoteProperties(const std::optional< bool > &enharmonicRespell=std::nullopt) const
Calculates the note name, octave number, actual alteration, and staff position. This function does no...
Definition Implementations.cpp:2116
NoteInfoPtr getPrevious() const
Gets the next note in a chord on the same entry.
Definition Entries.h:755
std::shared_ptr< const Note > operator->() const
Allows -> access to the underlying Note instance.
Definition Entries.h:696
std::shared_ptr< others::PercussionNoteInfo > calcPercussionNoteInfo() const
Calculates the percussion note info for this note, if any.
Definition Implementations.cpp:2149
NoteInfoPtr calcTieFrom() const
Calculates the note that this note could tie from. Check the return value's Note::tieStart to see if ...
Definition Implementations.cpp:2072
NoteInfoPtr(const EntryInfoPtr &entryInfo, size_t noteIndex)
Constructor.
Definition Entries.h:678
NoteInfoPtr calcTieTo() const
Calculates the note that this note could tie to. Check the return value's Note::tieEnd to see if ther...
Definition Implementations.cpp:2038
NoteInfoPtr findEqualPitch(const EntryInfoPtr &entry) const
Finds a note with the same pitch in the supplied entry.
Definition Implementations.cpp:2013
NoteInfoPtr getNext() const
Gets the next note in a chord on the same entry.
Definition Entries.h:745
NoteInfoPtr()
Default constructor.
Definition Entries.h:673
std::unique_ptr< music_theory::Transposer > createTransposer() const
Creates a transposer for this Note instance.
Definition Implementations.cpp:2170
Represents a single note element in an entry.
Definition Entries.h:70
bool upStemSecond
When the entry is upstem, it is drawn on the "wrong" side of the stem.
Definition Entries.h:99
bool requireAllFields() const override
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class...
Definition Entries.h:151
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:95
static constexpr NoteNumber RESTID
Non floating rests have a note with this noteId that defines their staff positions.
Definition Entries.h:79
int harmAlt
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7.
Definition Entries.h:94
bool upSplitStem
Definition Entries.h:103
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 no...
Definition Implementations.cpp:1966
NoteNumber getNoteId() const
Gets the note id for this note. This value does not change, even if the notes in a chord are rearrang...
Definition Entries.h:111
bool tieEnd
Indicates a tie ends on this note.
Definition Entries.h:98
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 de...
Definition Implementations.cpp:1931
Note(const DocumentWeakPtr &document, NoteNumber noteId)
Constructor function.
Definition Entries.h:73
bool tieStart
Indicates a tie starts on this note.
Definition Entries.h:97
bool crossStaff
Signifies that the note has a details::CrossStaff note detail.
Definition Entries.h:96
int harmLev
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signatu...
Definition Entries.h:93
static const xml::XmlElementArray< Note > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool downStemSecond
When the entry is downstem, it is drawn on the "wrong" side of the stem.
Definition Entries.h:101
NoteName
The available note names, in array order.
Definition Entries.h:83
bool parenAcci
True if the accidental has parentheses.
Definition Entries.h:106
bool showAcci
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set....
Definition Entries.h:105
bool freezeAcci
True if the accidental should be forced on or off (based on showAcci.)
Definition Entries.h:107
A context wrapper for GFrameHold associated with a specific part and location.
Definition Details.h:650
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:37
static Fraction fromEdu(int edu)
Constructs a Fraction from edu.
Definition Fraction.cpp:31
A dependency-free, header-only collection of useful functions for music theory.
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:70
int16_t InstCmper
Enigma staff (inst) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:57
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:67
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
std::pair< NoteType, unsigned > calcNoteInfoFromEdu(Edu duration)
Calculates the NoteType and number of dots in an Edu value.
Definition Implementations.cpp:179
unsigned calcNumberOfBeamsInEdu(Edu duration)
Calculates the number of beams or flags in the Edu value.
Definition Implementations.cpp:646
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:53
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:68
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:69
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition BaseClasses.h:51
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:32
class to track tuplets in the frame
Definition Entries.h:471
size_t startIndex
the index of the first entry in the tuplet
Definition Entries.h:473
bool calcIsTremolo() const
Calculates if this tuplet represents a tremolo based on the following criteria.
Definition Implementations.cpp:261
bool calcCreatesSingletonLeft() const
Calculates if this tuplet is being used to create a singleton beam to the left.
Definition Entries.h:522
size_t endIndex
the index of the last entry in the tuplet
Definition Entries.h:474
util::Fraction endDura
the actual duration where the tuplet ends
Definition Entries.h:476
std::shared_ptr< const details::TupletDef > tuplet
the tuplet
Definition Entries.h:472
bool calcCreatesBeamContinuationRight() const
Calculates if this tuplet creates a beam continuation over a barline to the right,...
Definition Implementations.cpp:380
util::Fraction startDura
the actual duration where the tuplet starts
Definition Entries.h:475
TupletInfo(const std::weak_ptr< const EntryFrame > &parent, const std::shared_ptr< const details::TupletDef > &tup, size_t index, util::Fraction start, bool forVoice2)
Constructor.
Definition Entries.h:480
bool voice2
whether this tuplet is for voice2
Definition Entries.h:477
bool calcCreatesSingletonRight() const
Calculates if this tuplet is being used to create a singleton beam to the right.
Definition Entries.h:511
bool calcCreatesBeamContinuationLeft() const
Calculates if this tuplet creates a beam continuation over a barline to the left, as created by the B...
Definition Implementations.cpp:410