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
32namespace music_theory {
33enum class NoteName : int;
34class Transposer;
35} // namespace music_theory
36
37namespace musx {
38namespace dom {
39
40namespace others {
41class Frame;
42class PercussionNoteInfo;
43class Staff;
44class StaffComposite;
45class StaffUsed;
46} // namespace others
47
48namespace details {
49class TupletDef;
50class GFrameHold;
51
60public:
71 GFrameHoldContext(const DocumentPtr& document, Cmper partId, Cmper staffId, Cmper measureId, util::Fraction timeOffset = 0);
72
78 Cmper getRequestedPartId() const { return m_requestedPartId; }
79
85 const GFrameHold* operator->() const { return m_hold.get(); }
86
92 explicit operator bool() const noexcept { return static_cast<bool>(m_hold); }
93
97 ClefIndex calcClefIndexAt(Edu position) const;
98
103 { return calcClefIndexAt(position.calcEduDuration()); }
104
110 std::shared_ptr<const EntryFrame> createEntryFrame(LayerIndex layerIndex) const;
111
119 bool iterateEntries(LayerIndex layerIndex, std::function<bool(const EntryInfoPtr&)> iterator) const;
120
126 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator) const;
127
131 std::map<LayerIndex, int> calcVoices(bool excludeHidden = false) const;
132
135 bool calcIsCuesOnly(bool includeVisibleInScore = false) const;
136
144 EntryInfoPtr calcNearestEntry(util::Fraction position, bool findExact = true, std::optional<LayerIndex> matchLayer = std::nullopt,
145 std::optional<bool> matchVoice2 = std::nullopt, util::Fraction atGraceNoteDuration = 0) const;
146
153
154private:
156 Cmper m_requestedPartId;
157 util::Fraction m_timeOffset;
158};
159
160} // namespace details
161
171std::pair<NoteType, unsigned> calcNoteInfoFromEdu(Edu duration);
172
174unsigned calcNumberOfBeamsInEdu(Edu duration);
175
182class Note : public Base
183{
184public:
186 explicit Note(const DocumentWeakPtr& document, NoteNumber noteId)
187 : Base(document, 0, ShareMode::All), m_noteId(noteId)
188 {
189 }
190
192 static constexpr NoteNumber RESTID = 31;
193
201 using NoteProperties = std::tuple<music_theory::NoteName, int, int, int>;
202
203 int harmLev{};
204 int harmAlt{};
205 bool isValid{};
206 bool tieStart{};
207 bool tieEnd{};
208 bool crossStaff{};
213 bool upSplitStem{};
215 bool showAcci{};
216 bool parenAcci{};
217 bool noPlayback{};
218 bool noSpacing{};
219 bool freezeAcci{};
221
224 NoteNumber getNoteId() const { return m_noteId; }
225
236 std::pair<int, int> calcDefaultEnharmonic(const MusxInstance<KeySignature>& key) const;
237
264 const MusxInstance<others::PercussionNoteInfo>& percNoteInfo, const MusxInstance<others::Staff>& staff = nullptr, bool respellEnharmonic = false) const;
265
267
268private:
269 NoteNumber m_noteId{};
270};
271
278class Entry : public Base
279{
280public:
285 explicit Entry(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
286 : Base(document, partId, shareMode), m_entnum(entnum), m_prev(prev), m_next(next)
287 {
288 }
289
299 int numNotes{};
301 bool isValid{};
302 bool isNote{};
303 bool v2Launch{};
304 bool voice2{};
305 bool createdByHP{};
307 bool graceNote{};
308 bool noteDetail{};
309 bool articDetail{};
310 bool lyricDetail{};
311 bool tupletStart{};
312 bool splitRest{};
314 bool floatRest{};
315 bool isHidden{};
316 bool beamExt{};
317 bool flipTie{};
318 bool dotTieAlt{};
319 bool beam{};
320 bool secBeam{};
322 bool stemDetail{};
323 bool crossStaff{};
326 bool doubleStem{};
327 bool splitStem{};
329 bool upStemScore{};
330 bool checkAccis{};
331 bool dummy{};
334 bool noLeger{};
335 bool sorted{};
336 bool slashGrace{};
339 bool flatBeam{};
340 bool noPlayback{};
341 bool noSpacing{};
342 bool freezeBeam{};
343
345 std::vector<std::shared_ptr<Note>> notes;
346
352 std::vector<std::tuple<StaffCmper, MeasCmper, LayerIndex>> locations;
353
355 EntryNumber getEntryNumber() const { return m_entnum; }
356
361
366
370 std::pair<NoteType, unsigned> calcNoteInfo() const { return calcNoteInfoFromEdu(duration); }
371
376
379 bool hasStem() const { return duration < Edu(NoteType::Whole); }
380
386 { return !isNote && !isHidden && duration == Edu(NoteType::Whole); }
387
388 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
389 {
390 this->Base::integrityCheck(ptrToThis);
391 if (size_t(numNotes) != notes.size()) {
392 MUSX_INTEGRITY_ERROR("Entry " + std::to_string(m_entnum) + " has an incorrect number of notes.");
393 }
394 }
395
398 static void calcLocations(const DocumentPtr& document);
399
400 constexpr static std::string_view XmlNodeName = "entry";
402
403private:
404 EntryNumber m_entnum;
405 EntryNumber m_prev;
406 EntryNumber m_next;
407};
408
409class EntryInfo;
410class EntryFrame;
411class NoteInfoPtr;
412
417{
418public:
422 {
423 Normal,
424 IncludeAll,
430 };
431
432 class InterpretedIterator;
433
435 EntryInfoPtr() : m_entryFrame(nullptr), m_indexInFrame(0) {}
436
442 explicit EntryInfoPtr(const std::shared_ptr<const EntryFrame>& entryFrame, size_t index = 0)
443 : m_entryFrame(entryFrame), m_indexInFrame(index) {}
444
454 [[nodiscard]]
455 static EntryInfoPtr fromPositionOrNull(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measureId,
456 EntryNumber entryNumber, util::Fraction timeOffset = 0);
457
468 [[nodiscard]]
469 static EntryInfoPtr fromEntryNumber(const DocumentPtr& document, Cmper partId, EntryNumber entryNumber, util::Fraction timeOffset = 0);
470
472 const std::shared_ptr<const EntryInfo> operator->() const;
473
475 operator bool() const noexcept;
476
478 [[nodiscard]] int getVoice() const;
479
482 [[nodiscard]] bool isSameEntry(const EntryInfoPtr& src) const;
483
492 [[nodiscard]] bool calcIsSamePitchContent(const EntryInfoPtr& src, bool compareConcert = true) const;
493
506 [[nodiscard]]
507 bool calcIsSamePitchContentAndDuration(const EntryInfoPtr& src, bool compareConcert = true, bool requireSameVoice = true, bool requireSameGraceElapsedDura = false) const;
508
510 [[nodiscard]] std::shared_ptr<const EntryFrame> getFrame() const { return m_entryFrame; }
511
513 [[nodiscard]] size_t getIndexInFrame() const { return m_indexInFrame; }
514
516 [[nodiscard]] LayerIndex getLayerIndex() const;
517
519 [[nodiscard]] StaffCmper getStaff() const;
520
523 [[nodiscard]] MusxInstance<others::StaffComposite> createCurrentStaff(const std::optional<StaffCmper>& forStaffId = std::nullopt) const;
524
526 [[nodiscard]] MeasCmper getMeasure() const;
527
529 [[nodiscard]] MusxInstance<KeySignature> getKeySignature() const;
530
533
536 [[nodiscard]] Evpu calcManuaOffset() const;
537
539 [[nodiscard]] unsigned calcReverseGraceIndex() const;
540
544 [[nodiscard]] util::Fraction calcGraceElapsedDuration() const;
545
547 [[nodiscard]] std::optional<size_t> calcNextTupletIndex(std::optional<size_t> currentIndex = 0) const;
548
550 [[nodiscard]] EntryInfoPtr getNextInFrame() const;
551
554 [[nodiscard]] EntryInfoPtr getNextInLayer() const;
555
559 [[nodiscard]] EntryInfoPtr getNextSameV() const;
560
563 [[nodiscard]] EntryInfoPtr getNextSameVNoGrace() const;
564
567 [[nodiscard]] EntryInfoPtr getPreviousInLayer() const;
568
570 [[nodiscard]] EntryInfoPtr getPreviousInFrame() const;
571
575 [[nodiscard]] EntryInfoPtr getPreviousSameV() const;
576
579 [[nodiscard]] EntryInfoPtr getPreviousSameVNoGrace() const;
580
586 [[nodiscard]] EntryInfoPtr getNextInVoice(int voice) const;
587
593 [[nodiscard]] EntryInfoPtr getPreviousInVoice(int voice) const;
594
597 [[nodiscard]] InterpretedIterator asInterpretedIterator(bool remapBeamOverBarlineEntries = true) const;
598
600 [[nodiscard]]
602 { return iterateBeamGroup<&EntryInfoPtr::nextPotentialInBeam, &EntryInfoPtr::previousPotentialInBeam>(beamIterationMode); }
603
605 [[nodiscard]]
607 { return iterateBeamGroup<&EntryInfoPtr::previousPotentialInBeam, &EntryInfoPtr::nextPotentialInBeam>(beamIterationMode); }
608
613
618
621 [[nodiscard]] bool calcDisplaysAsRest() const;
622
626 [[nodiscard]] std::pair<int, int> calcTopBottomStaffPositions() const;
627
633 [[nodiscard]] std::pair<bool, bool> calcEntryStemSettings() const;
634
638 [[nodiscard]] bool calcUpStemDefault() const;
639
654 [[nodiscard]] bool calcUpStem() const
655 {
656 if (m_upStem.has_value()) {
657 return m_upStem.value();
658 }
659 m_upStem = calcUpStemImpl();
660 return m_upStem.value();
661 }
662
665 [[nodiscard]] bool calcUnbeamed() const;
666
668 [[nodiscard]] bool calcIsBeamStart(BeamIterationMode beamIterationMode = BeamIterationMode::Normal) const;
669
672 [[nodiscard]] bool calcCreatesSingletonBeamLeft() const;
673
676 [[nodiscard]] bool calcCreatesSingletonBeamRight() const;
677
686
695
700 [[nodiscard]] bool calcIsFeatheredBeamStart(Evpu& outLeftY, Evpu& outRightY) const;
701
706 [[nodiscard]] EntryInfoPtr findBeamStartOrCurrent() const;
707
710 [[nodiscard]] EntryInfoPtr findBeamEnd() const;
711
713 [[nodiscard]] unsigned calcNumberOfBeams() const;
714
718 [[nodiscard]] unsigned calcLowestBeamStart(bool considerBeamOverBarlines = false) const;
719
722 [[nodiscard]] unsigned calcLowestBeamEnd() const;
723
727 [[nodiscard]] unsigned calcLowestBeamEndAcrossBarlines() const;
728
731 [[nodiscard]] unsigned calcLowestBeamStub() const;
732
738 [[nodiscard]] bool calcBeamStubIsLeft() const;
739
741 [[nodiscard]] util::Fraction calcGlobalElapsedDuration() const;
742
744 [[nodiscard]] util::Fraction calcGlobalActualDuration() const;
745
747 [[nodiscard]] bool calcCanBeBeamed() const;
748
750 [[nodiscard]] bool calcBeamMustStartHere() const;
751
754 [[nodiscard]] int calcEntrySize() const;
755
761 [[nodiscard]] bool calcIsCue(bool includeVisibleInScore = false) const;
762
765 [[nodiscard]] bool calcIsFullMeasureRest() const;
766
770 [[nodiscard]] bool calcIsBeamedRestWorkaroundHiddenRest() const;
771
775 [[nodiscard]] bool calcIsBeamedRestWorkaroundVisibleRest() const;
776
779 [[nodiscard]] std::vector<size_t> findTupletInfo() const;
780
784 [[nodiscard]] bool calcIfLayerSettingsApply() const;
785
796
798 [[nodiscard]] bool calcIsSingletonGrace() const;
799
805 [[nodiscard]] int calcIsAuxiliaryPitchMarker() const;
806
817 [[nodiscard]] bool calcIsTrillToGraceEntry() const;
818
826 [[nodiscard]] bool calcIsGlissToGraceEntry() const;
827
833
840
846 [[nodiscard]] EntryInfoPtr findMainEntryForGraceNote(bool ignoreRests = false) const;
847
849 bool operator<(const EntryInfoPtr& other) const
850 {
851 if (m_entryFrame != other.m_entryFrame)
852 return m_entryFrame < other.m_entryFrame;
853 return m_indexInFrame < other.m_indexInFrame;
854 }
855
856private:
857 [[nodiscard]] unsigned calcVisibleBeams() const;
858
859 [[nodiscard]] bool calcUpStemImpl() const;
860
861 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
862 [[nodiscard]] std::optional<unsigned> iterateFindRestsInSecondaryBeam(const EntryInfoPtr nextOrPrevInBeam) const;
863
864 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
865 [[nodiscard]] EntryInfoPtr iteratePotentialEntryInBeam() const;
866
867 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
868 [[nodiscard]] bool iterateNotesExistLeftOrRight() const;
869
870 [[nodiscard]] EntryInfoPtr nextPotentialInBeam(BeamIterationMode beamIterationMode) const;
871
872 [[nodiscard]] EntryInfoPtr previousPotentialInBeam(BeamIterationMode beamIterationMode) const;
873
874 using BeamIteratorFn = EntryInfoPtr (EntryInfoPtr::*)(BeamIterationMode) const;
875 template<BeamIteratorFn Iterator, BeamIteratorFn ReverseIterator>
876 [[nodiscard]] EntryInfoPtr iterateBeamGroup(BeamIterationMode beamIterationMode) const;
877
881 [[nodiscard]] EntryInfoPtr findLeftBeamAnchorForBeamOverBarline() const;
882
886 [[nodiscard]] EntryInfoPtr findRightBeamAnchorForBeamOverBarline() const;
887
888 std::shared_ptr<const EntryFrame> m_entryFrame;
889 size_t m_indexInFrame{};
890
892 mutable MusxInstance<others::StaffComposite> m_cachedStaff;
893
895 mutable std::optional<bool> m_upStem;
896};
897
912// the the caller should use for calculating elapsed time.
944{
945 EntryInfoPtr m_entry;
946 bool m_effectiveHidden{};
947 // --------
948 // internal
949 // --------
950 EntryInfoPtr m_iteratedEntry;
951 bool m_useIteratedForBackLaunch{};
952 bool m_remapBeamOverBarlineEntries{};
953
954 [[nodiscard]] const EntryInfoPtr& getIteratedEntry() const noexcept
955 { return m_iteratedEntry ? m_iteratedEntry : m_entry; }
956
957 [[nodiscard]] const EntryInfoPtr& getForwardLaunchEntry() const noexcept
958 { return getIteratedEntry(); }
959
960 [[nodiscard]] const EntryInfoPtr& getBackwardLaunchEntry() const noexcept
961 { return m_useIteratedForBackLaunch ? getIteratedEntry() : m_entry; }
962
966 InterpretedIterator(EntryInfoPtr entry, bool remapBeamOverBarlineEntries);
967
968 friend class EntryFrame;
969 friend class EntryInfoPtr;
970
971public:
974
977 [[nodiscard]] const EntryInfoPtr& getEntryInfo() const noexcept { return m_entry; }
978
982 [[nodiscard]] bool getEffectiveHidden() const noexcept { return m_effectiveHidden; }
983
987 [[nodiscard]] util::Fraction getEffectiveActualDuration(bool global = false) const;
988
992 [[nodiscard]] util::Fraction getEffectiveElapsedDuration(bool global = false) const;
993
997
1000 [[nodiscard]] bool calcIsPastLogicalEndOfFrame() const;
1001
1009 [[nodiscard]] InterpretedIterator getNext() const;
1010
1018 [[nodiscard]] InterpretedIterator getPrevious() const;
1019
1023 explicit operator bool() const noexcept
1024 {
1025 return static_cast<bool>(m_entry);
1026 }
1027};
1028
1035class EntryFrame : public std::enable_shared_from_this<EntryFrame>
1036{
1037public:
1045 explicit EntryFrame(const details::GFrameHoldContext& gfhold, LayerIndex layerIndex, util::Fraction timeStretch, const MusxInstance<others::StaffComposite>& startStaff) :
1046 m_context(gfhold),
1047 m_layerIndex(layerIndex),
1048 m_timeStretch(timeStretch),
1049 m_startStaff(startStaff)
1050 {
1051 }
1052
1055 {
1057 size_t startIndex;
1058 size_t endIndex;
1061 bool voice2;
1062
1064 TupletInfo(const std::weak_ptr<const EntryFrame>& parent, const MusxInstance<details::TupletDef>& tup, size_t index, util::Fraction start, bool forVoice2)
1065 : tuplet(tup), startIndex(index), endIndex((std::numeric_limits<size_t>::max)()),
1066 startDura(start), endDura(-1), voice2(forVoice2), m_parent(parent)
1067 {}
1068
1070 size_t numEntries() const
1071 {
1072 MUSX_ASSERT_IF(startIndex > endIndex) {
1073 throw std::logic_error("TupletInfo has invalid start and end indices.");
1074 }
1075 return endIndex - startIndex + 1;
1076 }
1077
1080 bool includesEntry(const EntryInfoPtr& entryInfo) const
1081 {
1082 const size_t x = entryInfo.getIndexInFrame();
1083 return (x >= startIndex && x <= endIndex);
1084 }
1085
1097 bool calcIsTremolo() const;
1098
1112 bool calcCreatesSingletonBeamRight() const { return calcCreatesSingleton(false); }
1113
1123 bool calcCreatesSingletonBeamLeft() const { return calcCreatesSingleton(true); }
1124
1135 // - the independent display time signature matches the tuplet's total display duration
1136 bool calcCreatesTimeStretch() const;
1137
1138 private:
1139 bool calcCreatesSingleton(bool left) const;
1140
1141 const std::shared_ptr<const EntryFrame> getParent() const
1142 {
1143 auto result = m_parent.lock();
1144 MUSX_ASSERT_IF(!result) {
1145 throw std::logic_error("Unable to obtain lock on parent entry frame.");
1146 }
1147 return result;
1148 }
1149
1150 const std::weak_ptr<const EntryFrame> m_parent;
1151 };
1152
1159 std::vector<TupletInfo> tupletInfo;
1164
1166 DocumentPtr getDocument() const;
1167
1169 const details::GFrameHoldContext& getContext() const { return m_context; }
1170
1172 Cmper getRequestedPartId() const { return m_context.getRequestedPartId(); }
1173
1175 StaffCmper getStaff() const;
1176
1178 MeasCmper getMeasure() const;
1179
1181 LayerIndex getLayerIndex() const { return m_layerIndex; }
1182
1185
1188 util::Fraction getTimeStretch() const { return m_timeStretch; }
1189
1191 const std::vector<std::shared_ptr<const EntryInfo>>& getEntries() const
1192 { return m_entries; }
1193
1197 EntryInfoPtr getFirstInVoice(int voice) const;
1198
1202 EntryInfoPtr getLastInVoice(int voice) const;
1203
1256 EntryInfoPtr::InterpretedIterator getFirstInterpretedIterator(int voice, bool remapBeamOverBarlineEntries = true) const;
1257
1259 void addEntry(const std::shared_ptr<const EntryInfo>& entry)
1260 { m_entries.emplace_back(entry); }
1261
1264 std::shared_ptr<const EntryFrame> getNext() const;
1265
1268 std::shared_ptr<const EntryFrame> getPrevious() const;
1269
1273
1277 MusxInstance<others::StaffComposite> createCurrentStaff(Edu eduPosition, const std::optional<StaffCmper>& forStaffId = std::nullopt) const;
1278
1281
1287 bool calcIsCueFrame(bool includeVisibleInScore = false) const;
1288
1294 bool calcAreAllEntriesHiddenInFrame() const;
1295
1302 EntryInfoPtr calcNearestEntry(util::Fraction position, bool findExact = true, std::optional<bool> matchVoice2 = std::nullopt,
1303 util::Fraction atGraceNoteDuration = 0) const;
1304
1309 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator) const;
1310
1311private:
1313 LayerIndex m_layerIndex;
1314 util::Fraction m_timeStretch;
1315
1316 std::vector<std::shared_ptr<const EntryInfo>> m_entries;
1317
1320
1322 mutable MusxInstance<others::LayerAttributes> m_cachedLayerAttributes;
1323};
1324
1325namespace details {
1326class GFrameHold;
1327} // namespace details
1328
1338{
1343 explicit EntryInfo(const MusxInstance<Entry>& entry)
1344 : m_entry(entry) {}
1345
1346#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1348#endif
1349
1350public:
1355 unsigned graceIndex{};
1359
1363 {
1364 auto retval = m_entry.lock();
1365 if (!retval) {
1366 throw std::logic_error("Entry pointer is no longer valid");
1367 }
1368 return retval;
1369 }
1370
1374
1375private:
1377};
1378
1381{
1382public:
1384 NoteInfoPtr() : m_entry(), m_noteIndex(0) {}
1385
1389 NoteInfoPtr(const EntryInfoPtr& entryInfo, size_t noteIndex)
1390 : m_entry(entryInfo), m_noteIndex(noteIndex)
1391 {}
1392
1394 explicit operator bool() const noexcept
1395 { return m_entry && m_noteIndex < m_entry->getEntry()->notes.size(); }
1396
1399 bool isSameNote(const NoteInfoPtr& src) const
1400 { return m_entry.isSameEntry(src.m_entry) && m_noteIndex == src.m_noteIndex; }
1401
1405 NoteInfoPtr findEqualPitch(const EntryInfoPtr& entry) const;
1406
1409 {
1410 MUSX_ASSERT_IF(m_noteIndex >= m_entry->getEntry()->notes.size()) {
1411 throw std::logic_error("Note index is too large for notes array.");
1412 }
1413 return m_entry->getEntry()->notes[m_noteIndex];
1414 }
1415
1418 { return m_entry; }
1419
1432 Note::NoteProperties calcNoteProperties(const std::optional<bool>& enharmonicRespell = std::nullopt, bool alwaysUseEntryStaff = false) const;
1433
1441 Note::NoteProperties calcNotePropertiesConcert(bool alwaysUseEntryStaff = false) const;
1442
1450 Note::NoteProperties calcNotePropertiesInView(bool alwaysUseEntryStaff = false) const;
1451
1455
1459
1463 NoteInfoPtr calcTieTo() const;
1464
1469 NoteInfoPtr calcTieFrom(bool requireTie = true) const;
1470
1472 StaffCmper calcStaff() const;
1473
1476 std::unique_ptr<music_theory::Transposer> createTransposer() const;
1477
1481 {
1482 if (m_noteIndex >= m_entry->getEntry()->notes.size()) {
1483 return NoteInfoPtr();
1484 }
1485 return NoteInfoPtr(m_entry, m_noteIndex + 1);
1486 }
1487
1491 {
1492 if (m_noteIndex <= 0) {
1493 return NoteInfoPtr();
1494 }
1495 return NoteInfoPtr(m_entry, m_noteIndex - 1);
1496 }
1497
1499 bool calcIsEnharmonicRespell() const;
1500
1510 std::pair<int, int> calcDefaultEnharmonic() const
1511 { return (*this)->calcDefaultEnharmonic(m_entry.getKeySignature()); }
1512
1523
1524private:
1528 bool isSamePitch(const NoteInfoPtr& src) const;
1529
1533 bool isSamePitchValues(const NoteInfoPtr& src) const;
1534
1535 EntryInfoPtr m_entry;
1536 size_t m_noteIndex;
1537};
1538
1539} // namespace dom
1540} // namespace entries
Base class to enforce polymorphism across all DOM classes.
Definition BaseClasses.h:83
virtual void integrityCheck(const std::shared_ptr< Base > &ptrToThis)
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition BaseClasses.h:154
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:91
Wraps a reference to an existing object or owns a temporary value if needed.
Definition MusxInstance.h:179
Represents a vector of EntryInfo instances for a given frame, along with computed information.
Definition Entries.h:1036
util::Fraction getTimeStretch() const
Get the time stretch in this frame. Rather than accessing this value directly, consider using EntryIn...
Definition Entries.h:1188
util::Fraction maxElapsedStaffDuration
Definition Entries.h:1162
EntryFrame(const details::GFrameHoldContext &gfhold, LayerIndex layerIndex, util::Fraction timeStretch, const MusxInstance< others::StaffComposite > &startStaff)
Constructor function.
Definition Entries.h:1045
util::Fraction measureStaffDuration
The duration of the measure in staff duration units.
Definition Entries.h:1161
EntryInfoPtr getLastInVoice(int voice) const
Returns the last entry in the specified v1/v2 or null if none.
Definition Entries.cpp:136
MusxInstance< others::StaffComposite > getStartStaffInstance() const
Gets the staff at eduPosition 0 without needing to create it again.
Definition Entries.h:1271
bool calcAreAllEntriesHiddenInFrame() const
Calculates if this all notes in the frame are hidden. This routine only checks that entries are indiv...
Definition Entries.cpp:207
MeasCmper getMeasure() const
Get the measure for the entry frame.
Definition Entries.cpp:110
MusxInstance< others::Measure > getMeasureInstance() const
Get the measure instance.
Definition Entries.cpp:186
EntryInfoPtr calcNearestEntry(util::Fraction position, bool findExact=true, std::optional< bool > matchVoice2=std::nullopt, util::Fraction atGraceNoteDuration=0) const
Calculates the nearest non-grace-note entry at the given position.
Definition Entries.cpp:218
std::shared_ptr< const EntryFrame > getPrevious() const
Gets the entry frame for the previous measure with the same staff and layer.
Definition Entries.cpp:167
void addEntry(const std::shared_ptr< const EntryInfo > &entry)
Add an entry to the list.
Definition Entries.h:1259
const std::vector< std::shared_ptr< const EntryInfo > > & getEntries() const
Get the entry list.
Definition Entries.h:1191
EntryInfoPtr getFirstInVoice(int voice) const
Returns the first entry in the specified v1/v2 or null if none.
Definition Entries.cpp:120
StaffCmper getStaff() const
Get the staff for the entry.
Definition Entries.cpp:108
Cmper getRequestedPartId() const
Get the requested part ID for the entry frame.
Definition Entries.h:1172
MusxInstance< others::StaffComposite > createCurrentStaff(Edu eduPosition, const std::optional< StaffCmper > &forStaffId=std::nullopt) const
Creates a current StaffComposite for the entry frame.
Definition Entries.cpp:177
MusxInstance< KeySignature > keySignature
This can be different than the measure key sig if the staff has independent key signatures.
Definition Entries.h:1160
MusxInstance< others::LayerAttributes > getLayerAttributes() const
Get the LayerAttributes for this entry frame.
Definition Entries.cpp:112
const details::GFrameHoldContext & getContext() const
Get the frame context for this frame.
Definition Entries.h:1169
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry frame.
Definition Entries.h:1181
bool iterateEntries(std::function< bool(const EntryInfoPtr &)> iterator) const
Iterates the entries for the specified layer in this EntryFrame from left to right.
Definition Entries.cpp:247
DocumentPtr getDocument() const
Get the document for the entry frame.
Definition Entries.cpp:106
std::vector< TupletInfo > tupletInfo
A list of the tuplets in the frame and their calculated starting and ending information.
Definition Entries.h:1159
std::shared_ptr< const EntryFrame > getNext() const
Gets the entry frame for the next measure with the same staff and layer.
Definition Entries.cpp:159
EntryInfoPtr::InterpretedIterator getFirstInterpretedIterator(int voice, bool remapBeamOverBarlineEntries=true) const
Returns a workaround-aware iterator at the first entry in the specified voice.
Definition Entries.cpp:146
bool calcIsCueFrame(bool includeVisibleInScore=false) const
Calculates if this entry frame is part of a cue.
Definition Entries.cpp:191
Iterator-style wrapper for workaround-aware voice traversal.
Definition Entries.h:944
const EntryInfoPtr & getEntryInfo() const noexcept
Returns the entry at the current iterator position.
Definition Entries.h:977
bool calcIsPastLogicalEndOfFrame() const
Returns true is this entry is past the logical end of the frame, as defined by the length of the meas...
Definition Entries.cpp:2071
InterpretedIterator getNext() const
Returns an iterator advanced to the next usable entry in this voice.
Definition Entries.cpp:2106
util::Fraction getEffectiveMeasureStaffDuration() const
Return the effective measure staff duration of the entry. Calling code using InterpretedIterator shou...
Definition Entries.cpp:2066
InterpretedIterator getPrevious() const
Returns an iterator advanced to the previous usable entry in this voice.
Definition Entries.cpp:2118
bool getEffectiveHidden() const noexcept
Returns whether the entry should be treated as hidden.
Definition Entries.h:982
InterpretedIterator()=default
Default constructor allows null return values by caller.
util::Fraction getEffectiveActualDuration(bool global=false) const
Return the effective actual duration of the entry. Calling code using InterpretedIterator should use ...
Definition Entries.cpp:2050
util::Fraction getEffectiveElapsedDuration(bool global=false) const
Return the effective elapsed duration of the entry. Calling code using InterpretedIterator should use...
Definition Entries.cpp:2058
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:417
bool calcUpStemDefault() const
Calculates if the entry is upstem by default, without considering voices, layers, staff options,...
Definition Entries.cpp:835
EntryInfoPtr getNextInFrame() const
Get the next entry in the frame.
Definition Entries.cpp:667
EntryInfoPtr getPreviousInBeamGroupAcrossBars(BeamIterationMode beamIterationMode=BeamIterationMode::Normal) 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.cpp:788
bool calcIsBeamStart(BeamIterationMode beamIterationMode=BeamIterationMode::Normal) const
Returns whether this is the start of a primary beam.
Definition Entries.cpp:990
bool calcBeamMustStartHere() const
Determines if a beam must start on this entry.
Definition Entries.cpp:985
EntryInfoPtr(const std::shared_ptr< const EntryFrame > &entryFrame, size_t index=0)
Constructor function.
Definition Entries.h:442
EntryInfoPtr getNextSameV() const
Get the next entry in the frame in the same voice.
Definition Entries.cpp:675
bool calcCanBeBeamed() const
Determines if this entry can be beamed.
Definition Entries.cpp:972
EntryInfoPtr findMainEntryForGraceNote(bool ignoreRests=false) const
Finds the main entry for a grace note, taking into account hidden entries for beams over barlines.
Definition Entries.cpp:1238
size_t getIndexInFrame() const
Returns the index within the frame.
Definition Entries.h:513
util::Fraction calcGlobalElapsedDuration() const
Calculates the elapsed duration in global edu, removing any time stretch due to independent time sign...
Definition Entries.cpp:1607
std::pair< bool, bool > calcEntryStemSettings() const
Returns the Entry stem settings for the current requested part. This function encapsulates handling o...
Definition Entries.cpp:593
EntryInfoPtr calcBeamContinuesLeftOverBarline() const
Determines if this entry continues a beam across a barline from the previous measure.
Definition Entries.cpp:1273
EntryInfoPtr getNextInBeamGroup(BeamIterationMode beamIterationMode=BeamIterationMode::Normal) 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:601
bool calcIfLayerSettingsApply() const
Calculates whether the conditions are met for the layer attributes dependent on others::LayerAttribut...
Definition Entries.cpp:1882
EntryInfoPtr getPreviousInVoice(int voice) const
Returns the previous entry in the frame in the specified v1/v2 or null if none.
Definition Entries.cpp:756
unsigned calcReverseGraceIndex() const
Caclulates the grace index counting leftward (used by other standards such as MNX)
Definition Entries.cpp:610
static EntryInfoPtr fromEntryNumber(const DocumentPtr &document, Cmper partId, EntryNumber entryNumber, util::Fraction timeOffset=0)
Returns an EntryInfoPtr for the entry specified by entryNumber.
Definition Entries.cpp:448
EntryInfoPtr getPreviousSameVNoGrace() const
Get the previous entry in the frame in the same voice, skipping grace notes.
Definition Entries.cpp:737
MusxInstance< details::EntryPartFieldDetail > getPartFieldData() const
Gets the applicable part data for the entry, or nullptr if none.
Definition Entries.cpp:570
BeamIterationMode
Controls which entries are included when iterating over beams.
Definition Entries.h:422
@ Normal
Skip hidden entries. This is how Finale displays beams.
@ IncludeAll
Include all entries, even if they are hidden.
Evpu calcManuaOffset() const
Returns the manual offset of the entry for the current requested part. This function encapsulates han...
Definition Entries.cpp:585
unsigned calcLowestBeamStart(bool considerBeamOverBarlines=false) const
Returns the lowest beam number starting at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Entries.cpp:1462
bool isSameEntry(const EntryInfoPtr &src) const
Returns whether the input and the current instance refer to the same entry.
Definition Entries.cpp:485
EntryInfoPtr getPreviousInLayer() const
Get the previous entry in the same layer and staff. This can be in the previous measure.
Definition Entries.cpp:703
EntryInfoPtr findHiddenSourceForBeamOverBarline() const
Find the hidden source entry for a mid-system beam created by the Beam Over Barline plugin....
Definition Entries.cpp:1111
EntryInfoPtr getNextInLayer() const
Get the next entry in the same layer and staff. This can be in the next measure.
Definition Entries.cpp:656
unsigned calcLowestBeamStub() const
Returns the lowest beam stub at this entry, where 2 = 16th note stub, 3 = 32nd note stub,...
Definition Entries.cpp:1548
bool calcIsBeamedRestWorkaroundVisibleRest() const
A common workaround in Finale is to hide a rest in v1 and supply it in v2. Typically it is used when ...
Definition Entries.cpp:1848
bool calcIsSamePitchContent(const EntryInfoPtr &src, bool compareConcert=true) const
Returns whether this entry and src contain the same pitch content or rest value.
Definition Entries.cpp:498
util::Fraction calcGraceElapsedDuration() const
Calculates a grace note's symbolic starting duration as a negative offset from the main note....
Definition Entries.cpp:622
unsigned calcLowestBeamEnd() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Entries.cpp:1504
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Entries.cpp:562
bool calcIsSingletonGrace() const
Return true if this entry is a grace note and the only grace in the sequence at this location.
Definition Entries.cpp:1947
unsigned calcLowestBeamEndAcrossBarlines() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Entries.cpp:1527
unsigned calcNumberOfBeams() const
Calculates the number of beams or flags on the entry.
Definition Entries.cpp:1411
EntryInfoPtr getNextInBeamGroupAcrossBars(BeamIterationMode beamIterationMode=BeamIterationMode::Normal) const
Gets the next entry in a beamed group, or nullptr if the entry is not beamed or is the last in the gr...
Definition Entries.cpp:772
EntryInfoPtr getPreviousInFrame() const
Get the previous entry in the frame.
Definition Entries.cpp:714
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:510
bool calcUpStem() const
Determines the effective stem direction of the entry, taking into account voices, layers,...
Definition Entries.h:654
bool calcIsBeamedRestWorkaroundHiddenRest() const
A common workaround in Finale is to hide a rest in v1 and supply it in v2. Typically it is used when ...
Definition Entries.cpp:1828
int getVoice() const
Gets the voice as integer value 1 or 2.
Definition Entries.cpp:493
bool calcIsSamePitchContentAndDuration(const EntryInfoPtr &src, bool compareConcert=true, bool requireSameVoice=true, bool requireSameGraceElapsedDura=false) const
Returns whether this entry and src represent the same notated value.
Definition Entries.cpp:534
EntryInfoPtr findBeamStartOrCurrent() const
Finds the first entry of a beamed group or returns the current entry if it is not beams.
Definition Entries.cpp:1362
bool calcDisplaysAsRest() const
Calculates if an entry displays as a rest.
Definition Entries.cpp:804
MusxInstance< KeySignature > getKeySignature() const
Get the key signature of the entry.
Definition Entries.cpp:568
bool calcIsCue(bool includeVisibleInScore=false) const
Calculates if this entry is part of a cue.
Definition Entries.cpp:1778
EntryInfoPtr getPreviousInBeamGroup(BeamIterationMode beamIterationMode=BeamIterationMode::Normal) 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:606
InterpretedIterator asInterpretedIterator(bool remapBeamOverBarlineEntries=true) const
Returns this EntryInfoPtr in a InterpretedIterator instance.
Definition Entries.cpp:766
bool calcCreatesSingletonBeamLeft() const
Determines if this entry contains a tuplet that creates a singleton beam left. See EntryFrame::Tuplet...
Definition Entries.cpp:1002
bool operator<(const EntryInfoPtr &other) const
Explicit operator< for std::map.
Definition Entries.h:849
std::optional< size_t > calcNextTupletIndex(std::optional< size_t > currentIndex=0) const
Returns the next higher tuplet index that this entry starts, or std::nullopt if none.
Definition Entries.cpp:635
static EntryInfoPtr fromPositionOrNull(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measureId, EntryNumber entryNumber, util::Fraction timeOffset=0)
Searches the given position at staffId and measureId for the entryNumber.
Definition Entries.cpp:433
std::pair< int, int > calcTopBottomStaffPositions() const
Calculates the top and bottom staff positions of the entry, taking into account percussion notes....
Definition Entries.cpp:810
StaffCmper getStaff() const
Get the staff cmper.
Definition Entries.cpp:564
EntryInfoPtr findBeamEnd() const
Finds the end entry of a beamed group.
Definition Entries.cpp:1379
int calcEntrySize() const
Returns the entry size as a percentage, taking into account the beaming.
Definition Entries.cpp:1764
EntryInfoPtr getPreviousSameV() const
Get the previous entry in the frame in the same voice.
Definition Entries.cpp:722
int calcCrossStaffDirectionForAll(DeferredReference< MusxInstanceList< others::StaffUsed > > staffList={}) const
Calculates if this entry has cross-staffed notes all in a single direction.
Definition Entries.cpp:1923
MusxInstance< others::StaffComposite > createCurrentStaff(const std::optional< StaffCmper > &forStaffId=std::nullopt) const
Creates the current StaffComposite for the entry.
Definition Entries.cpp:602
EntryInfoPtr findDisplayEntryForBeamOverBarline() const
Find the display entry for a hidden source entry. The display entry is one or more bars previous to t...
Definition Entries.cpp:1186
bool calcIsTrillToGraceEntry() const
Calculates if this entry is a trill-to entry as created by the Parenthesize Trill-To Notes plugin.
Definition Entries.cpp:1970
int calcIsAuxiliaryPitchMarker() const
Return true if this entry is an auxiliary pitch marker (specifically, a trill-to or gliss-to pitch ma...
Definition Entries.cpp:1959
EntryInfoPtr getNextInVoice(int voice) const
Returns the next entry in the frame in the specified v1/v2 or null if none.
Definition Entries.cpp:746
EntryInfoPtr calcBeamContinuesRightOverBarline() const
Determines if this entry continues a beam across a barline to the next measure.
Definition Entries.cpp:1317
const std::shared_ptr< const EntryInfo > operator->() const
Allows -> access to the underlying EntryInfo instance.
Definition Entries.cpp:469
bool calcUnbeamed() const
Returns whether this is an unbeamed entry.
Definition Entries.cpp:963
EntryInfoPtr()
Default constructor.
Definition Entries.h:435
bool calcCreatesSingletonBeamRight() const
Determines if this entry contains a tuplet that creates a singleton beam right. See EntryFrame::Tuple...
Definition Entries.cpp:1013
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 Entries.cpp:1558
bool calcIsGlissToGraceEntry() const
Calculates if this entry is a gliss-to entry as created by the Parenthesize Trill-To Notes plugin.
Definition Entries.cpp:1993
bool calcIsFullMeasureRest() const
Returns whether this is a full measure rest.
Definition Entries.cpp:1804
util::Fraction calcGlobalActualDuration() const
Calculates the actual duration in global edu, removing any time stretch due to independent time signa...
Definition Entries.cpp:1612
MeasCmper getMeasure() const
Get the measure cmper.
Definition Entries.cpp:566
EntryInfoPtr getNextSameVNoGrace() const
Get the next entry in the frame in the same voice, skipping grace notes.
Definition Entries.cpp:693
std::vector< size_t > findTupletInfo() const
Finds the tuplet info for tuplets that include this entry.
Definition Entries.cpp:1868
bool calcIsFeatheredBeamStart(Evpu &outLeftY, Evpu &outRightY) const
Calculates if the entry starts a feathered beam and returns information about it if so.
Definition Entries.cpp:1729
Information an entry along with the entry.
Definition Entries.h:1338
unsigned graceIndex
Definition Entries.h:1355
ClefIndex clefIndex
the clef index in effect for the entry.
Definition Entries.h:1357
util::Fraction calcNextElapsedDuration() const
Calculates the next duration position after this entry.
Definition Entries.h:1372
util::Fraction elapsedDuration
Definition Entries.h:1351
ClefIndex clefIndexConcert
the concert clef index in effect for the entry.
Definition Entries.h:1358
util::Fraction actualDuration
Definition Entries.h:1353
MusxInstance< Entry > getEntry() const
Get the entry.
Definition Entries.h:1362
Represents an entry containing metadata and notes.
Definition Entries.h:279
std::vector< std::tuple< StaffCmper, MeasCmper, LayerIndex > > locations
The location(s) of this entry calculated by calcLocations, which is called by the factory....
Definition Entries.h:352
bool splitStem
Definition Entries.h:327
Entry(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
Constructor function.
Definition Entries.h:285
EntryNumber getEntryNumber() const
Gets the entry number for this entry.
Definition Entries.h:355
bool articDetail
Indicates there is an articulation on the entry.
Definition Entries.h:309
bool upStemScore
Whether a stem is up or down as set in the score. (Only reliable when freezeStemScore is true....
Definition Entries.h:329
std::pair< NoteType, unsigned > calcNoteInfo() const
Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu....
Definition Entries.h:370
bool isNote
If this value is false, the entry is a rest.
Definition Entries.h:302
bool noLeger
Hide ledger lines.
Definition Entries.h:334
MusxInstance< Entry > getNext() const
Gets the next entry in this list or nullptr if none.
Definition Entries.cpp:47
bool noPlayback
Indicates that the entry should not be played back.
Definition Entries.h:340
bool voice2
This is a V2 note. (xml node <v2>)
Definition Entries.h:304
bool splitRest
Indicates that rests in different layers are not combined on this entry.
Definition Entries.h:312
bool beamExt
Indicates that there is a beam extension on the entry.
Definition Entries.h:316
bool createdByHP
Indicates the entry was created by Finale's smart playback engine.
Definition Entries.h:305
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Entries.h:400
MusxInstance< Entry > getPrevious() const
Gets the previous entry in this list or nullptr if none.
Definition Entries.cpp:57
bool secBeam
Signifies a secondary beam break occurs on the entry.
Definition Entries.h:320
bool stemDetail
Indicates there are stem modifications.
Definition Entries.h:322
bool slashGrace
Definition Entries.h:336
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:301
bool playDisabledByHP
Used by Finale's smart playback engine.
Definition Entries.h:306
bool flipTie
Indicates the existence of a flipped tie, either in Speedy Entry or Layer Attributes.
Definition Entries.h:317
bool flatBeam
Forces any beam that starts on this entry to be flat by default.
Definition Entries.h:339
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:345
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Entries.h:388
bool dummy
Definition Entries.h:331
Evpu hOffsetScore
Manual offset created with the Note Position Tool in the score. (xml node is <posi>....
Definition Entries.h:300
bool checkAccis
Used by Finale to convert pre-2014 .mus files. May never be saved in .musx.
Definition Entries.h:330
bool noteDetail
Indicates there is a note detail or EntrySize record for the entry.
Definition Entries.h:308
util::Fraction calcFraction() const
Calculates the duration as a util::Fraction of a whole note.
Definition Entries.h:375
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:379
bool crossStaff
Signifies that at least one note in the entry has been cross staffed.
Definition Entries.h:323
bool floatRest
Is floating rest. If false, the first note element gives the staff position of the rest.
Definition Entries.h:314
bool smartShapeDetail
Indicates this entry has a smart shape assignment.
Definition Entries.h:333
Edu duration
Duration of the entry, not taking into account tuplets.
Definition Entries.h:298
bool isHidden
Indicates the entry is hidden, (xml node is <ignore>)
Definition Entries.h:315
bool tupletStart
Indicates that a tuplet start on the entry.
Definition Entries.h:311
bool lyricDetail
Indicates there is a lyric assignment on the entry.
Definition Entries.h:310
int numNotes
Number of notes in the entry. There is an error if this is not the same as notes.size().
Definition Entries.h:299
bool sorted
Sorted flag.
Definition Entries.h:335
bool reverseDownStem
Indicates that a stem normally down is reversed.
Definition Entries.h:325
bool reverseUpStem
Indicates that a stem normally up is reversed.
Definition Entries.h:324
bool v2Launch
Indicates if this entry (which is voice1) launches a voice2 sequence. (xml node is <controller>)
Definition Entries.h:303
bool doubleStem
Creates a double stem on the entry. (Appears to be exclusive with splitStem.)
Definition Entries.h:326
bool isPossibleFullMeasureRest() const
Returns true if the entry could be a full-measure rest.
Definition Entries.h:385
bool beam
Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry....
Definition Entries.h:319
bool freezeStemScore
Freeze stem flag in the score. (upStemScore gives the direction.)
Definition Entries.h:321
bool performanceData
Indicates there is performance data on the entry.
Definition Entries.h:313
bool noSpacing
Indicates that the entry should be ignored when calculating music spacing.
Definition Entries.h:341
bool dotTieAlt
Indicates dot or tie alterations are present.
Definition Entries.h:318
bool freezeBeam
Freeze beam flag (Derived from the presence of <freezeBeam> node.)
Definition Entries.h:342
bool graceNote
Indicate the entry is a grace note.
Definition Entries.h:307
static void calcLocations(const DocumentPtr &document)
Calculates the locations for all entries in the document. This function is normally only called by th...
Definition Entries.cpp:89
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:255
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:103
Wraps an EntryInfo instance and a note index.
Definition Entries.h:1381
int calcStaffPosition() const
Calculates the staff position for this note, taking into account percussion notes.
Note::NoteProperties calcNoteProperties(const std::optional< bool > &enharmonicRespell=std::nullopt, bool alwaysUseEntryStaff=false) const
Calculates the note name, octave number, actual alteration, and staff position. This function does no...
Definition Entries.cpp:2614
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:1417
MusxInstance< others::PercussionNoteInfo > calcPercussionNoteInfo() const
Calculates the percussion note info for this note, if any.
Definition Entries.cpp:2656
MusxInstance< Note > operator->() const
Allows -> access to the underlying Note instance.
Definition Entries.h:1408
bool isSameNote(const NoteInfoPtr &src) const
Returns whether the input and the current instance refer to the same note.
Definition Entries.h:1399
StaffCmper calcStaff() const
Calculates the staff number, taking into account cross staffing.
Definition Entries.cpp:2600
NoteInfoPtr getPrevious() const
Gets the next note in a chord on the same entry.
Definition Entries.h:1490
Note::NoteProperties calcNotePropertiesConcert(bool alwaysUseEntryStaff=false) const
Calculates the note name, octave number, actual alteration, and staff position for the concert pitch ...
Definition Entries.cpp:2630
NoteInfoPtr calcTieFrom(bool requireTie=true) const
Calculates the note that this note could tie from.
Definition Entries.cpp:2570
bool calcIsEnharmonicRespell() const
Returns if this note is enharmonically respelled in the current part view.
Definition Entries.cpp:2682
std::pair< int, int > calcDefaultEnharmonic() const
Calculates the default enharmonic equivalent of this note. This is the value that Finale uses when de...
Definition Entries.h:1510
Note::NoteProperties calcNotePropertiesInView(bool alwaysUseEntryStaff=false) const
Calculates the note name, octave number, actual alteration, and staff position for the pitch of the n...
Definition Entries.cpp:2646
int calcCrossStaffDirection(DeferredReference< MusxInstanceList< others::StaffUsed > > staffList={}) const
Calculates if this note is cross-staffed and if so, which direction.
Definition Entries.cpp:2721
NoteInfoPtr(const EntryInfoPtr &entryInfo, size_t noteIndex)
Constructor.
Definition Entries.h:1389
NoteInfoPtr calcTieTo() const
Calculates the note that this note could tie to. Check the return value's Note::tieEnd to see if ther...
Definition Entries.cpp:2525
NoteInfoPtr findEqualPitch(const EntryInfoPtr &entry) const
Finds a note with the same pitch in the supplied entry.
Definition Entries.cpp:2502
NoteInfoPtr getNext() const
Gets the next note in a chord on the same entry.
Definition Entries.h:1480
NoteInfoPtr()
Default constructor.
Definition Entries.h:1384
std::unique_ptr< music_theory::Transposer > createTransposer() const
Creates a transposer for this Note instance.
Definition Entries.cpp:2677
Represents a single note element in an entry.
Definition Entries.h:183
bool upStemSecond
When the entry is upstem, it is drawn on the "wrong" side of the stem.
Definition Entries.h:209
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:205
bool playDisabledByHP
Used by Finale's smart playback engine.
Definition Entries.h:220
static constexpr NoteNumber RESTID
Non floating rests have a note with this noteId that defines their staff positions.
Definition Entries.h:192
int harmAlt
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7.
Definition Entries.h:204
bool upSplitStem
Definition Entries.h:213
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:224
bool tieEnd
Indicates a tie ends on this note.
Definition Entries.h:207
Note(const DocumentWeakPtr &document, NoteNumber noteId)
Constructor function.
Definition Entries.h:186
bool tieStart
Indicates a tie starts on this note.
Definition Entries.h:206
bool crossStaff
Signifies that the note has a details::CrossStaff note detail.
Definition Entries.h:208
std::pair< int, int > calcDefaultEnharmonic(const MusxInstance< KeySignature > &key) const
Calculates the default enharmonic equivalent of this note. This is the value that Finale uses when de...
Definition Entries.cpp:2421
int harmLev
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signatu...
Definition Entries.h:203
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:211
std::tuple< music_theory::NoteName, int, int, int > NoteProperties
Note properites. A tuple containing:
Definition Entries.h:201
bool noPlayback
Indicates that this note should not be played back.
Definition Entries.h:217
bool parenAcci
True if the accidental has parentheses.
Definition Entries.h:216
bool noSpacing
Indicates that this note should ignored when calculating spacing.
Definition Entries.h:218
bool showAcci
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set....
Definition Entries.h:215
bool freezeAcci
True if the accidental should be forced on or off (based on showAcci.)
Definition Entries.h:219
NoteProperties calcNoteProperties(const MusxInstance< KeySignature > &key, KeySignature::KeyContext ctx, ClefIndex clefIndex, const MusxInstance< others::PercussionNoteInfo > &percNoteInfo, const MusxInstance< others::Staff > &staff=nullptr, bool respellEnharmonic=false) const
Calculates the note name, octave number, actual alteration, and staff position. This function does no...
Definition Entries.cpp:2456
A context wrapper for GFrameHold associated with a specific part and location.
Definition Entries.h:59
const GFrameHold * operator->() const
Provides const pointer-style access to the underlying GFrameHold.
Definition Entries.h:85
std::map< LayerIndex, int > calcVoices(bool excludeHidden=false) const
Calculates the number of voices used by the GFrameHold instance.
Definition Entries.cpp:2308
EntryInfoPtr calcNearestEntry(util::Fraction position, bool findExact=true, std::optional< LayerIndex > matchLayer=std::nullopt, std::optional< bool > matchVoice2=std::nullopt, util::Fraction atGraceNoteDuration=0) const
Calculates the nearest non-grace-note entry at the given position.
Definition Entries.cpp:2382
std::shared_ptr< const EntryFrame > createEntryFrame(LayerIndex layerIndex) const
Returns the EntryFrame for all entries in the given layer.
Definition Entries.cpp:2174
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:102
util::Fraction calcMinLegacyPickupSpacer() const
Calculates the minimum legacy pickup spacer, if any.
Definition Entries.cpp:2400
bool iterateEntries(LayerIndex layerIndex, std::function< bool(const EntryInfoPtr &)> iterator) const
iterates the entries for the specified layer in this GFrameHold from left to right
Definition Entries.cpp:2289
bool calcIsCuesOnly(bool includeVisibleInScore=false) const
Calculates if this staff in this measure contains only a cue layer and full-measure rest layers.
Definition Entries.cpp:2360
Cmper getRequestedPartId() const
Returns the requested part ID associated with this context.
Definition Entries.h:78
ClefIndex calcClefIndexAt(Edu position) const
Returns the clef index in effect for at the specified Edu position. This function does not take into ...
Definition Entries.cpp:2334
Represents the attributes of a Finale frame holder.
Definition Details.h:1078
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
static constexpr Fraction fromEdu(dom::Edu edu)
Constructs a Fraction from edu.
Definition Fraction.h:101
constexpr dom::Edu calcEduDuration() const
Calculates duration as a fraction of a whole note.
Definition Fraction.h:150
A dependency-free, header-only collection of useful functions for music theory.
NoteName
The available note names in array order.
Definition music_theory.hpp:66
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:39
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:71
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:68
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 Entries.cpp:67
unsigned calcNumberOfBeamsInEdu(Edu duration)
Calculates the number of beams or flags in the Edu value.
Definition Entries.cpp:1397
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:69
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:70
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition BaseClasses.h:55
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
std::weak_ptr< const T > MusxInstanceWeak
Defines a weak ptr to the type of a musx instance stored in a pool.
Definition MusxInstance.h:44
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:36
class to track tuplets in the frame
Definition Entries.h:1055
size_t startIndex
the index of the first entry in the tuplet
Definition Entries.h:1057
bool calcCreatesSingletonBeamRight() const
Calculates if this tuplet is being used to create a singleton beam to the right.
Definition Entries.h:1112
TupletInfo(const std::weak_ptr< const EntryFrame > &parent, const MusxInstance< details::TupletDef > &tup, size_t index, util::Fraction start, bool forVoice2)
Constructor.
Definition Entries.h:1064
bool calcIsTremolo() const
Calculates if this tuplet represents a tremolo based on the following criteria.
Definition Entries.cpp:257
size_t endIndex
the index of the last entry in the tuplet
Definition Entries.h:1058
bool includesEntry(const EntryInfoPtr &entryInfo) const
Return true if the entry is part of this tuplet.
Definition Entries.h:1080
util::Fraction endDura
the actual duration where the tuplet ends
Definition Entries.h:1060
size_t numEntries() const
Return the number of entries in the tuplet.
Definition Entries.h:1070
util::Fraction startDura
the actual duration where the tuplet starts
Definition Entries.h:1059
bool calcCreatesSingletonBeamLeft() const
Calculates if this tuplet is being used to create a singleton beam to the left.
Definition Entries.h:1123
MusxInstance< details::TupletDef > tuplet
the tuplet
Definition Entries.h:1056
bool voice2
whether this tuplet is for voice2
Definition Entries.h:1061
bool calcCreatesTimeStretch() const
Detects tuplets being used to create time stretch in an independent time signature.
Definition Entries.cpp:399