MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::others::Staff Class Reference

Represents the definition of a Finale staff. More...

#include <Others.h>

+ Inheritance diagram for musx::dom::others::Staff:

Classes

class  ChromaticTransposition
 Represents chromatic transposition details. More...
 
class  KeySigTransposition
 Represents key signature transposition details. More...
 
class  Transposition
 Encapsulates transposition options for a staff. More...
 

Public Types

enum class  AutoNumberingStyle {
  ArabicSuffix , RomanSuffix , OrdinalPrefix , AlphaSuffix ,
  ArabicPrefix
}
 Enum for auto-numbering style. Auto-numbering is based on instUuid. More...
 
enum class  StemDirection { Default , AlwaysUp , AlwaysDown }
 Enum for staff-level stem direction override. More...
 
enum class  NotationStyle { Standard , Percussion , Tablature }
 Enum for notation style.
 
enum class  HideMode { None , Cutaway , ScoreParts , Score }
 Enum for hide mode. More...
 
- Public Types inherited from musx::dom::Base
enum class  ShareMode { All , Partial , None }
 Describes how this instance is shared between part and score. More...
 
using SharedNodes = std::set< std::string >
 The container type for shared nodes.
 

Public Member Functions

 Staff (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
 Constructor function.
 
std::string getFullName (util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
 Returns the full staff name without Enigma tags.
 
std::string getAbbreviatedName (util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
 Returns the abbreviated staff name without Enigma tags.
 
std::shared_ptr< MultiStaffInstrumentGroupgetMultiStaffInstGroup () const
 Returns the MultiStaffInstrumentGroup for this staff if it is part of one. Otherwise nullptr.
 
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)
 
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 any)
 
std::shared_ptr< const NamePositioninggetFullNamePosition () const
 Returns the full name positioning in effect for this staff instance.
 
std::shared_ptr< const NamePositioninggetAbbreviatedNamePosition () const
 Returns the abbreviated name positioning in effect for this staff instance.
 
bool showNamesForPart (Cmper partId) const
 Returns if names should be shown for the specified part.
 
std::string addAutoNumbering (const std::string &plainName) const
 Add auto numbering as a prefix or suffix, if needed.
 
ClefIndex calcClefIndexAt (MeasCmper measureId, Edu position, bool forWrittenPitch=false) const
 Returns the clef in this staff at the specified location.
 
ClefIndex calcFirstClefIndex (bool forWrittenPitch=false) const
 Returns the first clef in this staff.
 
int calcMiddleStaffPosition () const
 Returns the middle staff position. For staves with even numbers of lines, it is the middle space.
 
int calcToplinePosition () const
 Returns the position of the top staff line, relative to the reference line.
 
bool hasInstrumentAssigned () const
 Return true if this staff has an instrument assigned.
 
std::vector< std::shared_ptr< PartDefinition > > getContainingParts () const
 Gets a list of all parts that contain this staff, including the score.
 
std::shared_ptr< PartDefinitionfirstFirstContainingPart () const
 Finds the first part that contains this staff, not including the score.
 
void integrityCheck () override
 Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.
 
bool requireAllFields () const override
 Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class.
 
- Public Member Functions inherited from musx::dom::OthersBase
Cmper getCmper () const
 Gets the cmper key value.
 
std::optional< IncigetInci () const
 Gets the optional array index (inci).
 
- Public Member Functions inherited from musx::dom::Base
virtual ~Base () noexcept(false)=default
 Virtual destructor for polymorphic behavior.
 
DocumentPtr getDocument () const
 Gets a reference to the Document.
 
virtual Cmper getPartId () const
 Gets the partId for this instance (or SCORE_PARTID for score)
 
ShareMode getShareMode () const
 Gets the sharing mode for this instance.
 
const SharedNodesgetUnlinkedNodes () const
 Gets the unlinked nodes for this instance. (Only populated for ShareMode::Partial)
 
void addUnlinkedNode (const std::string &nodeName)
 Adds a shared node for this instance.
 

Static Public Member Functions

static void calcAllAutoNumberValues (const DocumentPtr &document)
 Get the auto-numbering value for this staff, if applicable.
 
template<typename SubType >
static void calcAllRuntimeValues (const DocumentPtr &document)
 Populate runtime values for all staves or staffstyles, such as percussion map Id if any.
 
static ClefIndex calcFirstClefIndex (const DocumentPtr &document, Cmper partId, InstCmper staffCmper)
 Returns the first clef in the specified staff in the document.
 
static const xml::XmlElementArray< Staff > & xmlMappingArray ()
 Required for musx::factory::FieldPopulator.
 

Public Attributes

NotationStyle notationStyle {}
 Standard, percussion, or tablature.
 
std::shared_ptr< FontInfonoteFont
 The custom font to use for noteheads. Guaranteed non-null by integrityCheck if useNoteFont is true.
 
bool useNoteFont {}
 Indicates if noteFont should be used.
 
ClefIndex defaultClef {}
 Index of default clef for the staff.
 
ClefIndex transposedClef {}
 Index of transposed clef for the staff. Only used if Transposition::setToClef is true.
 
std::optional< int > staffLines {}
 Number of lines in the staff (if no custom staff)
 
std::optional< std::vector< int > > customStaff
 A list of stafflines from 0..26 where a standard 5-line staff is values 11, 12, 13, 14, 15.
 
Evpu lineSpace {}
 Distance between staff lines.
 
std::string instUuid
 Unique identifier for the type of instrument.
 
bool floatKeys {}
 "Independent Key Signature"
 
bool floatTime {}
 "Independent Time Signature"
 
bool blineBreak {}
 "Break Barlines Between Staves"
 
bool rbarBreak {}
 "Break Repeat Barlines Between Staves"
 
bool hasStyles {}
 Indicates that this staff has staff style assignments.
 
bool showNameInParts {}
 "Display Staff Name in Parts" (xml node is <showNameParts>)
 
std::shared_ptr< Transpositiontransposition
 Transposition details, if non-null.
 
bool hideNameInScore {}
 Inverse of "Display Staff Name in Score" (xml node is <hideStfNameInScore>)
 
Evpu botBarlineOffset {}
 Offset for the bottom barline.
 
bool hideRepeatBottomDot {}
 Inverse of "Bottom Repeat Dot" in Staff Setup dialog.
 
bool flatBeams {}
 "Flat Beams"
 
bool hideFretboards {}
 Inverse of "Display Fretboards".
 
bool blankMeasure {}
 Inverse of "Display Rests in Empty Measures".
 
bool hideRepeatTopDot {}
 Inverse of "Top Repeat Dot" in Staff Setup dialog.
 
bool hideLyrics {}
 Inverse of "Display Lyrics".
 
bool noOptimize {}
 Inverse of "Allow Hiding When Empty".
 
Evpu topBarlineOffset {}
 Offset for the top barline.
 
bool hideMeasNums {}
 Inverse of "Display Measure Numbers".
 
bool hideRepeats {}
 Inverse of "Display Endings and Text Repeats".
 
bool hideBarlines {}
 Inverse of "Display Barlines".
 
bool hideRptBars {}
 Inverse of "Display Repeat Bars".
 
bool hideKeySigs {}
 Inverse of "Display Key Signatures".
 
bool hideTimeSigs {}
 Inverse of "Display Time Signatures in Score".
 
bool hideClefs {}
 Inverse of "Display Clefs".
 
bool hideStaffLines {}
 Inverse of "Display Staff Lines".
 
bool hideChords {}
 Inverse of "Display Chords".
 
bool noKey {}
 "Ignore Key Signatures"
 
Evpu dwRestOffset {}
 Offset for downstem rests.
 
Evpu wRestOffset {}
 Offset for whole rests.
 
Evpu hRestOffset {}
 Offset for half rests.
 
Evpu otherRestOffset {}
 Offset for other rests.
 
bool hideRests {}
 Inverse of "Display Rests".
 
bool hideTies {}
 Inverse of "Display Ties".
 
bool hideDots {}
 Inverse of "Display Augmentation Dots".
 
int stemReversal {}
 Stem reversal value.
 
Cmper fullNameTextId {}
 Full name TextBlock ID. (xml node is <fullName>)
 
Cmper abbrvNameTextId {}
 Abbreviated name TextBlock ID. (xml node is <abbrvName>)
 
Evpu botRepeatDotOff {}
 Offset for bottom repeat dots.
 
Evpu topRepeatDotOff {}
 Offset for top repeat dots.
 
Evpu vertTabNumOff {}
 Vertical offset for tab number.
 
bool hideStems {}
 Inverse of "Display Stems".
 
StemDirection stemDirection {}
 stem direction for staff (xml node is <stemDir>)
 
bool hideBeams {}
 Inverse of "Show Beams".
 
HideMode hideMode {}
 "Force Hide Staff" option
 
bool redisplayLayerAccis {}
 "Redisplay Accidentals in Other Layers Within Measures"
 
bool hideTimeSigsInParts {}
 Inverse of "Display Time Signatures in Parts".
 
AutoNumberingStyle autoNumbering {}
 Autonumbering style if useAutoNumbering is true. (xml node is <autoNum>)
 
bool useAutoNumbering {}
 Whether names should be auto-numbered. (xml node is <useAutoNum>)
 
bool hideKeySigsShowAccis {}
 "Hide Key Signature and Show Accidentals" transposition option.
 
Cmper fullNamePosId {}
 
bool fullNamePosFromStyle {}
 
Cmper abrvNamePosId {}
 
bool abrvNamePosFromStyle {}
 
Cmper multiStaffInstId {}
 It is set by the factory with the Resolver function for MultiStaffInstrumentGroup.
 
std::optional< int > autoNumberValue
 Calculated autonumbering value. It is computed by calcAllAutoNumberValues.
 
std::optional< CmperpercussionMapId
 Calculated percussion map Id for a percussion staff. (Populated by in calcAllRuntimeValues.)
 

Static Public Attributes

static constexpr std::string_view XmlNodeName = "staffSpec"
 The XML node name for this type.
 

Additional Inherited Members

- Protected Member Functions inherited from musx::dom::OthersBase
 OthersBase (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, std::optional< Inci > inci=std::nullopt)
 Constructs an OthersBase object.
 
- Protected Member Functions inherited from musx::dom::Base
 Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode)
 Constructs the base class.
 
 Base (const Base &)=default
 explicit default copy constructor
 
 Base (Base &&) noexcept=default
 explicit default move constructor
 
