MUSX Document Model
Loading...
Searching...
No Matches
Staff.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 <functional>
25#include <type_traits>
26#include <utility>
27
28#include "musx/util/Logger.h"
29#include "musx/util/Fraction.h"
30
31#include "BaseClasses.h"
32#include "CommonClasses.h"
33 // do not add other dom class dependencies. Use .cpp files for implementations that need total class access.
34
35namespace musx {
36namespace dom {
37
38namespace details {
39class Baseline;
40class BaselineNoInci;
41class ShapeNoteBase;
42}
43
44namespace others {
45
46class StaffStyle;
53class Staff : public OthersBase
54{
55public:
68
73 enum class NotationStyle
74 {
75 Standard,
77 Tablature
78 };
79
84 enum class HideMode
85 {
86 None,
87 Cutaway,
89 Score
90 };
91
97 {
98 Normal,
100 Rhythmic,
101 Blank,
105 };
106
112 {
113 public:
114 int interval{};
115 int adjust{};
116
118 };
119
132
141 {
142 public:
144
145 bool setToClef{};
147
149 std::shared_ptr<KeySigTransposition> keysig;
150
152 std::shared_ptr<ChromaticTransposition> chromatic;
153
155 bool isSame(const Transposition& other) const;
156
157 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
158 {
160 Cmper thisCmper = 0;
161 if (const auto parent = getParent<others::Staff>()) {
162 thisCmper = parent->getCmper();
163 }
164 if (!keysig && !chromatic) {
165 MUSX_INTEGRITY_ERROR("Transposition settings " + std::to_string(thisCmper) + " has neither a key signature nor chromatic settings.");
166 } else if (keysig && chromatic) {
167 MUSX_INTEGRITY_ERROR("Transposition settings " + std::to_string(thisCmper) + " has both key signature and chromatic settings.");
168 }
169 }
170
172 };
173
175 explicit Staff(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
176 : OthersBase(document, partId, shareMode, cmper) {}
177
178 // WARNING: Any fields added here must have a mask added in StaffStyle (if it does not already exist)
179 // and must be added to StaffComposite::applyStyle.
180
181 // Public properties corresponding to the XML structure
183 std::shared_ptr<FontInfo> noteFont;
185 bool useNoteFont{};
188 std::optional<int> staffLines{};
189 std::optional<std::vector<int>> customStaff;
191 std::string instUuid;
192 int capoPos{};
194 bool floatKeys{};
195 bool floatTime{};
196 bool blineBreak{};
197 bool rbarBreak{};
198 bool hasStyles{};
201 // No fixture has a partially shared Staff (part-specific staffSpec records are fully unshared).
202 // If one is found, Transposition must be copied and rebound before overlaying its nested fields.
203 // See PartContextRebinder<details::CenterShape> and the CenterShape field mappings for the pattern.
204 std::shared_ptr<Transposition> transposition;
221 bool flatBeams{};
225 bool hideLyrics{};
226 bool noOptimize{};
229 bool hideRepeats{};
231 bool hideRptBars{};
232 bool hideKeySigs{};
234 bool hideClefs{};
236 bool hideChords{};
237 bool noKey{};
242 bool hideRests{};
243 bool hideTies{};
244 bool hideDots{};
254 bool hideTuplets{};
256 bool hideStems{};
258 bool hideBeams{};
276
277 // The following values are not in xml but computed by the factory.
278
292 std::optional<int> autoNumberValue;
293 std::optional<Cmper> percussionMapId;
294
298
302
304 bool calcShowName() const;
305
308
312
316 util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
317
321 util::EnigmaParsingContext getAbbreviatedInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
322
327 std::string getFullInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
328
333 std::string getAbbreviatedInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
334
340 std::string getPlaybackRouteName() const;
341
343 bool calcShowInstrumentName() const;
344
347
350
353
355 bool showNamesForPart(Cmper partId) const
356 { return partId == SCORE_PARTID ? !hideNameInScore : showNameInParts; }
357
367 static void calcAllAutoNumberValues(const DocumentPtr& document);
368
374 template <typename SubType>
375 static void calcAllRuntimeValues(const DocumentPtr& document);
376
381 std::pair<std::string, bool> calcAutoNumberingAffix() const;
382
386 std::string addAutoNumbering(const std::string& plainName) const;
387
392 ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch = false) const;
393
395 ClefIndex calcFirstClefIndex(bool forWrittenPitch = false) const
396 { return calcClefIndexAt(1, 0, forWrittenPitch); }
397
402 static ClefIndex calcFirstClefIndex(const DocumentPtr& document, Cmper partId, StaffCmper staffCmper);
403
420
427 MeasCmper measureId,
428 bool forWrittenPitch,
429 std::function<bool(const ClefChange&)> iterator) const;
430
432 int calcNumberOfStafflines() const;
433
435 int calcMiddleStaffPosition() const;
436
438 [[nodiscard]] Evpu calcRestOffset(Edu edu) const;
439
445 [[nodiscard]] std::pair<Evpu, Evpu> calcBarlineOffsetsFromCenter() const;
446
453
458 template<typename BaselineType,
459 std::enable_if_t<std::is_base_of<details::BaselineNoInci, BaselineType>::value, int> = 0>
461 {
462 return calcBaselinePositionImpl<BaselineType>(systemId, std::nullopt);
463 }
464
470 template<typename BaselineType,
471 std::enable_if_t<std::is_base_of<details::Baseline, BaselineType>::value &&
472 !std::is_base_of<details::BaselineNoInci, BaselineType>::value, int> = 0>
473 Evpu calcBaselinePosition(SystemCmper systemId, Cmper lyricNumber) const
474 {
475 return calcBaselinePositionImpl<BaselineType>(systemId, lyricNumber);
476 }
477
481 std::vector<LyricsLineInfo> createLyricsLineInfo(SystemCmper systemId) const;
482
484 int calcTopLinePosition() const;
485
488 { return static_cast<Evpu>(calcTopLinePosition() * static_cast<int>(EVPU_PER_STAFF_POSITION)); }
489
491 int calcBottomLinePosition() const;
492
495 { return static_cast<Evpu>(calcBottomLinePosition() * static_cast<int>(EVPU_PER_STAFF_POSITION)); }
496
498 bool hasInstrumentAssigned() const;
499
505 std::pair<int, int> calcTranspositionInterval() const;
506
509 MusxInstanceList<PartDefinition> getContainingParts(bool includeScore = true) const;
510
514
523 bool calcAlternateNotationHidesEntries(LayerIndex forLayerIndex) const;
524
528 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator) const;
529
532 bool calcIsSameNotationStyle(const Staff& other) const;
533
534 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
535 {
537 if (!staffLines && !customStaff) {
538 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has neither a standard nor a custom staff definition.");
539 } else if (staffLines && customStaff) {
540 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has both a standard and a custom staff definition.");
541 }
542 if (customStaff) { // guarantee ascending order of staves.
543 std::sort(customStaff.value().begin(), customStaff.value().end(),
544 [](const auto& a, const auto& b) { return a < b; });
545 }
546 if (transposition) {
547 if (!transposition->chromatic && !transposition->keysig) {
548 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with neither keysig nor chromatic transposition defined.");
549 } else if (transposition->chromatic && transposition->keysig) {
550 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with both keysig and chromatic transposition defined.");
551 }
552 }
553 if (useNoteFont && !noteFont) {
554 noteFont = std::make_shared<FontInfo>(getDocument()); // do this first to avoid unreachable code warning, since MUSX_INTEGRITY_ERROR might throw
555 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " specifies to use a custom notehead font, but no custom font was provided.");
556 }
557 }
558
559 constexpr static std::string_view XmlNodeName = "staffSpec";
561
562private:
563 template <typename NamePositionType>
564 MusxInstance<NamePositioning> getNamePosition() const;
565
566 template<typename BaselineType>
567 Evpu calcBaselinePositionImpl(SystemCmper systemId, std::optional<Cmper> lyricNumber) const;
568};
569
577class StaffStyle : public Staff
578{
579protected:
581 explicit StaffStyle(const MusxInstance<Staff>& staff)
582 : Staff(*staff) {}
583
587 {
588 masks = std::make_shared<Masks>(ptrToSelf);
589 }
590
591public:
593 explicit StaffStyle(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
594 : Staff(document, partId, shareMode, cmper) {}
595
646
647 std::string styleName;
648 bool copyable{};
649 bool addToMenu{};
650 // No fixture has a part-specific StaffStyle. If partial sharing is observed, both Masks and the
651 // inherited Transposition will need part-context rebinding and copy-overlay population.
652 // See PartContextRebinder<details::CenterShape> and the CenterShape field mappings for the pattern.
653 std::shared_ptr<Masks> masks;
655
678 bool containsInstrumentChange() const;
679
688 Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
689
690 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
691 {
692 if (!masks) {
693 // Finale allows creation of staff styles with no masks, so this is just a verbose comment
695 + " (" + std::to_string(getCmper()) + ") does not override anything.");
696 createMasks(ptrToThis);
697 }
698 if (useNoteFont && !masks->floatNoteheadFont && !noteFont) {
699 useNoteFont = false; // silence integrity check in Staff.
700 }
701 Staff::integrityCheck(ptrToThis);
702 }
703
704 constexpr static std::string_view XmlNodeName = "staffStyle";
706};
707
718{
719public:
721 explicit StaffStyleAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
722 : EnigmaMusicRange(document, partId, shareMode, cmper, inci) {}
723
725
730
731 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
732 {
734 if (!styleId) {
735 MUSX_INTEGRITY_ERROR(std::string("Staff style assignment has no staff style id:")
736 + " Part " + std::to_string(getSourcePartId())
737 + " Staff " + std::to_string(getCmper())
738 );
739 }
740 }
741
742 constexpr static std::string_view XmlNodeName = "staffStyleAssign";
744};
745
754{
755private:
757 explicit StaffComposite(const MusxInstance<Staff>& staff, MeasCmper measId, Edu eduPosition)
758 : StaffStyle(staff), m_measureId(measId), m_eduPosition(eduPosition) {}
759
762 void applyStyle(const MusxInstance<StaffStyle>& staffStyle);
763
764 const MeasCmper m_measureId;
765 const Edu m_eduPosition;
766 bool m_instUuidChanged{};
767
768public:
780 static MusxInstance<StaffComposite> createCurrent(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
781
783 MeasCmper getMeasureId() const { return m_measureId; }
784
786 Edu getEduPosition() const { return m_eduPosition; }
787
789 bool getInstrumentUuidChanged() const { return m_instUuidChanged; }
790
793 ClefIndex calcClefIndex(bool forWrittenPitch = false) const
794 { return this->calcClefIndexAt(m_measureId, m_eduPosition, forWrittenPitch); }
795
798};
799
800} // namespace others
801} // namespace dom
802} // namespace musx
EnigmaBase class for classes that are contained by other classes.
Definition BaseClasses.h:179
ContainedClassBase(const MusxInstance< EnigmaBase > &parent)
Constructs a ContainedClassBase object.
Definition BaseClasses.h:211
DocumentPtr getDocument() const
Gets a reference to the Document.
Definition DocumentElement.h:58
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:95
Cmper getSourcePartId() const
Gets the source partId for this instance. If an instance is fully shared with the score,...
Definition BaseClasses.h:108
virtual void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis)
Performs a final consistency check after population.
Definition BaseClasses.h:116
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:555
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:118
EnigmaBase class for all "others" types.
Definition BaseClasses.h:261
Cmper getCmper() const
Gets the cmper key value.
Definition BaseClasses.h:306
The representation of a range of music used by Enigma files.
Definition CommonClasses.h:873
Represents a composite of an underlying Staff instance with any applicable StaffStyle instances appli...
Definition Staff.h:754
static MusxInstance< StaffComposite > createCurrent(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition)
Calculates the current staff at the specified metric position by applying all relevant staff styles,...
Definition Staff.cpp:1223
bool getInstrumentUuidChanged() const
Returns if this composite staff includes an instrument uuid changed by a staff style.
Definition Staff.h:789
ClefIndex calcClefIndex(bool forWrittenPitch=false) const
Returns the clef in this staff at the location of the composite staff.
Definition Staff.h:793
Edu getEduPosition() const
Returns the Edu position this staff composite was created with.
Definition Staff.h:786
MusxInstance< others::Staff > getRawStaff() const
Returns the underlying staff without any staff styles applied.
Definition Staff.cpp:1214
MeasCmper getMeasureId() const
Returns the measure this staff composite was created with.
Definition Staff.h:783
Represents an assignment.
Definition Staff.h:718
Cmper styleId
The cmper of the assigned StaffStyle.
Definition Staff.h:724
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition Staff.h:731
StaffStyleAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
Constructor function.
Definition Staff.h:721
static const xml::XmlElementArray< StaffStyleAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:742
MusxInstance< StaffStyle > getStaffStyle() const
Returns the StaffStyle instance for this assignment.
Definition Staff.cpp:1279
lists the masks that deterimine if this staff style overrides the staff settings
Definition Staff.h:598
bool rbarBreak
overrides Staff::rbarBreak
Definition Staff.h:612
bool blineBreak
overrides Staff::blineBreak
Definition Staff.h:611
bool hideRptBars
overrides Staff::hideRptBars
Definition Staff.h:621
bool showTies
overrides Staff::hideTies
Definition Staff.h:630
bool negTimeParts
overrides Staff::hideTimeSigsInParts
Definition Staff.h:641
bool hideStaffLines
overrides Staff::hideStaffLines
Definition Staff.h:639
bool fullName
overrides Staff::fullNameTextId
Definition Staff.h:617
bool floatNoteheadFont
overrides notehead font settings
Definition Staff.h:602
bool negKey
overrides Staff::hideKeySigs
Definition Staff.h:622
bool negClef
overrides Staff::hideClefs
Definition Staff.h:624
bool negRepeat
overrides Staff::hideRepeats
Definition Staff.h:614
bool flatBeams
overrides Staff::flatBeams
Definition Staff.h:604
bool showNameParts
overrides Staff::showNameInParts
Definition Staff.h:637
bool hideChords
overrides Staff::hideChords
Definition Staff.h:634
bool hideBarlines
overrides Staff::hideBarlines
Definition Staff.h:616
bool noOptimize
overrides Staff::noOptimize
Definition Staff.h:606
bool blankMeasureRest
overrides Staff::blankMeasure
Definition Staff.h:605
bool staffType
overrides staff properties (see StaffComposite::applyStyle)
Definition Staff.h:609
bool negMnumb
overrides Staff::hideMeasNums
Definition Staff.h:613
bool hideKeySigsShowAccis
overrides Staff::hideKeySigsShowAccis
Definition Staff.h:642
bool redisplayLayerAccis
overrides Staff::redisplayLayerAccis
Definition Staff.h:640
bool negNameScore
overrides Staff::hideNameInScore
Definition Staff.h:615
static const xml::XmlElementArray< Masks > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool hideFretboards
overrides Staff::hideFretboards
Definition Staff.h:635
bool hideLyrics
overrides Staff::hideLyrics
Definition Staff.h:636
bool fullNamePos
overrides presence, absence of NamePositionStyleFull instance.
Definition Staff.h:627
bool transposition
overrides transposition fields
Definition Staff.h:610
bool abrvName
overrides Staff::abbrvNameTextId
Definition Staff.h:618
bool negTime
overrides Staff::hideTimeSigs (in Score)
Definition Staff.h:623
bool altNotation
overrides alternate notation properties (see StaffComposite::applyStyle)
Definition Staff.h:629
bool showNoteColors
overrides Staff::showNoteColors
Definition Staff.h:638
bool showStems
overrides stem properties (see StaffComposite::applyStyle)
Definition Staff.h:633
bool abrvNamePos
overrides presence, absence of NamePositionStyleAbbreviated instance.
Definition Staff.h:628
bool floatKeys
overrides Staff::floatKeys
Definition Staff.h:619
bool notationStyle
overrides notations style
Definition Staff.h:607
bool showRests
overrides Staff::hideRests
Definition Staff.h:632
bool useNoteShapes
overrides Staff::useNoteShapes
Definition Staff.h:603
bool floatTime
overrides Staff::floatTime
Definition Staff.h:620
bool hideStaff
overrides Staff::hideMode
Definition Staff.h:625
bool defaultClef
overrides Staff::defaultClef
Definition Staff.h:608
bool noKey
overrides Staff::noKey
Definition Staff.h:626
bool showDots
overrides Staff::hideDots
Definition Staff.h:631
Represents a Finale staff style.
Definition Staff.h:578
std::shared_ptr< Masks > masks
Definition Staff.h:653
static const xml::XmlElementArray< StaffStyle > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
StaffStyle(const MusxInstance< Staff > &staff)
protected constructor for StaffComposite. This constructor must be followed by a call to createMasks.
Definition Staff.h:581
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition Staff.h:690
StaffStyle(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:593
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:704
bool containsInstrumentChange() const
Determines whether this staff style represents or includes an instrument change.
Definition Staff.cpp:1247
static MusxInstanceList< StaffStyle > findAllOverlappingStyles(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition)
Finds a subset from all StaffStyle instances that overlap with the specified metric position on a giv...
Definition Staff.cpp:1255
bool copyable
whether the staff style assignments for this style should be copied when copy/pasting music
Definition Staff.h:648
void createMasks(const MusxInstance< EnigmaBase > &ptrToSelf)
Separate creator for masks.
Definition Staff.h:586
std::string styleName
name of staff style
Definition Staff.h:647
bool addToMenu
add this staff style to the context menu for staff styles
Definition Staff.h:649
Represents chromatic transposition details.
Definition Staff.h:125
static const xml::XmlElementArray< ChromaticTransposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int diatonic
The diatonic interval. See music_theory::Transposer for more information.
Definition Staff.h:128
int alteration
The alteration that defines the chromatic interval (in chromatic half-steps). See music_theory::Trans...
Definition Staff.h:127
Represents key signature transposition details.
Definition Staff.h:112
int adjust
The adjustment to the number of sharps or flats in the key signature.
Definition Staff.h:115
static const xml::XmlElementArray< KeySigTransposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int interval
The diatonic transposition interval.
Definition Staff.h:114
Encapsulates transposition options for a staff.
Definition Staff.h:141
std::shared_ptr< ChromaticTransposition > chromatic
Shared pointer to the chromatic transposition details, if any.
Definition Staff.h:152
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition Staff.h:157
std::shared_ptr< KeySigTransposition > keysig
Shared pointer to the key signature transposition details, if any.
Definition Staff.h:149
bool noSimplifyKey
Inverse of "Simplify Key" (xml node is <noKeyOpt>)
Definition Staff.h:146
static const xml::XmlElementArray< Transposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool isSame(const Transposition &other) const
Returns true if the input has the same contents as this.
Definition Staff.cpp:936
bool setToClef
If true, forces the clef in Staff::transposedClef.
Definition Staff.h:145
Represents the definition of a Finale staff.
Definition Staff.h:54
bool altHideOtherLyrics
Hide lyrics in other layers in alternate notation.
Definition Staff.h:217
static void calcAllRuntimeValues(const DocumentPtr &document)
Populate runtime values for all staves or staffstyles, such as percussion map Id if any.
Definition Staff.cpp:118
bool hideDots
Inverse of "Display Augmentation Dots".
Definition Staff.h:244
AutoNumberingStyle
Enum for auto-numbering style. Auto-numbering is based on instUuid.
Definition Staff.h:61
@ ArabicSuffix
Arabic numeral suffix (default). May not appear in xml.
@ ArabicPrefix
Arabic numeral prefix (with dot): 1. 2. 3. ...
@ OrdinalPrefix
Ordinal number prefix: 1st 2nd 3rd, ...
bool noteShapesFromStyle
True if noteShapesId is for a staff style. (Determines which note shapes class to retrieve....
Definition Staff.h:281
Evpu dwRestOffset
Offset for downstem rests.
Definition Staff.h:238
bool hideRepeats
Inverse of "Display Endings and Text Repeats".
Definition Staff.h:229
ClefIndex defaultClef
Index of default clef for the staff.
Definition Staff.h:186
AlternateNotation
Enum for alternate notation styles.
Definition Staff.h:97
@ BlankWithRests
Blank Notation with Rests.
@ SlashBeats
Slash Notation (on beats)
util::EnigmaParsingContext getAbbreviatedInstrumentNameCtx(Cmper forPartId, bool preferStaffName=false) const
Returns the parsing context for the abbreviated name.
Definition Staff.cpp:368
bool hideClefs
Inverse of "Display Clefs".
Definition Staff.h:234
Evpu calcTopLineEvpu() const
Calculates the Evpu position of the top staff line, relative to the reference line.
Definition Staff.h:487
MusxInstanceList< PartDefinition > getContainingParts(bool includeScore=true) const
Gets a list of all parts that contain this staff.
Definition Staff.cpp:830
bool altRhythmStemsUp
Show stems up in alternate Rhythmic Notation mode.
Definition Staff.h:212
Efix horzStemOffDown
Horizontal Stem Offsets: Down Stem.
Definition Staff.h:265
std::pair< std::string, bool > calcAutoNumberingAffix() const
Calculate the auto numbering prefix or suffix, if needed.
Definition Staff.cpp:246
std::vector< LyricsLineInfo > createLyricsLineInfo(SystemCmper systemId) const
Creates a vector of LyricsLineInfo for the current requested part.
Definition Staff.cpp:741
bool hideRepeatTopDot
Inverse of "Top Repeat Dot" in Staff Setup dialog.
Definition Staff.h:224
Evpu hRestOffset
Offset for half rests.
Definition Staff.h:240
std::optional< int > staffLines
Number of lines in the staff (if no custom staff)
Definition Staff.h:188
Efix vertStemStartOffUp
Vertical Stem Offsets For Notehead End: Up Stem.
Definition Staff.h:266
bool hideKeySigs
Inverse of "Display Key Signatures".
Definition Staff.h:232
Cmper multiStaffInstId
Definition Staff.h:290
NotationStyle
Enum for notation style.
Definition Staff.h:74
bool hideStaffLines
Inverse of "Display Staff Lines".
Definition Staff.h:235
bool hideTimeSigs
Inverse of "Display Time Signatures in Score".
Definition Staff.h:233
bool noOptimize
Inverse of "Allow Hiding When Empty".
Definition Staff.h:226
std::optional< std::vector< int > > customStaff
A list of stafflines from 0..26 where a standard 5-line staff is values 11, 12, 13,...
Definition Staff.h:189
Efix vertTabNumOff
Vertical offset for tab number. (Tablature Staff Attributes)
Definition Staff.h:250
bool iterateClefChangesAtMeasure(MeasCmper measureId, bool forWrittenPitch, std::function< bool(const ClefChange &)> iterator) const
Iterate clef changes in this staff at the given measure.
Definition Staff.cpp:523
int calcNumberOfStafflines() const
Calculates the number of staff lines on this staff.
Definition Staff.cpp:600
bool noKey
"Ignore Key Signatures"
Definition Staff.h:237
std::shared_ptr< FontInfo > noteFont
The custom font to use for noteheads. Guaranteed non-null by integrityCheck if useNoteFont is true.
Definition Staff.h:183
static void calcAllAutoNumberValues(const DocumentPtr &document)
Get the auto-numbering value for this staff, if applicable.
Definition Staff.cpp:37
std::pair< int, int > calcTranspositionInterval() const
Calculates the transposition interval for this staff or staff composite.
Definition Staff.cpp:817
bool hideRepeatBottomDot
Inverse of "Bottom Repeat Dot" in Staff Setup dialog.
Definition Staff.h:220
bool altSlashDots
Show dots on beat slashes in compound meter.
Definition Staff.h:213
int capoPos
"Capo Position" (Tablature Staff Attributes)
Definition Staff.h:192
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition Staff.h:534
bool fullNamePosFromStyle
Definition Staff.h:284
bool hasStyles
Indicates that this staff has staff style assignments.
Definition Staff.h:198
Cmper abrvNamePosId
Definition Staff.h:286
Evpu calcBaselinePosition(SystemCmper systemId, Cmper lyricNumber) const
Returns the baseline position for the staff at the given system. The staff should be the staff at the...
Definition Staff.h:473
Efix vertStemEndOffUp
Vertical Stem Offsets For Stem End: Up Stem.
Definition Staff.h:268
int calcTopLinePosition() const
Calculates the position of the top staff line, relative to the reference line.
Definition Staff.cpp:653
bool altHideArtics
Hide Articulations in alternate notation (in Apply-To Layer)
Definition Staff.h:209
MusxInstance< MultiStaffInstrumentGroup > getMultiStaffInstGroup() const
Returns the MultiStaffInstrumentGroup for this staff if it is part of one in the data....
Definition Staff.cpp:298
std::string addAutoNumbering(const std::string &plainName) const
Add auto numbering as a prefix or suffix, if needed.
Definition Staff.cpp:268
StemDirection stemDirection
stem direction for staff (xml node is <stemDir>)
Definition Staff.h:257
bool hideStems
Inverse of "Display Stems".
Definition Staff.h:256
Evpu otherRestOffset
Offset for other rests.
Definition Staff.h:241
std::string getFullInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName=false) const
Returns the full instrument name for this staff without Enigma tags and with autonumbering (if any)
Definition Staff.cpp:360
std::optional< int > autoNumberValue
Calculated autonumbering value. It is computed by calcAllAutoNumberValues.
Definition Staff.h:292
Efix horzStemOffUp
Horizontal Stem Offsets: Up Stem.
Definition Staff.h:264
bool abrvNamePosFromStyle
Definition Staff.h:288
bool iterateEntries(std::function< bool(const EntryInfoPtr &)> iterator) const
Iterate all entries in the document by staff and then measure. This function wraps MusxInstanceList<S...
Definition Staff.cpp:886
Efix vertStemStartOffDown
Vertical Stem Offsets For Notehead End: Down Stem.
Definition Staff.h:267
Evpu lineSpace
Distance between staff lines.
Definition Staff.h:190
Evpu wRestOffset
Offset for whole rests.
Definition Staff.h:239
bool stemStartFromStaff
Definition Staff.h:259
bool calcShowInstrumentName() const
Returns true if the staff shows its full or abbreviated instrument name for the current requested par...
Definition Staff.cpp:424
bool altHideSmartShapes
Hide Smart Shapes (in Apply-To layer: probably only affects entry-attached shapes)
Definition Staff.h:211
AlternateNotation altNotation
Alternate notation on the staff.
Definition Staff.h:207
bool stemsFixedEnd
"Use Vertical Offset For Beam End Of Stems (Offset From Staff)"
Definition Staff.h:262
MusxInstance< details::ShapeNoteBase > getNoteShapes() const
Returns the note shape record in effect for this staff instance.
Definition Staff.cpp:432
HideMode hideMode
"Force Hide Staff" option
Definition Staff.h:270
bool hideTuplets
Inverse of "Show Tuplets" (Tablature Staff Attributes)
Definition Staff.h:254
Staff(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:175
bool hideBarlines
Inverse of "Display Barlines".
Definition Staff.h:230
int lowestFret
"Default Lowest Fret" (Tablature Staff Attributes)
Definition Staff.h:193
bool useNoteShapes
Indicates that note shapes should be used. It is ignored is no staff- or staffstyle-specific note sha...
Definition Staff.h:184
Evpu calcRestOffset(Edu edu) const
Returns the configured rest staff-step offset for an Edu value.
Definition Staff.cpp:625
bool hasInstrumentAssigned() const
Return true if this staff has an instrument assigned.
Definition Staff.cpp:809
LayerIndex altLayer
Alternate notation Apply To Layer index (0..3)
Definition Staff.h:208
bool floatKeys
"Independent Key Signature"
Definition Staff.h:194
Cmper fullNameTextId
Full name TextBlock ID. (xml node is <fullName>)
Definition Staff.h:246
NotationStyle notationStyle
Standard, percussion, or tablature.
Definition Staff.h:182
bool useAutoNumbering
Whether names should be auto-numbered. (xml node is <useAutoNum>)
Definition Staff.h:274
bool hideTies
Inverse of "Display Ties".
Definition Staff.h:243
util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName=false) const
Returns the parsing context for the full name.
Definition Staff.cpp:341
bool showNameInParts
"Display Staff Name in Parts" (xml node is <showNameParts>)
Definition Staff.h:199
ClefIndex transposedClef
Index of transposed clef for the staff. Only used if Transposition::setToClef is true.
Definition Staff.h:187
bool floatTime
"Independent Time Signature"
Definition Staff.h:195
bool altHideOtherSmartShapes
Hide Smart Shapes in other layers in alternate notation.
Definition Staff.h:218
std::optional< Cmper > percussionMapId
Calculated percussion map Id for a percussion staff. (Populated by in calcAllRuntimeValues....
Definition Staff.h:293
int calcMiddleStaffPosition() const
Calculates the middle staff position. For staves with even numbers of lines, it is the middle space.
Definition Staff.cpp:610
Evpu botBarlineOffset
Offset for the bottom barline.
Definition Staff.h:206
std::string getPlaybackRouteName() const
Returns the first nonempty playback route name assigned to this staff.
Definition Staff.cpp:395
Evpu calcBaselinePosition(SystemCmper systemId) const
Returns the baseline position for the staff at the given system. The staff should be the staff at the...
Definition Staff.h:460
bool calcAlternateNotationHidesEntries(LayerIndex forLayerIndex) const
Returns true if the given layer is hidden by alternate notation.
Definition Staff.cpp:865
bool hideLyrics
Inverse of "Display Lyrics".
Definition Staff.h:225
Efix vertStemEndOffDown
Vertical Stem Offsets For Stem End: Down Stem.
Definition Staff.h:269
std::string getFullName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
Returns the full staff name without Enigma tags. If the full name contains part-specific tags (rare),...
Definition Staff.cpp:280
Cmper abbrvNameTextId
Abbreviated name TextBlock ID. (xml node is <abbrvName>)
Definition Staff.h:247
std::string getAbbreviatedName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
Returns the abbreviated staff name without Enigma tags. If the abbreviated name contains part-specifi...
Definition Staff.cpp:285
bool hideFretboards
Inverse of "Display Fretboards".
Definition Staff.h:222
bool calcIsSameNotationStyle(const Staff &other) const
Returns true if both instances have the same notation style settings. This is helpful for determining...
Definition Staff.cpp:897
bool rbarBreak
"Break Repeat Barlines Between Staves"
Definition Staff.h:197
bool calcShowName() const
Returns true if the staff shows its full or abbreviated name for the current requested partId.
Definition Staff.cpp:290
Evpu topRepeatDotOff
Offset for top repeat dots.
Definition Staff.h:249
HideMode
Enum for hide mode.
Definition Staff.h:85
@ Score
Collapse in score only.
@ ScoreParts
Collapse in score and parts.
bool showNoteColors
"Color Noteheads" (Score Manager)
Definition Staff.h:200
bool redisplayLayerAccis
"Redisplay Accidentals in Other Layers Within Measures"
Definition Staff.h:271
bool altHideExpressions
Hide Expressions in alternate notation (in Apply-To Layer)
Definition Staff.h:216
bool useNoteFont
Indicates if noteFont should be used.
Definition Staff.h:185
Evpu topBarlineOffset
Offset for the top barline.
Definition Staff.h:227
Cmper fretInstId
Cmper of FretInstrument for TAB strings. (Tablature Staff Attributes)
Definition Staff.h:255
bool hideBeams
Inverse of "Show Beams".
Definition Staff.h:258
bool hideTimeSigsInParts
Inverse of "Display Time Signatures in Parts".
Definition Staff.h:272
MusxInstance< NamePositioning > getFullNamePosition() const
Returns the full name positioning in effect for this staff instance.
Definition Staff.cpp:483
bool hideChords
Inverse of "Display Chords".
Definition Staff.h:236
int calcBottomLinePosition() const
Calculates the position of the top staff line, relative to the reference line.
Definition Staff.cpp:667
Cmper fullNamePosId
Definition Staff.h:282
bool showNamesForPart(Cmper partId) const
Returns if names should be shown for the specified part.
Definition Staff.h:355
bool hideRests
Inverse of "Display Rests".
Definition Staff.h:242
bool breakTabLinesAtNotes
"Break Tablature Lines At Numbers" (Tablature Staff Attributes)
Definition Staff.h:253
int stemReversal
Stem reversal value.
Definition Staff.h:245
bool blankMeasure
Inverse of "Display Rests in Empty Measures".
Definition Staff.h:223
Evpu botRepeatDotOff
Offset for bottom repeat dots.
Definition Staff.h:248
bool altHideOtherArtics
Hide articulations in other layers in alternate notation.
Definition Staff.h:215
bool altHideOtherNotes
Hide notes in other layers in alternate notation.
Definition Staff.h:214
bool blineBreak
"Break Barlines Between Staves"
Definition Staff.h:196
MusxInstance< NamePositioning > getAbbreviatedNamePosition() const
Returns the abbreviated name positioning in effect for this staff instance.
Definition Staff.cpp:491
static const xml::XmlElementArray< Staff > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
MusxInstance< PartDefinition > firstContainingPart() const
Finds the first part that contains this staff, not including the score.
Definition Staff.cpp:849
ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch=false) const
Returns the clef in this staff at the specified location.
Definition Staff.cpp:499
MusxInstance< details::StaffGroup > getMultiStaffInstVisualGroup(Cmper forPartId) const
Returns the details::StaffGroup for this staff if it is part of a multistaff instrument (as defined i...
Definition Staff.cpp:309
ClefIndex calcFirstClefIndex(bool forWrittenPitch=false) const
Returns the first clef in this staff.
Definition Staff.h:395
bool useTabLetters
"Use Letters" (Tablature Staff Attributes)
Definition Staff.h:252
bool hideRptBars
Inverse of "Display Repeat Bars".
Definition Staff.h:231
std::shared_ptr< Transposition > transposition
Transposition details, if non-null.
Definition Staff.h:204
Evpu calcBottomLineEvpu() const
Calculates the Evpu position of the bottom staff line, relative to the reference line.
Definition Staff.h:494
bool hideKeySigsShowAccis
"Hide Key Signature and Show Accidentals" transposition option.
Definition Staff.h:275
std::pair< Evpu, Evpu > calcBarlineOffsetsFromCenter() const
Calculates barline endpoint offsets relative to the staff center.
Definition Staff.cpp:642
AutoNumberingStyle autoNumbering
Autonumbering style if useAutoNumbering is true. (xml node is <autoNum>)
Definition Staff.h:273
Cmper noteShapesId
Definition Staff.h:279
bool hideNameInScore
Inverse of "Display Staff Name in Score" (xml node is <hideStfNameInScore>)
Definition Staff.h:205
std::string instUuid
Unique identifier for the type of instrument.
Definition Staff.h:191
bool altHideOtherExpressions
Hide Expressions in other layers in alternate notation.
Definition Staff.h:219
bool stemsFixedStart
"Use Vertical Offset For Notehead End Of Stems"
Definition Staff.h:263
bool hideMeasNums
Inverse of "Display Measure Numbers".
Definition Staff.h:228
std::string getAbbreviatedInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName=false) const
Returns the abbreviated instrument name for this staff without Enigma tags and with autonumbering (if...
Definition Staff.cpp:387
bool flatBeams
"Flat Beams"
Definition Staff.h:221
bool altHideLyrics
Hide Lyrics in alternate notation (in Apply-To Layer)
Definition Staff.h:210
bool showTabClefAllSys
Inverse of "Show Clef Only On First Measure" (Tablature Staff Attributes)
Definition Staff.h:251
Evpu calcBaselineZeroPosition() const
Calculates the baseline zero position for this staff, relative to the reference line,...
Definition Staff.cpp:681
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:559
Wrapper class for interpreting and rendering Enigma-style strings with insert handling.
Definition EnigmaString.h:435
AccidentalStyle
Enumeration to specify the type of accidental substitution representation.
Definition EnigmaString.h:208
@ Ascii
Use ASCII substitutions for accidentals.
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
@ Verbose
Informational messages that should only displayed when verbose logging is requested.
static void log(LogLevel level, const std::string &message)
Logs a message with a specific severity level.
Definition Logger.h:87
ShowClefMode
Enum representing the clef display mode for a frame.
Definition EnumClasses.h:182
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:66
int32_t Efix
EFIX value (64 per EVPU, 64*288=18432 per inch)
Definition Fundamentals.h:62
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:40
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:73
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:81
int16_t Inci
Enigma "incident" key type.
Definition Fundamentals.h:58
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:59
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:57
StemDirection
Three-state stem direction setting or override.
Definition EnumClasses.h:191
@ Percussion
Percussion clef, open rectangle (no pitch).
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:70
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:63
constexpr double EVPU_PER_STAFF_POSITION
Number of Evpu units per half space.
Definition Fundamentals.h:91
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition DocumentElement.h:37
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition DocumentElement.h:35
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:67
int16_t SystemCmper
Enigma systems Cmper (may be negative when not applicable)
Definition Fundamentals.h:68
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:133
object model for musx file (enigmaxml)
Definition BaseClasses.h:38
A clef change attached to a staff at a measure location.
Definition Staff.h:411
util::Fraction position
The staff-level position in the measure.
Definition Staff.h:413
Evpu yEvpuPos
Vertical EVPU adjustment for mid-measure clefs.
Definition Staff.h:416
ClefIndex clefIndex
The Finale clef index.
Definition Staff.h:412
bool afterBarline
True if a measure-start clef is placed after the barline.
Definition Staff.h:415
int percent
Clef scaling percent, where 100 is unscaled.
Definition Staff.h:417
ShowClefMode showClefMode
The Finale clef display mode.
Definition Staff.h:414
int xEvpuOffset
Horizontal EVPU adjustment for mid-measure clefs.
Definition Staff.h:418