26#include "musx/util/Fraction.h"
27#include "BaseClasses.h"
28#include "CommonClasses.h"
124 const std::shared_ptr<const others::Staff>& staff =
nullptr)
const;
148 :
Base(document, partId, shareMode), m_entnum(entnum), m_prev(prev), m_next(next)
182 std::vector<std::shared_ptr<Note>>
notes;
190 std::shared_ptr<Entry>
getNext()
const;
215 MUSX_INTEGRITY_ERROR(
"Entry " + std::to_string(m_entnum) +
" has an incorrect number of notes.");
249 EntryInfoPtr(
const std::shared_ptr<const EntryFrame>& entryFrame,
size_t index = 0)
250 : m_entryFrame(entryFrame), m_indexInFrame(index) {}
253 const std::shared_ptr<const EntryInfo>
operator->()
const;
256 operator bool()
const;
263 std::shared_ptr<const EntryFrame>
getFrame()
const {
return m_entryFrame; }
279 std::shared_ptr<others::StaffComposite>
createCurrentStaff(
const std::optional<InstCmper>& forStaffId = std::nullopt)
const;
323 {
return iterateBeamGroup<&EntryInfoPtr::nextPotentialInBeam, &EntryInfoPtr::previousPotentialInBeam>(includeHiddenEntries); }
327 {
return iterateBeamGroup<&EntryInfoPtr::previousPotentialInBeam, &EntryInfoPtr::nextPotentialInBeam>(includeHiddenEntries); }
372 bool canBeBeamed()
const;
374 unsigned calcVisibleBeams()
const;
376 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
377 std::optional<unsigned> iterateFindRestsInSecondaryBeam(
const EntryInfoPtr nextOrPrevInBeam)
const;
379 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
382 template<EntryInfoPtr(EntryInfoPtr::* Iterator)() const>
383 bool iterateNotesExistLeftOrRight()
const;
385 EntryInfoPtr nextPotentialInBeam(
bool includeHiddenEntries)
const;
387 EntryInfoPtr previousPotentialInBeam(
bool includeHiddenEntries)
const;
389 template<EntryInfoPtr(EntryInfoPtr::* Iterator)(
bool) const, EntryInfoPtr(EntryInfoPtr::* ReverseIterator)(
bool) const>
390 EntryInfoPtr iterateBeamGroup(
bool includeHiddenEntries)
const;
392 std::shared_ptr<const EntryFrame> m_entryFrame;
393 size_t m_indexInFrame{};
418 std::shared_ptr<const details::TupletDef>
tuplet;
455 const std::vector<std::shared_ptr<const EntryInfo>>&
getEntries()
const
456 {
return m_entries; }
464 void addEntry(
const std::shared_ptr<const EntryInfo>& entry)
465 { m_entries.emplace_back(entry); }
469 std::shared_ptr<const EntryFrame>
getNext()
const;
473 std::shared_ptr<const EntryFrame>
getPrevious()
const;
479 bool m_forWrittenPitch;
481 std::vector<std::shared_ptr<const EntryInfo>> m_entries;
502 explicit EntryInfo(
const std::shared_ptr<const Entry>& entry)
505#ifndef DOXYGEN_SHOULD_IGNORE_THIS
522 auto retval = m_entry.lock();
524 throw std::logic_error(
"Entry pointer is no longer valid");
530 std::weak_ptr<const Entry> m_entry;
544 : m_entry(entryInfo), m_noteIndex(noteIndex)
548 operator bool()
const
549 {
return m_entry && m_noteIndex < m_entry->getEntry()->notes.size(); }
553 {
return m_entry.
isSameEntry(src.m_entry) && m_noteIndex == src.m_noteIndex; }
558 MUSX_ASSERT_IF(m_noteIndex >= m_entry->getEntry()->notes.size()) {
559 throw std::logic_error(
"Note index is too large for notes array.");
561 return m_entry->getEntry()->notes[m_noteIndex];
Base class to enforce polymorphism across all DOM classes.
Definition BaseClasses.h:64
virtual void integrityCheck()
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition BaseClasses.h:133
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:72
Represents a vector of EntryInfo instances for a given frame, along with computed information.
Definition Entries.h:403
bool isForWrittenPitch() const
Returns if this entry frame was created for written pitch.
Definition Entries.h:452
InstCmper getStaff() const
Get the staff for the entry.
Definition Entries.h:442
MeasCmper getMeasure() const
Get the measure for the entry.
Definition Entries.h:445
std::shared_ptr< const EntryFrame > getPrevious() const
Gets the entry frame for the previous measure with the same staff and layer.
Definition Implementations.cpp:142
void addEntry(const std::shared_ptr< const EntryInfo > &entry)
Add an entry to the list.
Definition Entries.h:464
const std::vector< std::shared_ptr< const EntryInfo > > & getEntries() const
Get the entry list.
Definition Entries.h:455
EntryInfoPtr getFirstInVoice(int voice) const
Returns the first entry in the specified v1/v2 or null if none.
Definition Implementations.cpp:117
std::shared_ptr< KeySignature > keySignature
Definition Entries.h:438
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Entries.h:448
std::vector< TupletInfo > tupletInfo
A list of the tuplets in the frame and their calculated starting and ending information.
Definition Entries.h:437
std::shared_ptr< const EntryFrame > getNext() const
Gets the entry frame for the next measure with the same staff and layer.
Definition Implementations.cpp:134
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:239
EntryInfoPtr getNextInFrame() const
Get the next entry in the frame.
Definition Implementations.cpp:235
EntryInfoPtr(const std::shared_ptr< const EntryFrame > &entryFrame, size_t index=0)
Constructor function.
Definition Entries.h:249
EntryInfoPtr getNextSameV() const
Get the next entry in the frame in the same voice.
Definition Implementations.cpp:243
size_t getIndexInFrame() const
Returns the index within the frame.
Definition Entries.h:266
NoteInfoPtr findEqualPitch(const NoteInfoPtr &src) const
Finds a note with the same pitch in the current entry.
Definition Implementations.cpp:318
unsigned calcReverseGraceIndex() const
Caclulates the grace index counting leftward (used by other standards such as MNX)
Definition Implementations.cpp:197
std::shared_ptr< KeySignature > getKeySignature() const
Get the key signature of the entry.
Definition Implementations.cpp:188
bool isSameEntry(const EntryInfoPtr &src) const
Returns whether the input and the current instance refer to the same entry.
Definition Implementations.cpp:174
EntryInfoPtr getPreviousInLayer() const
Get the previous entry in the same layer and staff. This can be in the previous measure.
Definition Implementations.cpp:260
EntryInfoPtr getNextInLayer() const
Get the next entry in the same layer and staff. This can be in the next measure.
Definition Implementations.cpp:224
unsigned calcLowestBeamStub() const
Returns the lowest beam stub at this entry, where 2 = 16th note stub, 3 = 32nd note stub,...
Definition Implementations.cpp:493
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:322
std::shared_ptr< others::StaffComposite > createCurrentStaff(const std::optional< InstCmper > &forStaffId=std::nullopt) const
Creates the current StaffComposite for the entry.
Definition Implementations.cpp:190
unsigned calcLowestBeamStart() const
Returns the lowest beam number starting at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:440
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:326
unsigned calcLowestBeamEnd() const
Returns the lowest beam number ending at this entry, where 1 = 8th note beam, 2 = 16th note beam,...
Definition Implementations.cpp:470
LayerIndex getLayerIndex() const
Get the layer index (0..3) of the entry.
Definition Implementations.cpp:182
unsigned calcNumberOfBeams() const
Calculates the number of beams or flags on the entry.
Definition Implementations.cpp:389
EntryInfoPtr getPreviousInFrame() const
Get the previous entry in the frame.
Definition Implementations.cpp:271
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:263
bool calcDisplaysAsRest() const
Calculates if an entry displays as a rest.
Definition Implementations.cpp:304
EntryInfoPtr findBeamEnd() const
Finds the end entry of a beamed group.
Definition Implementations.cpp:356
bool calcIsBeamStart() const
Returns whether this is the start of a primary beam.
Definition Implementations.cpp:349
EntryInfoPtr getPreviousSameV() const
Get the previous entry in the frame in the same voice.
Definition Implementations.cpp:279
EntryInfoPtr getNextInVoice(int voice) const
Returns the next entry in the frame in the specified v1/v2 or null if none.
Definition Implementations.cpp:294
const std::shared_ptr< const EntryInfo > operator->() const
Allows -> access to the underlying EntryInfo instance.
Definition Implementations.cpp:156
InstCmper getStaff() const
Get the staff cmper.
Definition Implementations.cpp:184
bool calcUnbeamed() const
Returns whether this is an unbeamed entry.
Definition Implementations.cpp:309
EntryInfoPtr()
Default constructor.
Definition Entries.h:242
std::optional< size_t > calcNextTupletIndex(std::optional< size_t > currentIndex) const
Returns the next higher tuplet index that this entry starts, or std::nullopt if none.
Definition Implementations.cpp:209
bool calcBeamStubIsLeft() const
Calculates if a beam stub on this entry would go left or right. It does not check that an entry actua...
Definition Implementations.cpp:503
MeasCmper getMeasure() const
Get the measure cmper.
Definition Implementations.cpp:186
Information an entry along with the entry.
Definition Entries.h:497
bool v2Launch
indicates if this entry (which is voice1) launches a voice2 sequence
Definition Entries.h:512
unsigned graceIndex
Definition Entries.h:513
ClefIndex clefIndex
Definition Entries.h:515
std::shared_ptr< const Entry > getEntry() const
Get the entry.
Definition Entries.h:520
util::Fraction elapsedDuration
the elapsed duration within the measure where this entry occurs (in fractions of a whole note)
Definition Entries.h:510
util::Fraction actualDuration
the actual duration of entry (in fractions of a whole note), taking into account tuplets and grace no...
Definition Entries.h:511
Represents an entry containing metadata and notes.
Definition Entries.h:141
std::pair< NoteType, int > calcNoteInfo() const
Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu....
Definition Entries.h:200
bool upStem
Whether a stem is up or down. (Only reliable when freezeStem is true.)
Definition Entries.h:173
Entry(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
Constructor function.
Definition Entries.h:147
EntryNumber getEntryNumber() const
Gets the entry number for this entry.
Definition Entries.h:185
bool articDetail
Indicates there is an articulation on the entry.
Definition Entries.h:168
bool isNote
If this value is false, the entry is a rest.
Definition Entries.h:163
bool freezeStem
Freeze stem flag (upStem gives the direction.)
Definition Entries.h:172
bool voice2
This is a V2 note. (xml node <v2>)
Definition Entries.h:167
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Entries.h:221
bool secBeam
Signifies a secondary beam break occurs on the entry.
Definition Entries.h:170
void integrityCheck() override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Entries.h:211
bool stemDetail
Indicates there are stem modification.
Definition Entries.h:174
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:162
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:182
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:219
util::Fraction calcFraction() const
Calculates the duration as a util::Fraction of a whole note.
Definition Entries.h:205
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:209
bool crossStaff
Signifies that at least one note in the entry has been cross staffed.
Definition Entries.h:171
bool floatRest
Is floating rest. If false, the first note element gives the staff position of the rest.
Definition Entries.h:165
bool smartShapeDetail
Indicates this entry has a smart shape assignment.
Definition Entries.h:175
Edu duration
Duration of the entry, not taking into account tuplets.
Definition Entries.h:160
bool isHidden
Indicates the entry is hidden, (xml node is <ignore>)
Definition Entries.h:166
bool lyricDetail
Indicates there is a lyric assignment on the entry.
Definition Entries.h:177
int numNotes
Number of notes in the entry. There is an error if this is not the same as notes.size().
Definition Entries.h:161
bool sorted
Sorted flag.
Definition Entries.h:176
bool beam
Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry....
Definition Entries.h:169
bool performanceData
Indicates there is performance data on the entry.
Definition Entries.h:178
bool freezeBeam
Freeze beam flag (Derived from the presence of <freezeBeam> node.)
Definition Entries.h:179
std::shared_ptr< Entry > getNext() const
Gets the next entry in this list or nullptr if none.
Definition Implementations.cpp:62
bool graceNote
Indicate the entry is a grace note.
Definition Entries.h:164
std::shared_ptr< Entry > getPrevious() const
Gets the previous entry in this list or nullptr if none.
Definition Implementations.cpp:72
Wraps an EntryInfo instance and a note index.
Definition Entries.h:535
InstCmper calcStaff() const
Calculates the staff number, taking into account cross staffing.
Definition Implementations.cpp:1618
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:565
bool isSameNote(const NoteInfoPtr &src) const
Returns whether the input and the current instance refer to the same note.
Definition Entries.h:552
std::tuple< Note::NoteName, int, int, int > calcNoteProperties() const
Calculates the note name, octave number, actual alteration, and staff position.
Definition Implementations.cpp:1628
std::shared_ptr< const Note > operator->() const
Allows -> access to the underlying Note instance.
Definition Entries.h:556
NoteInfoPtr calcTieFrom() const
Calculates the note that this note could tie from. Check the return value's Note::tieStart to see if ...
Definition Implementations.cpp:1584
NoteInfoPtr(const EntryInfoPtr &entryInfo, size_t noteIndex)
Constructor.
Definition Entries.h:543
NoteInfoPtr calcTieTo() const
Calculates the note that this note could tie to. Check the return value's Note::tieEnd to see if ther...
Definition Implementations.cpp:1550
NoteInfoPtr()
Default constructor.
Definition Entries.h:538
std::unique_ptr< music_theory::Transposer > createTransposer() const
Creates a transposer for this Note instance.
Definition Implementations.cpp:1649
Represents a single note element in an entry.
Definition Entries.h:69
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:126
bool isValid
Should always be true but otherwise appears to be used internally by Finale.
Definition Entries.h:91
std::tuple< NoteName, int, int, int > calcNoteProperties(const std::shared_ptr< KeySignature > &key, ClefIndex clefIndex, const std::shared_ptr< const others::Staff > &staff=nullptr) const
Calculates the note name, octave number, actual alteration, and staff position.
Definition Implementations.cpp:1504
int harmAlt
Chromatic alteration relative to the key signature. Never has a magnitude greater than +/-7.
Definition Entries.h:90
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:100
bool tieEnd
Indicates a tie ends on this note.
Definition Entries.h:94
Note(const DocumentWeakPtr &document, NoteNumber noteId)
Constructor function.
Definition Entries.h:72
bool tieStart
Indicates a tie starts on this note.
Definition Entries.h:93
bool crossStaff
Signifies that the note has a details::CrossStaff note detail.
Definition Entries.h:92
int harmLev
Diatonic displacement relative to middle C or to the tonic in the middle C octave (if the key signatu...
Definition Entries.h:89
static const xml::XmlElementArray< Note > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
NoteName
The available note names, in array order.
Definition Entries.h:79
bool showAcci
True if the note has an accidental. (Dynamically changed by Finale unless freezeAcci is set....
Definition Entries.h:95
bool freezeAcci
True if the accidental should be forced on or off (based on showAcci.)
Definition Entries.h:96
Represents the attributes of a Finale frame holder.
Definition Details.h:283
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:37
static Fraction fromEdu(int edu)
Constructs a Fraction from edu.
Definition Fraction.cpp:31
A dependency-free, header-only collection of useful functions for music theory.
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:70
int16_t InstCmper
Enigma staff (inst) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:67
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
std::pair< NoteType, unsigned > calcNoteInfoFromEdu(Edu duration)
Calculates the NoteType and number of dots in an Edu value.
Definition Implementations.cpp:82
unsigned calcNumberOfBeamsInEdu(Edu duration)
Calculates the number of beams or flags in the Edu value.
Definition Implementations.cpp:375
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:68
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:69
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:32
class to track tuplets in the frame
Definition Entries.h:417
size_t startIndex
the index of the first entry in the tuplet
Definition Entries.h:419
size_t endIndex
the index of the last entry in the tuplet
Definition Entries.h:420
util::Fraction endDura
the actual duration where the tuplet ends
Definition Entries.h:422
std::shared_ptr< const details::TupletDef > tuplet
the tuplet
Definition Entries.h:418
util::Fraction startDura
the actual duration where the tuplet starts
Definition Entries.h:421
TupletInfo(const std::shared_ptr< const details::TupletDef > &tup, size_t index, util::Fraction start)
Constructor.
Definition Entries.h:425