Baseoperator= (const Base &)
 no-op copy assignment operator allows subclasses to copy their values.
 
Baseoperator= (Base &&) noexcept
 no-op move assignment operator allows subclasses to move their values.
 

Detailed Description

Represents the definition of a Finale staff.

The cmper is the staff ID. This class is identified by the XML node name "staffSpec".

Member Enumeration Documentation

◆ AutoNumberingStyle

Enum for auto-numbering style. Auto-numbering is based on instUuid.

Enumerator
ArabicSuffix 

Arabic numeral suffix (default). May not appear in xml.

RomanSuffix 

Roman numeral suffix.

OrdinalPrefix 

Ordinal number prefix: 1st 2nd 3rd, ...

AlphaSuffix 

Alphabetic suffix.

ArabicPrefix 

Arabic numeral prefix (with dot): 1. 2. 3. ...

◆ HideMode

Enum for hide mode.

Enumerator
None 

Do not hide.

Cutaway 

Cutaway score.

ScoreParts 

Collapse in score and parts.

Score 

Collapse in score only.

◆ StemDirection

Enum for staff-level stem direction override.

Enumerator
Default 

the default (may not occur in xml)

AlwaysUp 

stems are always up on this staff

AlwaysDown 

stems are always down on this staff

Member Function Documentation

