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;
45} // namespace others
46
47namespace details {
48class TupletDef;
49class GFrameHold;
50
59public:
68 GFrameHoldContext(const DocumentPtr& document, Cmper partId, Cmper staffId, Cmper meas);
69
75 Cmper getRequestedPartId() const { return m_requestedPartId; }
76
82 const GFrameHold* operator->() const { return m_hold.get(); }
83
89 explicit operator bool() const { return static_cast<bool>(m_hold); }
90
94 ClefIndex calcClefIndexAt(Edu position) const;
95
100 { return calcClefIndexAt(position.calcEduDuration()); }
101
107 std::shared_ptr<const EntryFrame> createEntryFrame(LayerIndex layerIndex) const;
108
116 bool iterateEntries(LayerIndex layerIndex, std::function<bool(const EntryInfoPtr&)> iterator);
117
123 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator);
124
127 std::map<LayerIndex, bool> calcVoices() const;
128
131 bool calcIsCuesOnly(bool includeVisibleInScore = false) const;
132
133private:
137 std::pair<MusxInstance<others::Frame>, Edu> findLayerFrame(LayerIndex layerIndex) const;
138
140 Cmper m_requestedPartId;
141};
142
143} // namespace details
144
154std::pair<NoteType, unsigned> calcNoteInfoFromEdu(Edu duration);
155
157unsigned calcNumberOfBeamsInEdu(Edu duration);
158
165class Note : public Base
166{
167public:
169 explicit Note(const DocumentWeakPtr& document, NoteNumber noteId)
170 : Base(document, 0, ShareMode::All), m_noteId(noteId)
171 {
172 }
173
175 static constexpr NoteNumber RESTID = 31;
176
184 using NoteProperties = std::tuple<music_theory::NoteName, int, int, int>;
185
186 int harmLev{};
187 int harmAlt{};
188 bool isValid{};
189 bool crossStaff{};
190 bool tieStart{};
191 bool tieEnd{};
196 bool upSplitStem{};
198 bool showAcci{};
199 bool parenAcci{};
200 bool freezeAcci{};
201
204 NoteNumber getNoteId() const { return m_noteId; }
205
216 std::pair<int, int> calcDefaultEnharmonic(const MusxInstance<KeySignature>& key) const;
217
243 const MusxInstance<others::Staff>& staff = nullptr, bool respellEnharmonic = false) const;
244
245 bool requireAllFields() const override { return false; }
246
248
249private:
250 NoteNumber m_noteId{};
251};
252
259class Entry : public Base
260{
261public:
266 explicit Entry(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
267 : Base(document, partId, shareMode), m_entnum(entnum), m_prev(prev), m_next(next)
268 {
269 }
270
280 int numNotes{};
282 bool isValid{};
283 bool isNote{};
284 bool graceNote{};
285 bool floatRest{};
286 bool isHidden{};
287 bool voice2{};
288 bool articDetail{};
289 bool noteDetail{};
290 bool dotTieAlt{};
291 bool tupletStart{};
292 bool beamExt{};
293 bool beam{};
294 bool secBeam{};
295 bool doubleStem{};
296 bool splitStem{};
298 bool crossStaff{};
299 bool freezeStem{};
300 bool upStem{};
301 bool noLeger{};
302 bool stemDetail{};
305 bool slashGrace{};
309 bool sorted{};
310 bool noPlayback{};
311 bool lyricDetail{};
313 bool freezeBeam{};
314
316 std::vector<std::shared_ptr<Note>> notes;
317
319 EntryNumber getEntryNumber() const { return m_entnum; }
320
325
330
334 std::pair<NoteType, unsigned> calcNoteInfo() const { return calcNoteInfoFromEdu(duration); }
335
340
343 bool hasStem() const { return duration < Edu(NoteType::Whole); }
344
350 { return !isNote && !isHidden && !voice2 && duration == Edu(NoteType::Whole); }
351
352 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
353 {
354 this->Base::integrityCheck(ptrToThis);
355 if (size_t(numNotes) != notes.size()) {
356 MUSX_INTEGRITY_ERROR("Entry " + std::to_string(m_entnum) + " has an incorrect number of notes.");
357 }
358 }
359
360 bool requireAllFields() const override { return false; }
361
362 constexpr static std::string_view XmlNodeName = "entry";
364
365private:
366 EntryNumber m_entnum;
367 EntryNumber m_prev;
368 EntryNumber m_next;
369
370};
371
372class EntryInfo;
373class EntryFrame;
374class NoteInfoPtr;
375
380{
381public:
383 EntryInfoPtr() : m_entryFrame(nullptr), m_indexInFrame(0) {}
384
390 explicit EntryInfoPtr(const std::shared_ptr<const EntryFrame>& entryFrame, size_t index = 0)
391 : m_entryFrame(entryFrame), m_indexInFrame(index) {}
392
400 static EntryInfoPtr fromPositionOrNull(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measureId, EntryNumber entryNumber);
401
403 const std::shared_ptr<const EntryInfo> operator->() const;
404
406 operator bool() const;
407
410 bool isSameEntry(const EntryInfoPtr& src) const;
411
413 std::shared_ptr<const EntryFrame> getFrame() const { return m_entryFrame; }
414
416 size_t getIndexInFrame() const { return m_indexInFrame; }
417
420
422 StaffCmper getStaff() const;
423
426 MusxInstance<others::StaffComposite> createCurrentStaff(const std::optional<StaffCmper>& forStaffId = std::nullopt) const;
427
429 MeasCmper getMeasure() const;
430
433
435 unsigned calcReverseGraceIndex() const;
436
438 std::optional<size_t> calcNextTupletIndex(std::optional<size_t> currentIndex) const;
439
442
446
451
455
458
463
469 EntryInfoPtr getNextInVoice(int voice) const;
470
476 EntryInfoPtr getPreviousInVoice(int voice) const;
477
479 EntryInfoPtr getNextInBeamGroup(bool includeHiddenEntries = false) const
480 { return iterateBeamGroup<&EntryInfoPtr::nextPotentialInBeam, &EntryInfoPtr::previousPotentialInBeam>(includeHiddenEntries); }
481
483 EntryInfoPtr getPreviousInBeamGroup(bool includeHiddenEntries = false) const
484 { return iterateBeamGroup<&EntryInfoPtr::previousPotentialInBeam, &EntryInfoPtr::nextPotentialInBeam>(includeHiddenEntries); }
485
488 bool calcDisplaysAsRest() const;
489
492 bool calcUnbeamed() const;
493
495 bool calcIsBeamStart() const;
496
501 bool calcIsFeatheredBeamStart(Evpu& outLeftY, Evpu& outRightY) const;
502
508
512
514 unsigned calcNumberOfBeams() const;
515
518 unsigned calcLowestBeamStart() const;
519
522 unsigned calcLowestBeamEnd() const;
523
526 unsigned calcLowestBeamStub() const;
527
533 bool calcBeamStubIsLeft() const;
534
537
540
542 bool canBeBeamed() const;
543
546 int calcEntrySize() const;
547
553 bool calcIsCue(bool includeVisibleInScore = false) const;
554
557 bool calcIsFullMeasureRest() const;
558
562 bool calcIsBeamedRestWorkaroud() const;
563
565 bool operator<(const EntryInfoPtr& other) const
566 {
567 if (m_entryFrame != other.m_entryFrame)
568 return m_entryFrame < other.m_entryFrame;
569 return m_indexInFrame < other.m_indexInFrame;
570 }
571
572private:
573 unsigned calcVisibleBeams() const;
574
575 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
576 std::optional<unsigned> iterateFindRestsInSecondaryBeam(const EntryInfoPtr nextOrPrevInBeam) const;
577
578 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
579 EntryInfoPtr iteratePotentialEntryInBeam() const;
580
581 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
582 bool iterateNotesExistLeftOrRight() const;
583
584 EntryInfoPtr nextPotentialInBeam(bool includeHiddenEntries) const;
585
586 EntryInfoPtr previousPotentialInBeam(bool includeHiddenEntries) const;
587
588 template<EntryInfoPtr(EntryInfoPtr::* Iterator)(bool) const, EntryInfoPtr(EntryInfoPtr::* ReverseIterator)(bool) const>
589 EntryInfoPtr iterateBeamGroup(bool includeHiddenEntries) const;
590
591 std::shared_ptr<const EntryFrame> m_entryFrame;
592 size_t m_indexInFrame{};
593};
594
601class EntryFrame : public std::enable_shared_from_this<EntryFrame>
602{
603public:
610 explicit EntryFrame(const details::GFrameHoldContext& gfhold, LayerIndex layerIndex, util::Fraction timeStretch) :
611 m_context(gfhold),
612 m_layerIndex(layerIndex),
613 m_timeStretch(timeStretch)
614 {
615 }
616
619 {
621 size_t startIndex;
622 size_t endIndex;
625 bool voice2;
626
628 TupletInfo(const std::weak_ptr<const EntryFrame>& parent, const MusxInstance<details::TupletDef>& tup, size_t index, util::Fraction start, bool forVoice2)
629 : tuplet(tup), startIndex(index), endIndex((std::numeric_limits<size_t>::max)()),
630 startDura(start), endDura(-1), voice2(forVoice2), m_parent(parent)
631 {}
632
644 bool calcIsTremolo() const;
645
659 bool calcCreatesSingletonRight() const { return calcCreatesSingleton(false); }
660
670 bool calcCreatesSingletonLeft() const { return calcCreatesSingleton(true); }
671
681
691
702 // - the independent display time signature matches the tuplet's total display duration
703 bool calcCreatesTimeStretch() const;
704
705 private:
706 bool calcCreatesSingleton(bool left) const;
707
708 const std::shared_ptr<const EntryFrame> getParent() const
709 {
710 auto result = m_parent.lock();
711 MUSX_ASSERT_IF(!result) {
712 throw std::logic_error("Unable to obtain lock on parent entry frame.");
713 }
714 return result;
715 }
716
717 const std::weak_ptr<const EntryFrame> m_parent;
718 };
719
726 std::vector<TupletInfo> tupletInfo;
728
730 DocumentPtr getDocument() const;
731
733 Cmper getRequestedPartId() const { return m_context.getRequestedPartId(); }
734
736 StaffCmper getStaff() const;
737
739 MeasCmper getMeasure() const;
740
742 LayerIndex getLayerIndex() const { return m_layerIndex; }
743
746 util::Fraction getTimeStretch() const { return m_timeStretch; }
747
749 const std::vector<std::shared_ptr<const EntryInfo>>& getEntries() const
750 { return m_entries; }
751
755 EntryInfoPtr getFirstInVoice(int voice) const;
756
760 EntryInfoPtr getLastInVoice(int voice) const;
761
763 void addEntry(const std::shared_ptr<const EntryInfo>& entry)
764 { m_entries.emplace_back(entry); }
765
768 std::shared_ptr<const EntryFrame> getNext() const;
769
772 std::shared_ptr<const EntryFrame> getPrevious() const;
773
777 MusxInstance<others::StaffComposite> createCurrentStaff(Edu eduPosition, const std::optional<StaffCmper>& forStaffId = std::nullopt) const;
778
781
787 bool calcIsCueFrame(bool includeVisibleInScore = false) const;
788
789private:
791 LayerIndex m_layerIndex;
792 util::Fraction m_timeStretch;
793
794 std::vector<std::shared_ptr<const EntryInfo>> m_entries;
795};
796
797namespace details {
798class GFrameHold;
799} // namespace details
800
810{
815 explicit EntryInfo(const MusxInstance<Entry>& entry)
816 : m_entry(entry) {}
817
818#ifndef DOXYGEN_SHOULD_IGNORE_THIS
820#endif
821
822public:
827 bool v2Launch{};
828 unsigned graceIndex{};
832
836 {
837 auto retval = m_entry.lock();
838 if (!retval) {
839 throw std::logic_error("Entry pointer is no longer valid");
840 }
841 return retval;
842 }
843
847
848private:
850};
851
854{
855public:
857 NoteInfoPtr() : m_entry(), m_noteIndex(0) {}
858
862 NoteInfoPtr(const EntryInfoPtr& entryInfo, size_t noteIndex)
863 : m_entry(entryInfo), m_noteIndex(noteIndex)
864 {}
865
867 operator bool() const
868 { return m_entry && m_noteIndex < m_entry->getEntry()->notes.size(); }
869
871 bool isSameNote(const NoteInfoPtr& src) const
872 { return m_entry.isSameEntry(src.m_entry) && m_noteIndex == src.m_noteIndex; }
873
877 NoteInfoPtr findEqualPitch(const EntryInfoPtr& entry) const;
878
881 {
882 MUSX_ASSERT_IF(m_noteIndex >= m_entry->getEntry()->notes.size()) {
883 throw std::logic_error("Note index is too large for notes array.");
884 }
885 return m_entry->getEntry()->notes[m_noteIndex];
886 }
887
890 { return m_entry; }
891
903 Note::NoteProperties calcNoteProperties(const std::optional<bool>& enharmonicRespell = std::nullopt) const;
904
912
920
924
928 NoteInfoPtr calcTieTo() const;
929
934 NoteInfoPtr calcTieFrom(bool requireTie = true) const;
935
937 StaffCmper calcStaff() const;
938
941 std::unique_ptr<music_theory::Transposer> createTransposer() const;
942
946 {
947 if (m_noteIndex >= m_entry->getEntry()->notes.size()) {
948 return NoteInfoPtr();
949 }
950 return NoteInfoPtr(m_entry, m_noteIndex + 1);
951 }
952
956 {
957 if (m_noteIndex <= 0) {
958 return NoteInfoPtr();
959 }
960 return NoteInfoPtr(m_entry, m_noteIndex - 1);
961 }
962
964 bool calcIsEnharmonicRespell() const;
965
975 std::pair<int, int> calcDefaultEnharmonic() const
976 { return (*this)->calcDefaultEnharmonic(m_entry.getKeySignature()); }
977
979 bool operator<(const NoteInfoPtr& other) const
980 {
981 if (m_entry != other.m_entry)
982 return m_entry < other.m_entry;
983 return m_noteIndex < other.m_noteIndex;
984 }
985
986private:
990 bool isSamePitch(const NoteInfoPtr& src) const;
991
995 bool isSamePitchValues(const NoteInfoPtr& src) const;
996
997 EntryInfoPtr m_entry;
998 size_t m_noteIndex;
999};
1000
1001} // namespace dom
1002} // 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
Represents a vector of EntryInfo instances for a given frame, along with computed information.
Definition Entries.h:602
util::Fraction getTimeStretch() const
Get the time stretch in this frame. Rather than accessing this value directly, consider using EntryIn...
Definition Entries.h:746
EntryInfoPtr getLastInVoice(int voice) const
Returns the last entry in the specified v1/v2 or null if none.
Definition Entries.cpp:105
MeasCmper getMeasure() const
Get the measure for the entry frame.
Definition Entries.cpp:86
MusxInstance< others::Measure > getMeasureInstance() const
Get the measure instance.
Definition Entries.cpp:139
std::shared_ptr< const EntryFrame > getPrevious() const
Gets the entry frame for the previous measure with the same staff and layer.
Definition Entries.cpp:123
void addEntry(const std::shared_ptr< const EntryInfo > &entry)
Add an entry to the list.
Definition Entries.h:763
const std::vector< std::shared_ptr< const EntryInfo > > & getEntries() const
Get the entry list.
Definition Entries.h:749
EntryInfoPtr getFirstInVoice(int voice) const
Returns the first entry in the specified v1/v2 or null if none.
Definition Entries.cpp:88
StaffCmper getStaff() const
Get the staff for the entry.
Definition Entries.cpp:84
EntryFrame(const details::GFrameHoldContext &gfhold, LayerIndex layerIndex, util::Fraction timeStretch)
Constructor function.
Definition Entries.h:610
Cmper getRequestedPartId() const
Get the requested part ID for the entry frame.
Definition Entries.h:733
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:133
MusxInstance< KeySignature > keySignature
this can be different than the measure key sig if the staff has independent key signatures
Definition Entries.h:727
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry frame.
Definition Entries.h:742
DocumentPtr getDocument() const
Get the document for the entry frame.
Definition Entries.cpp:82
std::vector< TupletInfo > tupletInfo
A list of the tuplets in the frame and their calculated starting and ending information.
Definition Entries.h:726
std::shared_ptr< const EntryFrame > getNext() const
Gets the entry frame for the next measure with the same staff and layer.
Definition Entries.cpp:115
bool calcIsCueFrame(bool includeVisibleInScore=false) const
Calculates if this entry frame is part of a cue.
Definition Entries.cpp:144
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:380
EntryInfoPtr getNextInFrame() const
Get the next entry in the frame.
Definition Entries.cpp:445
EntryInfoPtr(const std::shared_ptr< const EntryFrame > &entryFrame, size_t index=0)
Constructor function.
Definition Entries.h:390
EntryInfoPtr getNextSameV() const
Get the next entry in the frame in the same voice.
Definition Entries.cpp:453
size_t getIndexInFrame() const
Returns the index within the frame.
Definition Entries.h:416
util::Fraction calcGlobalElapsedDuration() const
Calculates the elapsed duration in global edu, removing any time stretch due to independent time sign...
Definition Entries.cpp:770
EntryInfoPtr getPreviousInVoice(int voice) const
Returns the previous entry in the frame in the specified v1/v2 or null if none.
Definition Entries.cpp:514
unsigned calcReverseGraceIndex() const
Caclulates the grace index counting leftward (used by other standards such as MNX)
Definition Entries.cpp:407
bool canBeBeamed() const
Determines if this entry can be beamed.
Definition Entries.cpp:538
bool isSameEntry(const EntryInfoPtr &src) const
Returns whether the input and the current instance refer to the same entry.
Definition Entries.cpp:386
EntryInfoPtr getPreviousInLayer() const
Get the previous entry in the same layer and staff. This can be in the previous measure.
Definition Entries.cpp:470
EntryInfoPtr getNextInLayer() const
Get the next entry in the same layer and staff. This can be in the next measure.
Definition Entries.cpp:434
unsigned calcLowestBeamStub() const
Returns the lowest beam stub at this entry, where 2 = 16th note stub, 3 = 32nd note stub,...
Definition Entries.cpp:711
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:479
unsigned calcLowestBeamStart() const
Returns the lowest beam number starting at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Entries.cpp:658
static EntryInfoPtr fromPositionOrNull(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measureId, EntryNumber entryNumber)
Searches the given position at staffId and measureId for the entryNumber.
Definition Entries.cpp:355
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:483
unsigned calcLowestBeamEnd() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Entries.cpp:688
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Entries.cpp:394
unsigned calcNumberOfBeams() const
Calculates the number of beams or flags on the entry.
Definition Entries.cpp:607
EntryInfoPtr getPreviousInFrame() const
Get the previous entry in the frame.
Definition Entries.cpp:481
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:413
EntryInfoPtr findBeamStartOrCurrent() const
Finds the first entry of a beamed group or returns the current entry if it is not beams.
Definition Entries.cpp:558
bool calcDisplaysAsRest() const
Calculates if an entry displays as a rest.
Definition Entries.cpp:524
MusxInstance< KeySignature > getKeySignature() const
Get the key signature of the entry.
Definition Entries.cpp:400
bool calcIsCue(bool includeVisibleInScore=false) const
Calculates if this entry is part of a cue.
Definition Entries.cpp:918
bool operator<(const EntryInfoPtr &other) const
Explicit operator< for std::map.
Definition Entries.h:565
StaffCmper getStaff() const
Get the staff cmper.
Definition Entries.cpp:396
EntryInfoPtr findBeamEnd() const
Finds the end entry of a beamed group.
Definition Entries.cpp:575
int calcEntrySize() const
Returns the entry size as a percentage, taking into account the beaming.
Definition Entries.cpp:904
bool calcIsBeamStart() const
Returns whether this is the start of a primary beam.
Definition Entries.cpp:551
EntryInfoPtr getPreviousSameV() const
Get the previous entry in the frame in the same voice.
Definition Entries.cpp:489
MusxInstance< others::StaffComposite > createCurrentStaff(const std::optional< StaffCmper > &forStaffId=std::nullopt) const
Creates the current StaffComposite for the entry.
Definition Entries.cpp:402
EntryInfoPtr getNextInVoice(int voice) const
Returns the next entry in the frame in the specified v1/v2 or null if none.
Definition Entries.cpp:504
const std::shared_ptr< const EntryInfo > operator->() const
Allows -> access to the underlying EntryInfo instance.
Definition Entries.cpp:370
bool calcUnbeamed() const
Returns whether this is an unbeamed entry.
Definition Entries.cpp:529
EntryInfoPtr()
Default constructor.
Definition Entries.h:383
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 Entries.cpp:419
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 Entries.cpp:956
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:721
bool calcIsFullMeasureRest() const
Returns whether this is a full measure rest.
Definition Entries.cpp:948
util::Fraction calcGlobalActualDuration() const
Calculates the actual duration in global edu, removing any time stretch due to independent time signa...
Definition Entries.cpp:775
MeasCmper getMeasure() const
Get the measure cmper.
Definition Entries.cpp:398
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:869
Information an entry along with the entry.
Definition Entries.h:810
bool v2Launch
indicates if this entry (which is voice1) launches a voice2 sequence
Definition Entries.h:827
unsigned graceIndex
Definition Entries.h:828
ClefIndex clefIndex
the clef index in effect for the entry.
Definition Entries.h:830
util::Fraction calcNextElapsedDuration() const
Calculates the next duration position after this entry.
Definition Entries.h:845
util::Fraction elapsedDuration
Definition Entries.h:823
ClefIndex clefIndexConcert
the concert clef index in effect for the entry.
Definition Entries.h:831
util::Fraction actualDuration
Definition Entries.h:825
MusxInstance< Entry > getEntry() const
Get the entry.
Definition Entries.h:835
Represents an entry containing metadata and notes.
Definition Entries.h:260
bool splitStem
Definition Entries.h:296
bool upStem
Whether a stem is up or down. (Only reliable when freezeStem is true.)
Definition Entries.h:300
Entry(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
Constructor function.
Definition Entries.h:266
EntryNumber getEntryNumber() const
Gets the entry number for this entry.
Definition Entries.h:319
bool articDetail
Indicates there is an articulation on the entry.
Definition Entries.h:288
std::pair< NoteType, unsigned > calcNoteInfo() const
Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu....
Definition Entries.h:334
bool isNote
If this value is false, the entry is a rest.
Definition Entries.h:283
bool noLeger
Hide ledger lines.
Definition Entries.h:301
bool freezeStem
Freeze stem flag (upStem gives the direction.)
Definition Entries.h:299
MusxInstance< Entry > getNext() const
Gets the next entry in this list or nullptr if none.
Definition Entries.cpp:36
bool noPlayback
Indicates that the entry should not be played back.
Definition Entries.h:310
bool voice2
This is a V2 note. (xml node <v2>)
Definition Entries.h:287
bool beamExt
Indicates that there is a beam extension on the entry.
Definition Entries.h:292
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Entries.h:362
MusxInstance< Entry > getPrevious() const
Gets the previous entry in this list or nullptr if none.
Definition Entries.cpp:46
bool secBeam
Signifies a secondary beam break occurs on the entry.
Definition Entries.h:294
bool stemDetail
Indicates there are stem modifications.
Definition Entries.h:302
bool slashGrace
Definition Entries.h:305
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:282
Evpu hOffset
Manual offset created with the Note Position Tool. (xml node is <posi>.)
Definition Entries.h:281
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:316
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:352
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:360
bool noteDetail
Indicates there is a note detail or EntrySize record for the entry.
Definition Entries.h:289
util::Fraction calcFraction() const
Calculates the duration as a util::Fraction of a whole note.
Definition Entries.h:339
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:343
bool crossStaff
Signifies that at least one note in the entry has been cross staffed.
Definition Entries.h:298
bool floatRest
Is floating rest. If false, the first note element gives the staff position of the rest.
Definition Entries.h:285
bool smartShapeDetail
Indicates this entry has a smart shape assignment.
Definition Entries.h:308
Edu duration
Duration of the entry, not taking into account tuplets.
Definition Entries.h:279
bool isHidden
Indicates the entry is hidden, (xml node is <ignore>)
Definition Entries.h:286
bool tupletStart
Indicates that a tuplet start on the entry.
Definition Entries.h:291
bool lyricDetail
Indicates there is a lyric assignment on the entry.
Definition Entries.h:311
int numNotes
Number of notes in the entry. There is an error if this is not the same as notes.size().
Definition Entries.h:280
bool sorted
Sorted flag.
Definition Entries.h:309
bool reverseDownStem
Indicates that a stem normally down is reversed.
Definition Entries.h:304
bool reverseUpStem
Indicates that a stem normally up is reversed.
Definition Entries.h:303
bool doubleStem
Creates a double stem on the entry. (Appears to be exclusive with splitStem.)
Definition Entries.h:295
bool isPossibleFullMeasureRest() const
Returns true if the entry could be a full-measure rest.
Definition Entries.h:349
bool beam
Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry....
Definition Entries.h:293
bool performanceData
Indicates there is performance data on the entry.
Definition Entries.h:312
bool dotTieAlt
Indicates dot or tie alterations are present.
Definition Entries.h:290
bool freezeBeam
Freeze beam flag (Derived from the presence of <freezeBeam> node.)
Definition Entries.h:313
bool graceNote
Indicate the entry is a grace note.
Definition Entries.h:284
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:251
Wraps an EntryInfo instance and a note index.
Definition Entries.h:854
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 Entries.cpp:1437
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:889
MusxInstance< others::PercussionNoteInfo > calcPercussionNoteInfo() const
Calculates the percussion note info for this note, if any.
Definition Entries.cpp:1476
MusxInstance< Note > operator->() const
Allows -> access to the underlying Note instance.
Definition Entries.h:880
bool operator<(const NoteInfoPtr &other) const
Explicit operator< for std::map.
Definition Entries.h:979
bool isSameNote(const NoteInfoPtr &src) const
Returns whether the input and the current instance refer to the same note.
Definition Entries.h:871
StaffCmper calcStaff() const
Calculates the staff number, taking into account cross staffing.
Definition Entries.cpp:1427
NoteInfoPtr getPrevious() const
Gets the next note in a chord on the same entry.
Definition Entries.h:955
NoteInfoPtr calcTieFrom(bool requireTie=true) const
Calculates the note that this note could tie from.
Definition Entries.cpp:1397
Note::NoteProperties calcNotePropertiesConcert() const
Calculates the note name, octave number, actual alteration, and staff position for the concert pitch ...
Definition Entries.cpp:1452
bool calcIsEnharmonicRespell() const
Returns if this note is enharmonically respelled in the current part view.
Definition Entries.cpp:1502
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:975
NoteInfoPtr(const EntryInfoPtr &entryInfo, size_t noteIndex)
Constructor.
Definition Entries.h:862
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:1352
Note::NoteProperties calcNotePropertiesInView() const
Calculates the note name, octave number, actual alteration, and staff position for the pitch of the n...
Definition Entries.cpp:1466
NoteInfoPtr findEqualPitch(const EntryInfoPtr &entry) const
Finds a note with the same pitch in the supplied entry.
Definition Entries.cpp:1329
NoteInfoPtr getNext() const
Gets the next note in a chord on the same entry.
Definition Entries.h:945
NoteInfoPtr()
Default constructor.
Definition Entries.h:857
std::unique_ptr< music_theory::Transposer > createTransposer() const
Creates a transposer for this Note instance.
Definition Entries.cpp:1497
Represents a single note element in an entry.
Definition Entries.h:166
bool upStemSecond
When the entry is upstem, it is drawn on the "wrong" side of the stem.
Definition Entries.h:192
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:245
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:188
NoteProperties calcNoteProperties(const MusxInstance< KeySignature > &key, KeySignature::KeyContext ctx, ClefIndex clefIndex, 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:1289
static constexpr NoteNumber RESTID
Non floating rests have a note with this noteId that defines their staff positions.
Definition Entries.h:175
int harmAlt
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7.
Definition Entries.h:187
bool upSplitStem
Definition Entries.h:196
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:204
bool tieEnd
Indicates a tie ends on this note.
Definition Entries.h:191
Note(const DocumentWeakPtr &document, NoteNumber noteId)
Constructor function.
Definition Entries.h:169
bool tieStart
Indicates a tie starts on this note.
Definition Entries.h:190
bool crossStaff
Signifies that the note has a details::CrossStaff note detail.
Definition Entries.h:189
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:1254
int harmLev
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signatu...
Definition Entries.h:186
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:194
std::tuple< music_theory::NoteName, int, int, int > NoteProperties
Note properites. A tuple containing:
Definition Entries.h:184
bool parenAcci
True if the accidental has parentheses.
Definition Entries.h:199
bool showAcci
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set....
Definition Entries.h:198
bool freezeAcci
True if the accidental should be forced on or off (based on showAcci.)
Definition Entries.h:200
A context wrapper for GFrameHold associated with a specific part and location.
Definition Entries.h:58
const GFrameHold * operator->() const
Provides const pointer-style access to the underlying GFrameHold.
Definition Entries.h:82
std::map< LayerIndex, bool > calcVoices() const
Calculates the number of voices used by the GFrameHold instance.
Definition Entries.cpp:1178
std::shared_ptr< const EntryFrame > createEntryFrame(LayerIndex layerIndex) const
Returns the EntryFrame for all entries in the given layer.
Definition Entries.cpp:1039
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:99
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:1228
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 Entries.cpp:1155
Cmper getRequestedPartId() const
Returns the requested part ID associated with this context.
Definition Entries.h:75
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:1202
Represents the attributes of a Finale frame holder.
Definition Details.h:658
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
constexpr dom::Edu calcEduDuration() const
Calculates duration as a fraction of a whole note.
Definition Fraction.h:129
static Fraction fromEdu(dom::Edu edu)
Constructs a Fraction from edu.
Definition Fraction.h:84
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:35
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:56
unsigned calcNumberOfBeamsInEdu(Edu duration)
Calculates the number of beams or flags in the Edu value.
Definition Entries.cpp:593
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:40
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:619
size_t startIndex
the index of the first entry in the tuplet
Definition Entries.h:621
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:628
bool calcIsTremolo() const
Calculates if this tuplet represents a tremolo based on the following criteria.
Definition Entries.cpp:160
bool calcCreatesSingletonLeft() const
Calculates if this tuplet is being used to create a singleton beam to the left.
Definition Entries.h:670
size_t endIndex
the index of the last entry in the tuplet
Definition Entries.h:622
util::Fraction endDura
the actual duration where the tuplet ends
Definition Entries.h:624
bool calcCreatesBeamContinuationRight() const
Calculates if this tuplet creates a beam continuation over a barline to the right,...
Definition Entries.cpp:273
util::Fraction startDura
the actual duration where the tuplet starts
Definition Entries.h:623
MusxInstance< details::TupletDef > tuplet
the tuplet
Definition Entries.h:620
bool voice2
whether this tuplet is for voice2
Definition Entries.h:625
bool calcCreatesSingletonRight() const
Calculates if this tuplet is being used to create a singleton beam to the right.
Definition Entries.h:659
bool calcCreatesBeamContinuationLeft() const
Calculates if this tuplet creates a beam continuation over a barline to the left, as created by the B...
Definition Entries.cpp:300
bool calcCreatesTimeStretch() const
Detects tuplets being used to create time stretch in an independent time signature.
Definition Entries.cpp:321