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#include <map>
26
27#include "musx/util/Fraction.h"
28#include "BaseClasses.h"
29#include "CommonClasses.h"
30 // do not add other dom class dependencies. Use Implementations.h for implementations that need total class access.
31
32 namespace music_theory {
33 class Transposer;
34} // namespace music_theory
35
36namespace musx {
37namespace dom {
38
39namespace others {
40class Frame;
41class PercussionNoteInfo;
42class Staff;
43class StaffComposite;
44} // namespace others
45
46namespace details {
47class TupletDef;
48class GFrameHold;
49
58public:
67 GFrameHoldContext(const DocumentPtr& document, Cmper partId, Cmper inst, Cmper meas);
68
74 Cmper getRequestedPartId() const { return m_requestedPartId; }
75
81 const GFrameHold* operator->() const { return m_hold.get(); }
82
88 explicit operator bool() const { return static_cast<bool>(m_hold); }
89
93 ClefIndex calcClefIndexAt(Edu position) const;
94
99 { return calcClefIndexAt(position.calcEduDuration()); }
100
106 std::shared_ptr<const EntryFrame> createEntryFrame(LayerIndex layerIndex) const;
107
115 bool iterateEntries(LayerIndex layerIndex, std::function<bool(const EntryInfoPtr&)> iterator);
116
122 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator);
123
126 std::map<LayerIndex, bool> calcVoices() const;
127
129 bool calcIsCuesOnly() const;
130
131private:
135 std::pair<std::shared_ptr<const others::Frame>, Edu> findLayerFrame(LayerIndex layerIndex) const;
136
137 std::shared_ptr<GFrameHold> m_hold;
138 Cmper m_requestedPartId;
139};
140
141} // namespace details
142
152std::pair<NoteType, unsigned> calcNoteInfoFromEdu(Edu duration);
153
155unsigned calcNumberOfBeamsInEdu(Edu duration);
156
163class Note : public Base
164{
165public:
167 explicit Note(const DocumentWeakPtr& document, NoteNumber noteId)
168 : Base(document, 0, ShareMode::All), m_noteId(noteId)
169 {
170 }
171
173 static constexpr NoteNumber RESTID = 31;
174
176 enum class NoteName : int
177 {
178 C = 0,
179 D = 1,
180 E = 2,
181 F = 3,
182 G = 4,
183 A = 5,
184 B = 6
185 };
186
194 using NoteProperties = std::tuple<Note::NoteName, int, int, int>;
195
196 int harmLev{};
197 int harmAlt{};
198 bool isValid{};
199 bool crossStaff{};
200 bool tieStart{};
201 bool tieEnd{};
206 bool upSplitStem{};
208 bool showAcci{};
209 bool parenAcci{};
210 bool freezeAcci{};
211
214 NoteNumber getNoteId() const { return m_noteId; }
215
226 std::pair<int, int> calcDefaultEnharmonic(const std::shared_ptr<KeySignature>& key) const;
227
252 NoteProperties calcNoteProperties(const std::shared_ptr<KeySignature>& key, KeySignature::KeyContext ctx, ClefIndex clefIndex,
253 const std::shared_ptr<const others::Staff>& staff = nullptr, bool respellEnharmonic = false) const;
254
255 bool requireAllFields() const override { return false; }
256
258
259private:
260 NoteNumber m_noteId{};
261};
262
269class Entry : public Base
270{
271public:
276 explicit Entry(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
277 : Base(document, partId, shareMode), m_entnum(entnum), m_prev(prev), m_next(next)
278 {
279 }
280
290 int numNotes{};
292 bool isValid{};
293 bool isNote{};
294 bool graceNote{};
295 bool floatRest{};
296 bool isHidden{};
297 bool voice2{};
298 bool articDetail{};
299 bool noteDetail{};
300 bool dotTieAlt{};
301 bool tupletStart{};
302 bool beamExt{};
303 bool beam{};
304 bool secBeam{};
305 bool doubleStem{};
306 bool splitStem{};
308 bool crossStaff{};
309 bool freezeStem{};
310 bool upStem{};
311 bool noLeger{};
312 bool stemDetail{};
316 bool sorted{};
317 bool noPlayback{};
318 bool lyricDetail{};
320 bool freezeBeam{};
321
323 std::vector<std::shared_ptr<Note>> notes;
324
326 EntryNumber getEntryNumber() const { return m_entnum; }
327
331 std::shared_ptr<Entry> getNext() const;
332
336 std::shared_ptr<Entry> getPrevious() const;
337
341 std::pair<NoteType, unsigned> calcNoteInfo() const { return calcNoteInfoFromEdu(duration); }
342
347
350 bool hasStem() const { return duration < Edu(NoteType::Whole); }
351
357 { return !isNote && !isHidden && !voice2 && duration == Edu(NoteType::Whole); }
358
359 void integrityCheck() override
360 {
361 this->Base::integrityCheck();
362 if (size_t(numNotes) != notes.size()) {
363 MUSX_INTEGRITY_ERROR("Entry " + std::to_string(m_entnum) + " has an incorrect number of notes.");
364 }
365 }
366
367 bool requireAllFields() const override { return false; }
368
369 constexpr static std::string_view XmlNodeName = "entry";
371
372private:
373 EntryNumber m_entnum;
374 EntryNumber m_prev;
375 EntryNumber m_next;
376
377};
378
379class EntryInfo;
380class EntryFrame;
381class NoteInfoPtr;
382
387{
388public:
390 EntryInfoPtr() : m_entryFrame(nullptr), m_indexInFrame(0) {}
391
397 explicit EntryInfoPtr(const std::shared_ptr<const EntryFrame>& entryFrame, size_t index = 0)
398 : m_entryFrame(entryFrame), m_indexInFrame(index) {}
399
401 const std::shared_ptr<const EntryInfo> operator->() const;
402
404 operator bool() const;
405
408 bool isSameEntry(const EntryInfoPtr& src) const;
409
411 std::shared_ptr<const EntryFrame> getFrame() const { return m_entryFrame; }
412
414 size_t getIndexInFrame() const { return m_indexInFrame; }
415
418
420 InstCmper getStaff() const;
421
424 std::shared_ptr<others::StaffComposite> createCurrentStaff(const std::optional<InstCmper>& forStaffId = std::nullopt) const;
425
427 MeasCmper getMeasure() const;
428
430 std::shared_ptr<KeySignature> getKeySignature() const;
431
433 unsigned calcReverseGraceIndex() const;
434
436 std::optional<size_t> calcNextTupletIndex(std::optional<size_t> currentIndex) const;
437
440
444
449
453
456
461
467 EntryInfoPtr getNextInVoice(int voice) const;
468
474 EntryInfoPtr getPreviousInVoice(int voice) const;
475
477 EntryInfoPtr getNextInBeamGroup(bool includeHiddenEntries = false) const
478 { return iterateBeamGroup<&EntryInfoPtr::nextPotentialInBeam, &EntryInfoPtr::previousPotentialInBeam>(includeHiddenEntries); }
479
481 EntryInfoPtr getPreviousInBeamGroup(bool includeHiddenEntries = false) const
482 { return iterateBeamGroup<&EntryInfoPtr::previousPotentialInBeam, &EntryInfoPtr::nextPotentialInBeam>(includeHiddenEntries); }
483
486 bool calcDisplaysAsRest() const;
487
490 bool calcUnbeamed() const;
491
493 bool calcIsBeamStart() const;
494
499 bool calcIsFeatheredBeamStart(Evpu& outLeftY, Evpu& outRightY) const;
500
506
510
512 unsigned calcNumberOfBeams() const;
513
516 unsigned calcLowestBeamStart() const;
517
520 unsigned calcLowestBeamEnd() const;
521
524 unsigned calcLowestBeamStub() const;
525
531 bool calcBeamStubIsLeft() const;
532
535
538
540 bool canBeBeamed() const;
541
544 int calcEntrySize() const;
545
550 bool calcIsCue() const;
551
554 bool calcIsFullMeasureRest() const;
555
559 bool calcIsBeamedRestWorkaroud() const;
560
561private:
562 unsigned calcVisibleBeams() const;
563
564 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
565 std::optional<unsigned> iterateFindRestsInSecondaryBeam(const EntryInfoPtr nextOrPrevInBeam) const;
566
567 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
568 EntryInfoPtr iteratePotentialEntryInBeam() const;
569
570 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
571 bool iterateNotesExistLeftOrRight() const;
572
573 EntryInfoPtr nextPotentialInBeam(bool includeHiddenEntries) const;
574
575 EntryInfoPtr previousPotentialInBeam(bool includeHiddenEntries) const;
576
577 template<EntryInfoPtr(EntryInfoPtr::* Iterator)(bool) const, EntryInfoPtr(EntryInfoPtr::* ReverseIterator)(bool) const>
578 EntryInfoPtr iterateBeamGroup(bool includeHiddenEntries) const;
579
580 std::shared_ptr<const EntryFrame> m_entryFrame;
581 size_t m_indexInFrame{};
582};
583
590class EntryFrame : public std::enable_shared_from_this<EntryFrame>
591{
592public:
599 explicit EntryFrame(const details::GFrameHoldContext& gfhold, LayerIndex layerIndex, util::Fraction timeStretch) :
600 m_context(gfhold),
601 m_layerIndex(layerIndex),
602 m_timeStretch(timeStretch)
603 {
604 }
605
608 {
609 std::shared_ptr<const details::TupletDef> tuplet;
610 size_t startIndex;
611 size_t endIndex;
614 bool voice2;
615
617 TupletInfo(const std::weak_ptr<const EntryFrame>& parent, const std::shared_ptr<const details::TupletDef>& tup, size_t index, util::Fraction start, bool forVoice2)
618 : tuplet(tup), startIndex(index), endIndex(std::numeric_limits<size_t>::max()),
619 startDura(start), endDura(-1), voice2(forVoice2), m_parent(parent)
620 {}
621
633 bool calcIsTremolo() const;
634
648 bool calcCreatesSingletonRight() const { return calcCreatesSingleton(false); }
649
659 bool calcCreatesSingletonLeft() const { return calcCreatesSingleton(true); }
660
670
680
691 // - the independent display time signature matches the tuplet's total display duration
692 bool calcCreatesTimeStretch() const;
693
694 private:
695 bool calcCreatesSingleton(bool left) const;
696
697 const std::weak_ptr<const EntryFrame> m_parent;
698 };
699
706 std::vector<TupletInfo> tupletInfo;
707 std::shared_ptr<KeySignature> keySignature;
708
710 DocumentPtr getDocument() const;
711
713 Cmper getRequestedPartId() const { return m_context.getRequestedPartId(); }
714
716 InstCmper getStaff() const;
717
719 MeasCmper getMeasure() const;
720
722 LayerIndex getLayerIndex() const { return m_layerIndex; }
723
726 util::Fraction getTimeStretch() const { return m_timeStretch; }
727
729 const std::vector<std::shared_ptr<const EntryInfo>>& getEntries() const
730 { return m_entries; }
731
735 EntryInfoPtr getFirstInVoice(int voice) const;
736
740 EntryInfoPtr getLastInVoice(int voice) const;
741
743 void addEntry(const std::shared_ptr<const EntryInfo>& entry)
744 { m_entries.emplace_back(entry); }
745
748 std::shared_ptr<const EntryFrame> getNext() const;
749
752 std::shared_ptr<const EntryFrame> getPrevious() const;
753
757 std::shared_ptr<others::StaffComposite> createCurrentStaff(Edu eduPosition, const std::optional<InstCmper>& forStaffId = std::nullopt) const;
758
760 std::shared_ptr<others::Measure> getMeasureInstance() const;
761
766 bool calcIsCueFrame() const;
767
768private:
770 LayerIndex m_layerIndex;
771 util::Fraction m_timeStretch;
772
773 std::vector<std::shared_ptr<const EntryInfo>> m_entries;
774};
775
776namespace details {
777class GFrameHold;
778} // namespace details
779
789{
794 explicit EntryInfo(const std::shared_ptr<const Entry>& entry)
795 : m_entry(entry) {}
796
797#ifndef DOXYGEN_SHOULD_IGNORE_THIS
799#endif
800
801public:
806 bool v2Launch{};
807 unsigned graceIndex{};
811
814 std::shared_ptr<const Entry> getEntry() const
815 {
816 auto retval = m_entry.lock();
817 if (!retval) {
818 throw std::logic_error("Entry pointer is no longer valid");
819 }
820 return retval;
821 }
822
826
827private:
828 std::weak_ptr<const Entry> m_entry;
829};
830
833{
834public:
836 NoteInfoPtr() : m_entry(), m_noteIndex(0) {}
837
841 NoteInfoPtr(const EntryInfoPtr& entryInfo, size_t noteIndex)
842 : m_entry(entryInfo), m_noteIndex(noteIndex)
843 {}
844
846 operator bool() const
847 { return m_entry && m_noteIndex < m_entry->getEntry()->notes.size(); }
848
850 bool isSameNote(const NoteInfoPtr& src) const
851 { return m_entry.isSameEntry(src.m_entry) && m_noteIndex == src.m_noteIndex; }
852
856 NoteInfoPtr findEqualPitch(const EntryInfoPtr& entry) const;
857
859 std::shared_ptr<const Note> operator->() const
860 {
861 MUSX_ASSERT_IF(m_noteIndex >= m_entry->getEntry()->notes.size()) {
862 throw std::logic_error("Note index is too large for notes array.");
863 }
864 return m_entry->getEntry()->notes[m_noteIndex];
865 }
866
869 { return m_entry; }
870
882 Note::NoteProperties calcNoteProperties(const std::optional<bool>& enharmonicRespell = std::nullopt) const;
883
891
899
902 std::shared_ptr<others::PercussionNoteInfo> calcPercussionNoteInfo() const;
903
907 NoteInfoPtr calcTieTo() const;
908
912 NoteInfoPtr calcTieFrom() const;
913
915 InstCmper calcStaff() const;
916
919 std::unique_ptr<music_theory::Transposer> createTransposer() const;
920
924 {
925 if (m_noteIndex >= m_entry->getEntry()->notes.size()) {
926 return NoteInfoPtr();
927 }
928 return NoteInfoPtr(m_entry, m_noteIndex + 1);
929 }
930
934 {
935 if (m_noteIndex <= 0) {
936 return NoteInfoPtr();
937 }
938 return NoteInfoPtr(m_entry, m_noteIndex - 1);
939 }
940
942 bool calcIsEnharmonicRespell() const;
943
944private:
948 bool isSamePitchValues(const NoteInfoPtr& src) const
949 {
950 if (!*this || !src) {
951 return false;
952 }
953 return (*this)->harmLev == src->harmLev
954 && (*this)->harmAlt == src->harmAlt;
955 }
956
957 EntryInfoPtr m_entry;
958 size_t m_noteIndex;
959};
960
961} // namespace dom
962} // 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:591
util::Fraction getTimeStretch() const
Get the time stretch in this frame. Rather than accessing this value directly, consider using EntryIn...
Definition Entries.h:726
EntryInfoPtr getLastInVoice(int voice) const
Returns the last entry in the specified v1/v2 or null if none.
Definition Implementations.cpp:228
InstCmper getStaff() const
Get the staff for the entry.
Definition Implementations.cpp:207
MeasCmper getMeasure() const
Get the measure for the entry frame.
Definition Implementations.cpp:209
std::shared_ptr< others::Measure > getMeasureInstance() const
Get the measure instance.
Definition Implementations.cpp:262
std::shared_ptr< const EntryFrame > getPrevious() const
Gets the entry frame for the previous measure with the same staff and layer.
Definition Implementations.cpp:246
void addEntry(const std::shared_ptr< const EntryInfo > &entry)
Add an entry to the list.
Definition Entries.h:743
const std::vector< std::shared_ptr< const EntryInfo > > & getEntries() const
Get the entry list.
Definition Entries.h:729
bool calcIsCueFrame() const
Calculates if this entry frame is part of a cue.
Definition Implementations.cpp:267
EntryInfoPtr getFirstInVoice(int voice) const
Returns the first entry in the specified v1/v2 or null if none.
Definition Implementations.cpp:211
EntryFrame(const details::GFrameHoldContext &gfhold, LayerIndex layerIndex, util::Fraction timeStretch)
Constructor function.
Definition Entries.h:599
Cmper getRequestedPartId() const
Get the requested part ID for the entry frame.
Definition Entries.h:713
std::shared_ptr< others::StaffComposite > createCurrentStaff(Edu eduPosition, const std::optional< InstCmper > &forStaffId=std::nullopt) const
Creates a current StaffComposite for the entry frame.
Definition Implementations.cpp:256
std::shared_ptr< KeySignature > keySignature
this can be different than the measure key sig if the staff has independent key signatures
Definition Entries.h:707
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry frame.
Definition Entries.h:722
DocumentPtr getDocument() const
Get the document for the entry frame.
Definition Implementations.cpp:205
std::vector< TupletInfo > tupletInfo
A list of the tuplets in the frame and their calculated starting and ending information.
Definition Entries.h:706
std::shared_ptr< const EntryFrame > getNext() const
Gets the entry frame for the next measure with the same staff and layer.
Definition Implementations.cpp:238
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:387
EntryInfoPtr getNextInFrame() const
Get the next entry in the frame.
Definition Implementations.cpp:568
EntryInfoPtr(const std::shared_ptr< const EntryFrame > &entryFrame, size_t index=0)
Constructor function.
Definition Entries.h:397
bool calcIsCue() const
Calculates if this entry is part of a cue.
Definition Implementations.cpp:1041
EntryInfoPtr getNextSameV() const
Get the next entry in the frame in the same voice.
Definition Implementations.cpp:576
size_t getIndexInFrame() const
Returns the index within the frame.
Definition Entries.h:414
util::Fraction calcGlobalElapsedDuration() const
Calculates the elapsed duration in global edu, removing any time stretch due to independent time sign...
Definition Implementations.cpp:893
EntryInfoPtr getPreviousInVoice(int voice) const
Returns the previous entry in the frame in the specified v1/v2 or null if none.
Definition Implementations.cpp:637
unsigned calcReverseGraceIndex() const
Caclulates the grace index counting leftward (used by other standards such as MNX)
Definition Implementations.cpp:530
bool canBeBeamed() const
Determines if this entry can be beamed.
Definition Implementations.cpp:661
std::shared_ptr< KeySignature > getKeySignature() const
Get the key signature of the entry.
Definition Implementations.cpp:523
bool isSameEntry(const EntryInfoPtr &src) const
Returns whether the input and the current instance refer to the same entry.
Definition Implementations.cpp:509
EntryInfoPtr getPreviousInLayer() const
Get the previous entry in the same layer and staff. This can be in the previous measure.
Definition Implementations.cpp:593
EntryInfoPtr getNextInLayer() const
Get the next entry in the same layer and staff. This can be in the next measure.
Definition Implementations.cpp:557
unsigned calcLowestBeamStub() const
Returns the lowest beam stub at this entry, where 2 = 16th note stub, 3 = 32nd note stub,...
Definition Implementations.cpp:834
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:477
std::shared_ptr< others::StaffComposite > createCurrentStaff(const std::optional< InstCmper > &forStaffId=std::nullopt) const
Creates the current StaffComposite for the entry.
Definition Implementations.cpp:525
unsigned calcLowestBeamStart() const
Returns the lowest beam number starting at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:781
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:481
unsigned calcLowestBeamEnd() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:811
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Implementations.cpp:517
unsigned calcNumberOfBeams() const
Calculates the number of beams or flags on the entry.
Definition Implementations.cpp:730
EntryInfoPtr getPreviousInFrame() const
Get the previous entry in the frame.
Definition Implementations.cpp:604
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:411
EntryInfoPtr findBeamStartOrCurrent() const
Finds the first entry of a beamed group or returns the current entry if it is not beams.
Definition Implementations.cpp:681
bool calcDisplaysAsRest() const
Calculates if an entry displays as a rest.
Definition Implementations.cpp:647
EntryInfoPtr findBeamEnd() const
Finds the end entry of a beamed group.
Definition Implementations.cpp:698
int calcEntrySize() const
Returns the entry size as a percentage, taking into account the beaming.
Definition Implementations.cpp:1027
bool calcIsBeamStart() const
Returns whether this is the start of a primary beam.
Definition Implementations.cpp:674
EntryInfoPtr getPreviousSameV() const
Get the previous entry in the frame in the same voice.
Definition Implementations.cpp:612
EntryInfoPtr getNextInVoice(int voice) const
Returns the next entry in the frame in the specified v1/v2 or null if none.
Definition Implementations.cpp:627
const std::shared_ptr< const EntryInfo > operator->() const
Allows -> access to the underlying EntryInfo instance.
Definition Implementations.cpp:493
InstCmper getStaff() const
Get the staff cmper.
Definition Implementations.cpp:519
bool calcUnbeamed() const
Returns whether this is an unbeamed entry.
Definition Implementations.cpp:652
EntryInfoPtr()
Default constructor.
Definition Entries.h:390
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:542
bool calcIsBeamedRestWorkaroud() const
A common workaround in Finale is to hide a rest in v1 and supply it in v2. Typicall it is used when a...
Definition Implementations.cpp:1073
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:844
bool calcIsFullMeasureRest() const
Returns whether this is a full measure rest.
Definition Implementations.cpp:1065
util::Fraction calcGlobalActualDuration() const
Calculates the actual duration in global edu, removing any time stretch due to independent time signa...
Definition Implementations.cpp:898
MeasCmper getMeasure() const
Get the measure cmper.
Definition Implementations.cpp:521
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:992
Information an entry along with the entry.
Definition Entries.h:789
bool v2Launch
indicates if this entry (which is voice1) launches a voice2 sequence
Definition Entries.h:806
unsigned graceIndex
Definition Entries.h:807
ClefIndex clefIndex
the clef index in effect for the entry.
Definition Entries.h:809
util::Fraction calcNextElapsedDuration() const
Calculates the next duration position after this entry.
Definition Entries.h:824
std::shared_ptr< const Entry > getEntry() const
Get the entry.
Definition Entries.h:814
util::Fraction elapsedDuration
Definition Entries.h:802
ClefIndex clefIndexConcert
the concert clef index in effect for the entry.
Definition Entries.h:810
util::Fraction actualDuration
Definition Entries.h:804
Represents an entry containing metadata and notes.
Definition Entries.h:270
bool splitStem
Definition Entries.h:306
bool upStem
Whether a stem is up or down. (Only reliable when freezeStem is true.)
Definition Entries.h:310
Entry(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
Constructor function.
Definition Entries.h:276
EntryNumber getEntryNumber() const
Gets the entry number for this entry.
Definition Entries.h:326
bool articDetail
Indicates there is an articulation on the entry.
Definition Entries.h:298
std::pair< NoteType, unsigned > calcNoteInfo() const
Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu....
Definition Entries.h:341
bool isNote
If this value is false, the entry is a rest.
Definition Entries.h:293
bool noLeger
Hide ledger lines.
Definition Entries.h:311
bool freezeStem
Freeze stem flag (upStem gives the direction.)
Definition Entries.h:309
bool noPlayback
Indicates that the entry should not be played back.
Definition Entries.h:317
bool voice2
This is a V2 note. (xml node <v2>)
Definition Entries.h:297
bool beamExt
Indicates that there is a beam extension on the entry.
Definition Entries.h:302
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Entries.h:369
bool secBeam
Signifies a secondary beam break occurs on the entry.
Definition Entries.h:304
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:359
bool stemDetail
Indicates there are stem modifications.
Definition Entries.h:312
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:292
Evpu hOffset
Manual offset created with the Note Position Tool. (xml node is <posi>.)
Definition Entries.h:291
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:323
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:367
bool noteDetail
Indicates there is a note detail or EntrySize record for the entry.
Definition Entries.h:299
util::Fraction calcFraction() const
Calculates the duration as a util::Fraction of a whole note.
Definition Entries.h:346
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:350
bool crossStaff
Signifies that at least one note in the entry has been cross staffed.
Definition Entries.h:308
bool floatRest
Is floating rest. If false, the first note element gives the staff position of the rest.
Definition Entries.h:295
bool smartShapeDetail
Indicates this entry has a smart shape assignment.
Definition Entries.h:315
Edu duration
Duration of the entry, not taking into account tuplets.
Definition Entries.h:289
bool isHidden
Indicates the entry is hidden, (xml node is <ignore>)
Definition Entries.h:296
bool tupletStart
Indicates that a tuplet start on the entry.
Definition Entries.h:301
bool lyricDetail
Indicates there is a lyric assignment on the entry.
Definition Entries.h:318
int numNotes
Number of notes in the entry. There is an error if this is not the same as notes.size().
Definition Entries.h:290
bool sorted
Sorted flag.
Definition Entries.h:316
bool reverseDownStem
Indicates that a stem normally down is reversed.
Definition Entries.h:314
bool reverseUpStem
Indicates that a stem normally up is reversed.
Definition Entries.h:313
bool doubleStem
Creates a double stem on the entry. (Appears to be exclusive with splitStem.)
Definition Entries.h:305
bool isPossibleFullMeasureRest() const
Returns true if the entry could be a full-measure rest.
Definition Entries.h:356
bool beam
Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry....
Definition Entries.h:303
bool performanceData
Indicates there is performance data on the entry.
Definition Entries.h:319
bool dotTieAlt
Indicates dot or tie alterations are present.
Definition Entries.h:300
bool freezeBeam
Freeze beam flag (Derived from the presence of <freezeBeam> node.)
Definition Entries.h:320
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:294
std::shared_ptr< Entry > getPrevious() const
Gets the previous entry in this list or nullptr if none.
Definition Implementations.cpp:169
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:205
Wraps an EntryInfo instance and a note index.
Definition Entries.h:833
InstCmper calcStaff() const
Calculates the staff number, taking into account cross staffing.
Definition Implementations.cpp:2391
Note::NoteProperties 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:2401
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:868
bool isSameNote(const NoteInfoPtr &src) const
Returns whether the input and the current instance refer to the same note.
Definition Entries.h:850
NoteInfoPtr getPrevious() const
Gets the next note in a chord on the same entry.
Definition Entries.h:933
std::shared_ptr< const Note > operator->() const
Allows -> access to the underlying Note instance.
Definition Entries.h:859
std::shared_ptr< others::PercussionNoteInfo > calcPercussionNoteInfo() const
Calculates the percussion note info for this note, if any.
Definition Implementations.cpp:2440
Note::NoteProperties calcNotePropertiesConcert() const
Calculates the note name, octave number, actual alteration, and staff position for the concert pitch ...
Definition Implementations.cpp:2416
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:2364
bool calcIsEnharmonicRespell() const
Returns if this note is enharmonically respelled in the current part view.
Definition Implementations.cpp:2466
NoteInfoPtr(const EntryInfoPtr &entryInfo, size_t noteIndex)
Constructor.
Definition Entries.h:841
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:2319
Note::NoteProperties calcNotePropertiesInView() const
Calculates the note name, octave number, actual alteration, and staff position for the pitch of the n...
Definition Implementations.cpp:2430
NoteInfoPtr findEqualPitch(const EntryInfoPtr &entry) const
Finds a note with the same pitch in the supplied entry.
Definition Implementations.cpp:2294
NoteInfoPtr getNext() const
Gets the next note in a chord on the same entry.
Definition Entries.h:923
NoteInfoPtr()
Default constructor.
Definition Entries.h:836
std::unique_ptr< music_theory::Transposer > createTransposer() const
Creates a transposer for this Note instance.
Definition Implementations.cpp:2461
Represents a single note element in an entry.
Definition Entries.h:164
bool upStemSecond
When the entry is upstem, it is drawn on the "wrong" side of the stem.
Definition Entries.h:202
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:255
std::tuple< Note::NoteName, int, int, int > NoteProperties
Note properites. A tuple containing:
Definition Entries.h:194
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:198
static constexpr NoteNumber RESTID
Non floating rests have a note with this noteId that defines their staff positions.
Definition Entries.h:173
int harmAlt
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7.
Definition Entries.h:197
bool upSplitStem
Definition Entries.h:206
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:214
bool tieEnd
Indicates a tie ends on this note.
Definition Entries.h:201
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:2212
Note(const DocumentWeakPtr &document, NoteNumber noteId)
Constructor function.
Definition Entries.h:167
bool tieStart
Indicates a tie starts on this note.
Definition Entries.h:200
bool crossStaff
Signifies that the note has a details::CrossStaff note detail.
Definition Entries.h:199
NoteProperties calcNoteProperties(const std::shared_ptr< KeySignature > &key, KeySignature::KeyContext ctx, 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:2247
int harmLev
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signatu...
Definition Entries.h:196
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:204
NoteName
The available note names, in array order.
Definition Entries.h:177
bool parenAcci
True if the accidental has parentheses.
Definition Entries.h:209
bool showAcci
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set....
Definition Entries.h:208
bool freezeAcci
True if the accidental should be forced on or off (based on showAcci.)
Definition Entries.h:210
A context wrapper for GFrameHold associated with a specific part and location.
Definition Entries.h:57
const GFrameHold * operator->() const
Provides const pointer-style access to the underlying GFrameHold.
Definition Entries.h:81
std::map< LayerIndex, bool > calcVoices() const
Calculates the number of voices used by the GFrameHold instance.
Definition Implementations.cpp:1504
std::shared_ptr< const EntryFrame > createEntryFrame(LayerIndex layerIndex) const
Returns the EntryFrame for all entries in the given layer.
Definition Implementations.cpp:1365
ClefIndex calcClefIndexAt(util::Fraction position) const
Returns the clef index in effect for at the specified util::Fraction position (as a fraction of whole...
Definition Entries.h:98
bool calcIsCuesOnly() const
Calculates if this staff in this measure contains only a cue layer and full-measure rest layers.
Definition Implementations.cpp:1554
bool iterateEntries(LayerIndex layerIndex, std::function< bool(const EntryInfoPtr &)> iterator)
iterates the entries for the specified layer in this GFrameHold from left to right
Definition Implementations.cpp:1481
Cmper getRequestedPartId() const
Returns the requested part ID associated with this context.
Definition Entries.h:74
ClefIndex calcClefIndexAt(Edu position) const
Returns the clef index in effect for at the specified Edu position. This function does not take into ...
Definition Implementations.cpp:1528
Represents the attributes of a Finale frame holder.
Definition Details.h:652
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
dom::Edu calcEduDuration() const
Calculates duration as a fraction of a whole note.
Definition Fraction.cpp:36
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:716
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:608
size_t startIndex
the index of the first entry in the tuplet
Definition Entries.h:610
bool calcIsTremolo() const
Calculates if this tuplet represents a tremolo based on the following criteria.
Definition Implementations.cpp:283
bool calcCreatesSingletonLeft() const
Calculates if this tuplet is being used to create a singleton beam to the left.
Definition Entries.h:659
size_t endIndex
the index of the last entry in the tuplet
Definition Entries.h:611
util::Fraction endDura
the actual duration where the tuplet ends
Definition Entries.h:613
std::shared_ptr< const details::TupletDef > tuplet
the tuplet
Definition Entries.h:609
bool calcCreatesBeamContinuationRight() const
Calculates if this tuplet creates a beam continuation over a barline to the right,...
Definition Implementations.cpp:402
util::Fraction startDura
the actual duration where the tuplet starts
Definition Entries.h:612
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:617
bool voice2
whether this tuplet is for voice2
Definition Entries.h:614
bool calcCreatesSingletonRight() const
Calculates if this tuplet is being used to create a singleton beam to the right.
Definition Entries.h:648
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:432
bool calcCreatesTimeStretch() const
Detects tuplets being used to create time stretch in an independent time signature.
Definition Implementations.cpp:456