◆ addAutoNumbering()

std::string musx::dom::others::Staff::addAutoNumbering ( const std::string &  plainName) const

Add auto numbering as a prefix or suffix, if needed.

Parameters
plainNameThe name (full or abbreviated) to which to add the auto numbering
Returns
Auto numbered name.

◆ calcAllAutoNumberValues()

void musx::dom::others::Staff::calcAllAutoNumberValues ( const DocumentPtr document)
static

Get the auto-numbering value for this staff, if applicable.

Calculates autoNumberValue for every staff based on the occurrences of the instrument UUID and in each staff instance. If numbering is not applicable (e.g., auto numbering is disabled, the UUID is empty, or there is only one instance), autoNumberValue has no value.

This function is called by the DocumentFactory when the document is created.

◆ calcAllRuntimeValues()

template<typename SubType >
void musx::dom::others::Staff::calcAllRuntimeValues ( const DocumentPtr document)
static

Populate runtime values for all staves or staffstyles, such as percussion map Id if any.

This function is called by the DocumentFactory when the document is created.

◆ calcClefIndexAt()

ClefIndex musx::dom::others::Staff::calcClefIndexAt ( MeasCmper  measureId,
Edu  position,
bool  forWrittenPitch = false 
) const

Returns the clef in this staff at the specified location.

