MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::EntryFrame::TupletInfo Struct Reference

class to track tuplets in the frame More...

#include <Entries.h>

Public Member Functions

 TupletInfo (const std::weak_ptr< const EntryFrame > &parent, const MusxInstance< details::TupletDef > &tup, size_t index, util::Fraction start, bool forVoice2)
 Constructor.
 
size_t numEntries () const
 Return the number of entries in the tuplet.
 
bool includesEntry (const EntryInfoPtr &entryInfo) const
 Return true if the entry is part of this tuplet.
 
bool calcIsTremolo () const
 Calculates if this tuplet represents a tremolo based on the following criteria.
 
bool calcCreatesSingletonBeamRight () const
 Calculates if this tuplet is being used to create a singleton beam to the right.
 
bool calcCreatesSingletonBeamLeft () const
 Calculates if this tuplet is being used to create a singleton beam to the left.
 
bool calcCreatesTimeStretch () const
 Detects tuplets being used to create time stretch in an independent time signature.
 

Public Attributes

MusxInstance< details::TupletDeftuplet
 the tuplet
 
size_t startIndex
 the index of the first entry in the tuplet
 
size_t endIndex
 the index of the last entry in the tuplet
 
util::Fraction startDura
 the actual duration where the tuplet starts
 
util::Fraction endDura
 the actual duration where the tuplet ends
 
bool voice2
 whether this tuplet is for voice2
 

Detailed Description

class to track tuplets in the frame

Member Function Documentation

◆ calcCreatesSingletonBeamLeft()

bool musx::dom::EntryFrame::TupletInfo::calcCreatesSingletonBeamLeft ( ) const
inline

Calculates if this tuplet is being used to create a singleton beam to the left.

See comments at calcCreatesSingletonBeamRight.

Returns
True if this tuplet creates a singleton beam to the left. You may handle this as follows.
  • Skip the entry and its tuplet.
  • You can mark the next entry in the same voice as having a singleton beam left, if your application allows it.
  • The current entry with the 0-length tuplet is either hidden (leger lines suppressed, non-visible notehead(s) and stem) or a duplicate of the next entry drawn on top of it. Its hidden flag is false either way.

◆ calcCreatesSingletonBeamRight()

bool musx::dom::EntryFrame::TupletInfo::calcCreatesSingletonBeamRight ( ) const
inline

Calculates if this tuplet is being used to create a singleton beam to the right.

Finale has no built-in support for beams on singleton notes. As a workaround, users and (especially) plugins such as Beam Over Barlines create singleton beams using a 0-length tuplet on one of two beamed entries. The extra entry is either hidden (ledger lines suppressed, hidden stem, hidden noteheads, offset out of the way) or, as the plugin does it, an exact duplicate of its neighbor at the same position with a beam extension reaching the barline. Which entry is the extra one depends on whether the beam goes to the left or the right. You should never encounter a 0-length tuplet encompassing more than one entry, but these functions guarantee this if they return true.

Returns
True if this tuplet creates a singleton beam to the right. You may handle this as follows.
  • The entry with the tuplet is the visible entry to use. You can mark this entry as having a singleton beam right, if your application allows it.
  • Ignore the tuplet on the visible entry. If you need the entry's actual duration in context, its next neighbor in the same voice has the correct value.
  • Ignore the entry's next neighbor in the same voice. It is either hidden (leger lines suppressed, non-visible notehead(s) and stem) or a duplicate of this entry drawn on top of it. Its hidden flag is false either way.

◆ calcCreatesTimeStretch()

bool musx::dom::EntryFrame::TupletInfo::calcCreatesTimeStretch ( ) const

Detects tuplets being used to create time stretch in an independent time signature.

Because the Finale UI is so buggy with smart shapes and clefs when there is an Independent Time Signature, a common workaround is to set the Independent Time Signature to the same as the global time signature but display a different time signature. Invisible tuplets then create the appearance of time stretch.

Returns
This function returns true if
  • the tuplet's total reference duration matches the length of the measure exactly
  • the tuplet is invisible
  • the staff has an independent time signature

◆ calcIsTremolo()

bool musx::dom::EntryFrame::TupletInfo::calcIsTremolo ( ) const

Calculates if this tuplet represents a tremolo based on the following criteria.

  • the tuplet ratio is a positive integral power of 2.
  • the tuplet contains exactly 2 entries of equal duration and actual duration.
  • the tuplet is invisible.
Note
The TGTools Tremolo plugin always creates beam extensions for both upstem and downstem cases. To detect the type of stem connections for the tremolo, it is recommended to look for either an upstem or a downstem extension. This covers the TGTools plugin as well as any that might have been created by hand. See details::BeamExtension.
Returns
true if the tuplet is a tremolo. If so, use EntryInfoPtr::calcNumberOfBeams on either entry to determine the number of beams. Use details::TupletDef::calcReferenceDuration to get the total length of the tremolo.

◆ includesEntry()

bool musx::dom::EntryFrame::TupletInfo::includesEntry ( const EntryInfoPtr entryInfo) const
inline

Return true if the entry is part of this tuplet.

Parameters
entryInfoThe entry to check.