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

Derived description of a logical instrument in a document. More...

#include <Instrument.h>

+ Inheritance diagram for musx::dom::InstrumentInfo:

Classes

struct  InstrumentChange
 Effective instrument state beginning at a musical location. More...
 
struct  InstrumentIdentity
 Stable identity for a distinct instrument used by this logical instrument. More...
 

Public Types

using InstrumentChangeEvents = std::map< MusicPoint, InstrumentChange >
 Effective top-staff states keyed by the musical location where each state begins.
 

Public Member Functions

 InstrumentInfo (const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID)
 Constructs an empty instrument info for a score or linked part.
 
std::vector< StaffCmpergetSequentialStaves () const
 Returns the staffIds in sequence as they appear in Scroll View in the score.
 
InstrumentChangeEvents getChanges () const
 Returns effective instrument states for this logical instrument.
 
std::vector< InstrumentIdentitygetInstrumentIdentities () const
 Returns the unique instrument identities in order of first appearance.
 
InstrumentIdentity getInstrumentIdentityAt (MusicPoint point) const
 Returns the instrument identity in effect at the specified music point.
 
- Public Member Functions inherited from musx::dom::DocumentElement
virtual ~DocumentElement () noexcept(false)=default
 Virtual destructor for polymorphic behavior.
 
DocumentPtr getDocument () const
 Gets a reference to the Document.
 
Cmper getPartId () const
 Gets the part id associated with this instance.
 

Public Attributes

std::unordered_map< StaffCmper, size_t > staves
 List of each staffId with its sequence index from top to bottom.
 
Cmper staffGroupId {}
 The details::StaffGroup that visually represents the instrument. (May be zero.)
 
Cmper multistaffGroupId {}
 The others::MultiStaffInstrumentGroup that defines the instrument. (May be zero.)
 

Additional Inherited Members

- Protected Member Functions inherited from musx::dom::DocumentElement
 DocumentElement (const DocumentWeakPtr &document, Cmper partId)
 Constructs the document element.
 
 DocumentElement (const DocumentElement &)=default
 explicit default copy constructor
 
 DocumentElement (DocumentElement &&) noexcept=default
 explicit default move constructor
 
DocumentElementoperator= (const DocumentElement &)
 no-op copy assignment operator allows subclasses to copy their values.
 
DocumentElementoperator= (DocumentElement &&) noexcept
 no-op move assignment operator allows subclasses to move their values.
 

Detailed Description

Derived description of a logical instrument in a document.

This is not a Finale data class and is not populated directly from EnigmaXML. It is a normalized, interchange-oriented view calculated from Finale staves, staff groups, and multistaff instrument groups.

Constructor & Destructor Documentation

◆ InstrumentInfo()

musx::dom::InstrumentInfo::InstrumentInfo ( const DocumentWeakPtr document,
Cmper  partId = SCORE_PARTID 
)
inlineexplicit

Constructs an empty instrument info for a score or linked part.

Parameters
documentThe document this instrument belongs to.
partIdThe score or linked part ID represented by this instrument.

Member Function Documentation

◆ getChanges()

InstrumentInfo::InstrumentChangeEvents musx::dom::InstrumentInfo::getChanges ( ) const

Returns effective instrument states for this logical instrument.

Instrument changes are recognized only when every staff in the logical instrument has an aligned others::StaffStyleAssign whose others::StaffStyle::containsInstrumentChange returns true. Reversion to the base staff instrument is represented by an additional change at the first location after the staff style assignment. If no changes are found, the result contains one change at the start of the document.

◆ getInstrumentIdentityAt()

InstrumentInfo::InstrumentIdentity musx::dom::InstrumentInfo::getInstrumentIdentityAt ( MusicPoint  point) const

Returns the instrument identity in effect at the specified music point.

Exceptions
std::logic_errorif no identity is in effect at point.