Parameters
measureIdThe measure of the location
positionThe Edu elapsed time with the measure
forWrittenPitchIf true, return the transposing clef if there is one

◆ calcFirstClefIndex()

ClefIndex musx::dom::others::Staff::calcFirstClefIndex ( const DocumentPtr document,
Cmper  partId,
InstCmper  staffCmper 
)
static

Returns the first clef in the specified staff in the document.

Parameters
documentthe document to search
partIdthe linked part to search
staffCmperthe staff cmper to search

◆ firstFirstContainingPart()

std::shared_ptr< others::PartDefinition > musx::dom::others::Staff::firstFirstContainingPart ( ) const

Finds the first part that contains this staff, not including the score.

Returns
The first part that contains this staff or nullptr if none.

◆ getAbbreviatedInstrumentName()

std::string musx::dom::others::Staff::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 any)

Note
Ordinal prefix numbering is currently supported only for English.
Parameters
accidentalStyleThe style for accidental subsitution in names like "Clarinet in Bb".
preferStaffNameWhen true, use the staff name if there is one (rather than the multi-instrument group name)

◆ getAbbreviatedName()

std::string musx::dom::others::Staff::getAbbreviatedName ( util::EnigmaString::AccidentalStyle  accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii) const

Returns the abbreviated staff name without Enigma tags.

Parameters
accidentalStyleThe style for accidental subsitution in names like "Clarinet in Bb".

◆ getFullInstrumentName()

std::string musx::dom::others::Staff::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)

Note
Ordinal prefix numbering is currently supported only for English.
Parameters
accidentalStyleThe style for accidental subsitution in names like "Clarinet in Bb".
preferStaffNameWhen true, use the staff name if there is one (rather than the multi-instrument group name)

◆ getFullName()

std::string musx::dom::others::Staff::getFullName ( util::EnigmaString::AccidentalStyle  accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii) const

Returns the full staff name without Enigma tags.

Parameters
accidentalStyleThe style for accidental subsitution in names like "Clarinet in Bb".

◆ integrityCheck()

void musx::dom::others::Staff::integrityCheck ( )
inlineoverridevirtual

Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.

The default implementation should always be called inside an overridden implementation.

Exceptions
musx::dom::integrity_errorif there is a problem.

Reimplemented from musx::dom::Base.

Reimplemented in musx::dom::others::StaffStyle.

◆ requireAllFields()

bool musx::dom::others::Staff::requireAllFields ( ) const
inlineoverridevirtual

Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class.

Some classes make it difficult to discover all the possible xml tags that might be used for all its options. An example is others::TextBlock. By overriding this function, a class can allow its members to be discovered as needed without causing error messages or throwing exceptions.

Remarks
This value only escapes errors on fields. Enum values must still have all values provided to avoid error messages or exceptions.

Reimplemented from musx::dom::Base.

Reimplemented in musx::dom::others::StaffStyle.

Member Data Documentation

◆ abrvNamePosFromStyle

bool musx::dom::others::Staff::abrvNamePosFromStyle {}

True if abrvNamePosId is for a staff style. (Determines which abrv name pos class to retrieve.) Populated by in calcAllRuntimeValues.

◆ abrvNamePosId

Cmper musx::dom::others::Staff::abrvNamePosId {}

Calculated cmper for abbreviated name position id. If not overridden by a staff style, it is the same as the staff cmper or zero if default. (Populated by in calcAllRuntimeValues.)

◆ fullNamePosFromStyle

bool musx::dom::others::Staff::fullNamePosFromStyle {}

True if fullNamePosId is for a staff style. (Determines which full name pos class to retrieve.) Populated by in calcAllRuntimeValues.

◆ fullNamePosId

Cmper musx::dom::others::Staff::fullNamePosId {}

Calculated cmper for full name position id. If not overridden by a staff style, it is the same as the staff cmper or zero if default. (Populated by in calcAllRuntimeValues.)

◆ multiStaffInstId

Cmper musx::dom::others::Staff::multiStaffInstId {}

It is set by the factory with the Resolver function for MultiStaffInstrumentGroup.

Calculated cmper for MultiStaffInstrumentGroup, if any. This value is not in the xml.