MUSX Document Model
Loading...
Searching...
No Matches
CommonClasses.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 <numeric>
25#include <filesystem>
26#include <array>
27
28#include "musx/util/Fraction.h"
29#include "BaseClasses.h"
30
31namespace music_theory {
32class Transposer;
33enum class DiatonicMode : int;
34} // namespace music_theory
35
36namespace musx {
37namespace dom {
38
39class EntryInfoPtr;
40
41namespace details { // forward declarations
43class LyricAssign;
44} // namespace details
45
46namespace others { // forward declarations
47class Measure;
48class OssiaHeader;
49class Staff;
50} // namespace others
51
52// This file contains common classes that are shared among Options, Others, and Details.
53
60enum class NoteType : Edu
61{
62 Maxima = 0x8000,
63 Longa = 0x4000,
64 Breve = 0x2000,
65 Whole = EDU_PER_WHOLE_NOTE,
66 Half = 0x0800,
67 Quarter = 0x0400,
68 Eighth = 0x0200,
69 Note16th = 0x0100,
70 Note32nd = 0x0080,
71 Note64th = 0x0040,
72 Note128th = 0x0020,
73 Note256th = 0x0010,
74 Note512th = 0x0008,
75 Note1024th = 0x0004,
76 Note2048th = 0x0002,
77 Note4096th = 0x0001
78};
79
86{
87 Treble = 0,
88 Alto = 1,
89 Tenor = 2,
90 Bass = 3,
91 Percussion = 4,
92 Treble8vb = 5,
93 Bass8vb = 6,
94 Baritone = 7,
95 FrenchViolin = 8,
96 BaritoneC = 9,
97 MezzoSoprano = 10,
98 Soprano = 11,
99 AltPercussion = 12,
100 Treble8va = 13,
101 Bass8va = 14,
102 Blank = 15,
103 Tab1 = 16,
104 Tab2 = 17
105};
106
111enum class ShowClefMode
112{
113 WhenNeeded,
114 Never,
115 Always
116};
117
126{
127public:
133 FontInfo(const DocumentWeakPtr& document, bool sizeIsPercent = false)
134 : CommonClassBase(document), m_sizeIsPercent(sizeIsPercent)
135 {
136 }
137
139 int fontSize{};
140 bool bold{};
141 bool italic{};
142 bool underline{};
143 bool strikeout{};
144 bool absolute{};
145 bool hidden{};
146
148 bool getSizeIsPercent() const { return m_sizeIsPercent; }
149
153 inline static constexpr uint16_t EnigmaStyleBold = 0x01;
154 inline static constexpr uint16_t EnigmaStyleItalic = 0x02;
155 inline static constexpr uint16_t EnigmaStyleUnderline = 0x04;
156 inline static constexpr uint16_t EnigmaStyleStrikeout = 0x20;
157 inline static constexpr uint16_t EnigmaStyleAbsolute = 0x40;
158 inline static constexpr uint16_t EnigmaStyleHidden = 0x80;
160
165 std::string getName() const;
166
172 void setFontIdByName(const std::string& name);
173
180 void setEnigmaStyles(uint16_t efx)
181 {
182 bold = efx & EnigmaStyleBold;
188 }
189
191 uint16_t getEnigmaStyles() const
192 {
193 uint16_t result = 0;
194 if (bold) result |= EnigmaStyleBold;
195 if (italic) result |= EnigmaStyleItalic;
196 if (underline) result |= EnigmaStyleUnderline;
197 if (strikeout) result |= EnigmaStyleStrikeout;
198 if (absolute) result |= EnigmaStyleAbsolute;
199 if (hidden) result |= EnigmaStyleHidden;
200 return result;
201 }
202
205 { return fontId == 0; }
206
208 bool calcIsSymbolFont() const;
209
212 static std::optional<std::filesystem::path> calcSMuFLMetaDataPath(const std::string& fontName);
213
215 std::optional<std::filesystem::path> calcSMuFLMetaDataPath() const
217
221 bool calcIsSMuFL() const;
222
228 static std::vector<std::filesystem::path> calcSMuFLPaths();
229
231
232private:
233 bool m_sizeIsPercent;
234};
235
241{
242public:
244
255 enum class KeyContext {
256 Concert,
257 Written
258 };
259
266 uint16_t key{};
267 bool keyless{};
269
284 Cmper getKeyMode() const { return isLinear() ? key >> 8 : key; }
285
290 { return isLinear() ? int(int8_t(key & 0xff)) + getAlterationOffset(ctx) : 0; }
291
292 bool isLinear() const { return (key & 0xC000) == 0; }
293 bool isNonLinear() const { return (key & 0xC000) != 0; }
294 bool isBuiltIn() const { return isLinear() && getKeyMode() <= 1; }
295 bool isMajor() const { return getKeyMode() == 0; }
296 bool isMinor() const { return getKeyMode() == 1; }
297
301 std::optional<music_theory::DiatonicMode> calcDiatonicMode() const;
302
304 bool isSame(const KeySignature& src) const
305 {
306 return isSameConcert(src) && m_alterationOffset == src.m_alterationOffset && m_octaveDisplacement == src.m_octaveDisplacement;
307 }
308
310 bool isSameConcert(const KeySignature& src) const
311 {
312 return key == src.key && keyless == src.keyless && hideKeySigShowAccis == src.hideKeySigShowAccis;
313 }
314
318 int calcScaleDegree(int displacement) const;
319
336 void setTransposition(int interval, int keyAdjustment, bool simplify);
337
340
344 int calcTonalCenterIndex(KeyContext ctx) const;
345
349 int calcAlterationOnNote(unsigned noteIndex, KeyContext ctx ) const;
350
354 { return ctx == KeyContext::Written ? m_octaveDisplacement : 0; }
355
357 int calcEDODivisions() const;
358
360 std::optional<std::vector<int>> calcKeyMap() const;
361
366 std::unique_ptr<music_theory::Transposer> createTransposer(int displacement, int alteration) const;
367
368 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
369 {
370 this->CommonClassBase::integrityCheck(ptrToThis);
371 if (key >= 0x8000) {
372 MUSX_INTEGRITY_ERROR("Key signature has invalid key value: " + std::to_string(key));
373 }
374 }
375
377
378private:
379 std::vector<unsigned> calcTonalCenterArrayForSharps() const;
380 std::vector<unsigned> calcTonalCenterArrayForFlats() const;
381 std::vector<unsigned> calcTonalCenterArray(KeyContext ctx) const;
382 std::vector<int> calcAcciAmountsArray(KeyContext ctx) const;
383 std::vector<unsigned> calcAcciOrderArray(KeyContext ctx) const;
384
385 int m_octaveDisplacement{};
386 int m_alterationOffset{};
387
388 int getAlterationOffset(KeyContext ctx) const
389 { return ctx == KeyContext::Written ? m_alterationOffset : 0; }
390
391};
392
393namespace texts {
394class LyricsTextBase; // forward delcaration
395} // namespace texts
396
402{
403public:
410 LyricsLineInfo(const DocumentWeakPtr& document, Cmper requestedPartId, std::string_view type, Cmper lyricNo, Evpu baseline) :
411 CommonClassBase(document), baselinePosition(baseline), lyricsType(type), lyricNumber(lyricNo), assignments(document, requestedPartId)
412 {
413 }
414
416 std::string_view lyricsType;
419};
420
426{
427public:
428 std::string syllable;
432
433private:
438 class StyleSpan
439 {
440 public:
441 size_t start; // start byte
442 size_t end; // end byte (exclusive)
443 size_t styleIndex; // index into LyricsTextBase's style table
444 };
445
453 LyricsSyllableInfo(const DocumentWeakPtr& document, const std::string text, bool before, bool after, int underscores, std::vector<StyleSpan>&& enigmaStyleMap)
454 : CommonClassBase(document), syllable(text), hasHyphenBefore(before), hasHyphenAfter(after), strippedUnderscores(underscores), m_enigmaStyleMap(std::move(enigmaStyleMap))
455 {
456 }
457
458 std::vector<StyleSpan> m_enigmaStyleMap;
459
460 friend class texts::LyricsTextBase;
461};
462
474{
475public:
482 explicit MusicRange(const DocumentWeakPtr& document, MeasCmper startMeasId, util::Fraction startPos, MeasCmper endMeasId, util::Fraction endPos)
483 : CommonClassBase(document), startMeasureId(startMeasId), startPosition(startPos), endMeasureId(endMeasId), endPosition(endPos)
484 {
485 }
486
491
495 bool contains(MeasCmper measId, util::Fraction eduPosition) const
496 {
497 return (startMeasureId < measId || (startMeasureId == measId && startPosition <= eduPosition)) &&
498 (endMeasureId > measId || (endMeasureId == measId && endPosition >= eduPosition));
499 }
500
502 // The MusicRange must be expressed in the Staff EDUs of the entry.
504 bool contains(const EntryInfoPtr& entryInfo) const;
505
512 std::optional<std::pair<MeasCmper, Edu>> nextLocation(const std::optional<StaffCmper>& forStaff = std::nullopt) const;
513};
514
520{
521public:
522
525 {
526 std::vector<util::Fraction> counts;
528 std::vector<Edu> units;
531
533 bool operator==(const TimeSigComponent& src) const
534 { return counts == src.counts && units == src.units; }
535
538 { return std::accumulate(counts.begin(), counts.end(), util::Fraction{}); }
539
541 Edu sumUnits() const
542 { return std::accumulate(units.begin(), units.end(), Edu{}); }
543 };
544
545 std::vector<TimeSigComponent> components;
546
551 std::pair<util::Fraction, NoteType> calcSimplified() const;
552
555 {
556 util::Fraction result = std::accumulate(components.begin(), components.end(), util::Fraction{},
557 [](const util::Fraction& acc, const TimeSigComponent& comp)
558 { return acc + (comp.sumCounts() * comp.sumUnits()); }
559 );
560 return result / Edu(NoteType::Whole);
561 }
562
564 bool isSame(const TimeSignature& src) const
565 {
566 return components == src.components && m_abbreviate == src.m_abbreviate;
567 }
568
573 {
574 checkIndex(index);
575 return MusxInstance<TimeSignature>(new TimeSignature(getDocument(), components[index], m_abbreviate));
576 }
577
582 std::optional<char32_t> getAbbreviatedSymbol() const;
583
585 bool isCommonTime() const;
587 bool isCutTime() const;
588
589private:
590 void checkIndex(size_t index) const
591 {
592 if (index > components.size()) {
593 throw std::invalid_argument("Index out of range. The time signature has " + std::to_string(components.size())
594 + " elements. The index requested was " + std::to_string(index) + ".");
595 }
596 }
597
602 explicit TimeSignature(const DocumentWeakPtr& document, int beats, Edu unit, bool hasCompositeTop, bool hasCompositeBottom,
603 std::optional<bool> abbreviate = std::nullopt);
604
609 explicit TimeSignature(const DocumentWeakPtr& document, const TimeSigComponent& timeSigUnit, std::optional<bool> abbreviate)
610 : CommonClassBase(document), m_abbreviate(abbreviate)
611 {
612 components.push_back(timeSigUnit);
613 }
614
615 std::optional<bool> m_abbreviate;
616
617 friend class others::Measure;
618 friend class others::OssiaHeader;
619 friend class details::IndependentStaffDetails;
620};
621
622namespace others {
623
624// The following classes are defined here because they are shared by multiple subclasses and container classes.
625
630class Enclosure : public OthersBase
631{
632public:
637 enum class Shape : uint8_t
638 {
639 NoEnclosure = 0,
640 Rectangle = 1,
641 Ellipse = 2,
642 Triangle = 3,
643 Diamond = 4,
644 Pentagon = 5,
645 Hexagon = 6,
646 Heptagon = 7,
647 Octogon = 8
648 };
649
657 explicit Enclosure(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All, Cmper cmper = 0)
658 : OthersBase(document, partId, shareMode, cmper) {}
659
667 bool fixedSize{};
668 bool equalAspect{};
669 bool notTall{};
670 bool opaque{};
672
674};
675
686{
687public:
696 explicit EnigmaMusicRange(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All,
697 Cmper cmper = 0, std::optional<Inci> inci = std::nullopt)
698 : OthersBase(document, partId, shareMode, cmper, inci)
699 {
700 }
701
706
710 bool contains(MeasCmper measId, Edu eduPosition) const
711 {
712 return (startMeas < measId || (startMeas == measId && startEdu <= eduPosition)) &&
713 (endMeas > measId || (endMeas == measId && endEdu >= eduPosition));
714 }
715
722
729 std::optional<std::pair<MeasCmper, Edu>> nextLocation(const std::optional<StaffCmper>& forStaff = std::nullopt) const
730 { return createMusicRange().nextLocation(forStaff); }
731
733};
734
743{
744public:
745
753 explicit NamePositioning(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All, Cmper cmper = 0)
754 : OthersBase(document, partId, shareMode, cmper) {}
755
758 enum class AlignJustify
759 {
760 Left,
761 Right,
762 Center
763 };
764
768 bool indivPos{};
770 bool expand{};
771
773};
774
775} // namespace others
776} // namespace dom
777} // namespace mux
DocumentPtr getDocument() const
Gets a reference to the Document.
Definition BaseClasses.h:108
virtual void integrityCheck(const std::shared_ptr< Base > &ptrToThis)
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition BaseClasses.h:154
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:91
Base class for classes that are commonly used among others, details, entries, and/or texts....
Definition BaseClasses.h:200
CommonClassBase(const DocumentWeakPtr &document)
Constructs a CommonClassBase object.
Definition BaseClasses.h:209
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:398
Represents the default font settings for a particular element type.
Definition CommonClasses.h:126
static constexpr uint16_t EnigmaStyleHidden
Hidden text bit.
Definition CommonClasses.h:158
static constexpr uint16_t EnigmaStyleItalic
Italic style bit.
Definition CommonClasses.h:154
FontInfo(const DocumentWeakPtr &document, bool sizeIsPercent=false)
constructor
Definition CommonClasses.h:133
static constexpr uint16_t EnigmaStyleStrikeout
Strikeout style bit.
Definition CommonClasses.h:156
bool calcIsSymbolFont() const
Calculates if this is a symbol font. (See others::FontDefinition::calcIsSymbolFont....
Definition CommonClasses.cpp:109
static constexpr uint16_t EnigmaStyleUnderline
Underline style bit.
Definition CommonClasses.h:155
uint16_t getEnigmaStyles() const
Returns the font styles as an nfx bitmask.
Definition CommonClasses.h:191
static constexpr uint16_t EnigmaStyleAbsolute
Fixed-size (absolute) bit.
Definition CommonClasses.h:157
static constexpr uint16_t EnigmaStyleBold
Bold style bit.
Definition CommonClasses.h:153
bool strikeout
Strikeout effect.
Definition CommonClasses.h:143
void setFontIdByName(const std::string &name)
Sets the id of the font from a string name.
Definition CommonClasses.cpp:60
Cmper fontId
Font identifier. This is a Cmper for others::FontDefinition.
Definition CommonClasses.h:138
static std::vector< std::filesystem::path > calcSMuFLPaths()
Returns the standard SMuFL font folder.
Definition CommonClasses.cpp:117
bool calcIsSMuFL() const
Calculates whether this is a SMuFL font.
Definition CommonClasses.cpp:87
std::string getName() const
Get the name of the font.
Definition CommonClasses.cpp:52
static const xml::XmlElementArray< FontInfo > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool getSizeIsPercent() const
If true, the size of this font is calculated as a percent of the preceding font size (in an Enigma st...
Definition CommonClasses.h:148
void setEnigmaStyles(uint16_t efx)
Set style effects based on a bitmask. This is mainly useful for capturing text styles from enigma str...
Definition CommonClasses.h:180
bool italic
Italic effect.
Definition CommonClasses.h:141
bool hidden
Hidden effect.
Definition CommonClasses.h:145
bool calcIsDefaultMusic() const
Calculates if this is the default music font.
Definition CommonClasses.h:204
int fontSize
Font size or percent (where 100 is 100%) of preceding font size. (See getSizeIsPercent....
Definition CommonClasses.h:139
bool underline
Underline effect.
Definition CommonClasses.h:142
bool absolute
Fixed size effect.
Definition CommonClasses.h:144
std::optional< std::filesystem::path > calcSMuFLMetaDataPath() const
Returns the filepath of the SMuFL font's metadata json file, if any.
Definition CommonClasses.h:215
bool bold
Bold effect.
Definition CommonClasses.h:140
Shared key signature class that is contained in other classes. (See others::Measure)
Definition CommonClasses.h:241
Cmper getKeyMode() const
Returns the key mode.
Definition CommonClasses.h:284
bool isSame(const KeySignature &src) const
returns whether the two key signatures represent the same key signature, taking into account transpos...
Definition CommonClasses.h:304
int getAlteration(KeyContext ctx) const
For linear keys, returns the number of sharps or flats from -7..7 (if any).
Definition CommonClasses.h:289
bool hideKeySigShowAccis
Instead of a key signature, show accidentals for the key on the notes where they occur.
Definition CommonClasses.h:268
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition CommonClasses.h:368
int calcScaleDegree(int displacement) const
Calculates the scale degree for the given displacement, where 0 is the tonic.
Definition CommonClasses.cpp:345
bool isLinear() const
whether this is a linear key
Definition CommonClasses.h:292
int calcEDODivisions() const
Calculates the number of EDO division for the key. (The standard value is 12.)
Definition CommonClasses.cpp:429
bool isBuiltIn() const
whether this is a built-in key
Definition CommonClasses.h:294
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:255
@ Written
Use written pitch (with transposition)
@ Concert
Use concert pitch (untransposed)
int calcTonalCenterIndex(KeyContext ctx) const
Calculates the tonal center index for the key, where C=0, D=1, E=2, ...
Definition CommonClasses.cpp:302
int getOctaveDisplacement(KeyContext ctx) const
The octave displacement if this key is a transposed key.
Definition CommonClasses.h:353
uint16_t key
16-bit value intepreted as follows:
Definition CommonClasses.h:266
std::unique_ptr< music_theory::Transposer > createTransposer(int displacement, int alteration) const
Creates a transposer for this KeySignature instance.
Definition CommonClasses.cpp:437
std::optional< music_theory::DiatonicMode > calcDiatonicMode() const
If this key specifies a diatonic mode, returns the mode. This value is independent of EDO divisions....
Definition CommonClasses.cpp:442
void setTransposition(int interval, int keyAdjustment, bool simplify)
Transposes the key by the specified amounts. Set them to zero to remove transposition.
Definition CommonClasses.cpp:356
int calcAlterationOnNote(unsigned noteIndex, KeyContext ctx) const
Calculates the amount of alteration on a note int the key.
Definition CommonClasses.cpp:313
bool isMinor() const
whether this is a built-in minor key
Definition CommonClasses.h:296
bool isNonLinear() const
whether this is a non-linear key
Definition CommonClasses.h:293
static const xml::XmlElementArray< KeySignature > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool isSameConcert(const KeySignature &src) const
returns whether the two key signatures represent the same concert key signature, ignoring transpositi...
Definition CommonClasses.h:310
bool isMajor() const
whether this is a built-in major key
Definition CommonClasses.h:295
std::optional< std::vector< int > > calcKeyMap() const
Calculates the key's diatonic key map.
Definition CommonClasses.cpp:391
bool keyless
Indicates the absence of a key signature.
Definition CommonClasses.h:267
Contains information about a line of lyrics on a system.
Definition CommonClasses.h:402
std::string_view lyricsType
the type of lyric ("chorus", "verse", or "section", corresponding to the xml tags for lyrics text)
Definition CommonClasses.h:416
MusxInstanceList< details::LyricAssign > assignments
The lyric assignments on this line. They all share the same lyricNumber value.
Definition CommonClasses.h:418
Evpu baselinePosition
baseline position of this line on this system, relative to the staff's reference line
Definition CommonClasses.h:415
Cmper lyricNumber
the text number for all lyric assignments on this line.
Definition CommonClasses.h:417
LyricsLineInfo(const DocumentWeakPtr &document, Cmper requestedPartId, std::string_view type, Cmper lyricNo, Evpu baseline)
Constructor function.
Definition CommonClasses.h:410
Contains the syllable information for a single syllable. (See texts::LyricsTextBase)
Definition CommonClasses.h:426
bool hasHyphenAfter
indicates the syllable if followed by a hyphen.
Definition CommonClasses.h:430
int strippedUnderscores
indicates the number of trailing underscores stripped (because smart wort extensions convert them to ...
Definition CommonClasses.h:431
std::string syllable
the syllable text with no hyphenation or font information.
Definition CommonClasses.h:428
bool hasHyphenBefore
indicates the syllable is preceded by a hyphen.
Definition CommonClasses.h:429
Utility class that represents of a range of musical time.
Definition CommonClasses.h:474
std::optional< std::pair< MeasCmper, Edu > > nextLocation(const std::optional< StaffCmper > &forStaff=std::nullopt) const
Returns the next metric location following the music range.
Definition CommonClasses.cpp:460
util::Fraction endPosition
Ending EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:490
MusicRange(const DocumentWeakPtr &document, MeasCmper startMeasId, util::Fraction startPos, MeasCmper endMeasId, util::Fraction endPos)
Constructs a MusicRange object.
Definition CommonClasses.h:482
bool contains(MeasCmper measId, util::Fraction eduPosition) const
Returns true of the given metric location is contained in this MusicRange instance.
Definition CommonClasses.h:495
util::Fraction startPosition
Starting EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:488
MeasCmper endMeasureId
Ending measure in the range.
Definition CommonClasses.h:489
MeasCmper startMeasureId
Starting measure in the range.
Definition CommonClasses.h:487
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:103
Base class for all "others" types.
Definition BaseClasses.h:283
Shared time signature class that is derived from other classes. (See others::Measure)
Definition CommonClasses.h:520
bool isSame(const TimeSignature &src) const
returns whether the two time signatures represent the same time signature
Definition CommonClasses.h:564
bool isCutTime() const
Returns if this time signature is cut time.
Definition CommonClasses.cpp:572
std::vector< TimeSigComponent > components
the components in the time signature
Definition CommonClasses.h:545
util::Fraction calcTotalDuration() const
Calculates the total duration of the time signature as a fraction of a whole note.
Definition CommonClasses.h:554
std::optional< char32_t > getAbbreviatedSymbol() const
Returns the abbreviated symbol (code point) for this time signature, or std::nullopt if none.
Definition CommonClasses.cpp:541
bool isCommonTime() const
Returns if this time signature is common time.
Definition CommonClasses.cpp:564
MusxInstance< TimeSignature > createComponent(size_t index) const
Creates a time signature corresponding to the component at index.
Definition CommonClasses.h:572
std::pair< util::Fraction, NoteType > calcSimplified() const
Calculates the simplest form of of this time signature, expressed as a fractional count of NoteType u...
Definition CommonClasses.cpp:580
Represents independent time and key signature overrides for a staff.
Definition Details.h:1081
Contains assignment data for a lyric assignment (a single syllable)
Definition Details.h:1172
Represents the enclosure settings for text expressions.
Definition CommonClasses.h:631
bool notTall
"Enforce Minimum Width": don't let shape get taller than it is wide
Definition CommonClasses.h:669
Enclosure(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0)
Constructs an Enclosure object.
Definition CommonClasses.h:657
Evpu yAdd
Center Y offset - offsets text from center (in EVPU).
Definition CommonClasses.h:661
bool roundCorners
Whether the enclosure has rounded corners.
Definition CommonClasses.h:671
Efix lineWidth
Line thickness in 64ths of an EVPU (EFIX).
Definition CommonClasses.h:664
static const xml::XmlElementArray< Enclosure > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool opaque
Whether the enclosure is opaque.
Definition CommonClasses.h:670
Shape
Enumeration for enclosure shapes.
Definition CommonClasses.h:638
Evpu yMargin
Half height - extra space on top/bottom sides (in EVPU).
Definition CommonClasses.h:663
Shape shape
Enclosure shape (default: NoEnclosure).
Definition CommonClasses.h:665
bool fixedSize
Whether the enclosure is fixed size (ignore text bounding box)
Definition CommonClasses.h:667
bool equalAspect
"Match Height and Width"
Definition CommonClasses.h:668
Efix cornerRadius
Corner radius (in EFIX).
Definition CommonClasses.h:666
Evpu xMargin
Half width - extra space on left/right sides (in EVPU).
Definition CommonClasses.h:662
Evpu xAdd
Center X offset - offsets text from center (in EVPU).
Definition CommonClasses.h:660
The representation of a range of music used by Enigma files.
Definition CommonClasses.h:686
MeasCmper startMeas
Starting measure in the range.
Definition CommonClasses.h:702
std::optional< std::pair< MeasCmper, Edu > > nextLocation(const std::optional< StaffCmper > &forStaff=std::nullopt) const
Returns the next metric location following the music range.
Definition CommonClasses.h:729
MeasCmper endMeas
Ending measure in the range.
Definition CommonClasses.h:704
MusicRange createMusicRange() const
Creates a MusicRange instance corresponding to this instance. The MusicRange uses util::Fraction for ...
Definition CommonClasses.h:718
Edu startEdu
Starting EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:703
Edu endEdu
Ending EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:705
EnigmaMusicRange(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0, std::optional< Inci > inci=std::nullopt)
Constructs a EnigmaMusicRange object.
Definition CommonClasses.h:696
bool contains(MeasCmper measId, Edu eduPosition) const
Returns true of the given metric location is contained in this EnigmaMusicRange instance.
Definition CommonClasses.h:710
static const xml::XmlElementArray< EnigmaMusicRange > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Represents the attributes of a measure.
Definition Others.h:1111
Contains horizontal and vertical offsets, alignment, and expansion settings for name positioning.
Definition CommonClasses.h:743
bool indivPos
Indicates that this positioning overrides the default positioning. (Not used by options::StaffOptions...
Definition CommonClasses.h:768
NamePositioning(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0)
Constructs an NamePositioning object.
Definition CommonClasses.h:753
bool expand
"Expand Single Word"
Definition CommonClasses.h:770
AlignJustify
Alignment and justification options for staff and group names.
Definition CommonClasses.h:759
@ Left
Left alignment or justification (the default value.)
Evpu horzOff
Horizontal distance from staff in Evpu.
Definition CommonClasses.h:765
AlignJustify hAlign
Horizontal alignment for the name text. (xml node is <halign>)
Definition CommonClasses.h:769
AlignJustify justify
Justification for the name text.
Definition CommonClasses.h:767
Evpu vertOff
Vertical offset from staff in Evpu.
Definition CommonClasses.h:766
static const xml::XmlElementArray< NamePositioning > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Header properties for an ossia passage (clef, key, time, grouping).
Definition Ossia.h:71
Represents the definition of a Finale staff.
Definition Staff.h:52
Base class for lyrics text.
Definition Texts.h:123
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
static Fraction fromEdu(dom::Edu edu)
Constructs a Fraction from edu.
Definition Fraction.h:84
A dependency-free, header-only collection of useful functions for music theory.
DiatonicMode
Represents the seven standard diatonic musical modes.
Definition music_theory.hpp:85
ShowClefMode
Enum representing the clef display mode for a frame.
Definition CommonClasses.h:112
@ WhenNeeded
Clef is displayed only when needed (the default).
@ Always
Clef is always displayed. (xml value is "forced")
@ Never
Clef is never displayed. (xml value is "hidden")
NoteType
Enum class representing note types based on EDU values.
Definition CommonClasses.h:61
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
int32_t Efix
EFIX value (64 per EVPU, 64*288=18432 per inch)
Definition Fundamentals.h:60
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:39
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:79
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:57
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
DefaultClefType
Clef types used by default in Finale documents. The values correspond to indices into musx::dom::opti...
Definition CommonClasses.h:86
@ Bass8vb
F clef, sounds one octave lower (8vb).
@ Alto
C clef, centered on third line (Alto clef).
@ BaritoneC
C clef on fifth line (Baritone clef).
@ Tab1
Tablature clef (5 lines).
@ Treble
G clef, standard treble.
@ FrenchViolin
G clef placed on first line (French violin clef).
@ Treble8va
G clef, sounds one octave higher (8va).
@ Bass8va
F clef, sounds one octave higher (8va).
@ AltPercussion
Alternate percussion clef, heavy vertical hash marks (no pitch).
@ Soprano
C clef on first line (Soprano clef).
@ Bass
F clef, standard bass.
@ Percussion
Percussion clef, open rectangle (no pitch).
@ Baritone
F clef on third line (Baritone clef).
@ Tab2
Tablature clef (5 lines, alternative style).
@ Treble8vb
G clef, sounds one octave lower (8vb).
@ Blank
Blank clef (invisible, no symbol).
@ MezzoSoprano
C clef on second line (Mezzo-soprano clef).
@ Tenor
C clef, centered on fourth line (Tenor clef).
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:68
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:36
A single time signature component.
Definition CommonClasses.h:525
std::vector< util::Fraction > counts
Definition CommonClasses.h:526
std::vector< Edu > units
Definition CommonClasses.h:528
util::Fraction sumCounts() const
Compute the sum of all counts.
Definition CommonClasses.h:537
Edu sumUnits() const
Compute the sum of all units.
Definition CommonClasses.h:541
bool operator==(const TimeSigComponent &src) const
Test if two TimeSigComponent values are the same.
Definition CommonClasses.h:533