MUSX Document Model
Loading...
Searching...
No Matches
Fundamentals.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 <cstdint>
25
26#if defined(_WIN32)
27#define MUSX_RUNNING_ON_WINDOWS
28#elif defined(__APPLE__) && defined(__MACH__)
29#define MUSX_RUNNING_ON_MACOS
30#elif defined(__EMSCRIPTEN__)
31#define MUSX_RUNNING_ON_WASM
32#elif defined(__unix__) || defined(__linux__)
33#define MUSX_RUNNING_ON_LINUX_UNIX
34#else
35#error "Unable to detect operating system platform."
36#endif
37
38#ifdef MUSX_THROW_ON_INTEGRITY_CHECK_FAIL
39#define MUSX_INTEGRITY_ERROR(S) throw ::musx::dom::integrity_error(S)
40#else
41#define MUSX_INTEGRITY_ERROR(S) ::musx::util::Logger::log(::musx::util::Logger::LogLevel::Warning, (S))
42#endif
43
44#ifdef MUSX_THROW_ON_UNKNOWN_XML
45#define MUSX_UNKNOWN_XML(S) throw ::musx::factory::unknown_xml_error(S)
46#else
47#define MUSX_UNKNOWN_XML(S) ::musx::util::Logger::log(::musx::util::Logger::LogLevel::Warning, (S))
48#endif
49
50#define MUSX_ASSERT_IF(TEST) \
51assert(!(TEST)); \
52if (TEST)
53
54namespace musx {
55namespace dom {
56
57using Cmper = uint16_t;
58using Inci = int16_t;
59using Evpu = int32_t;
60using EvpuFloat = double;
61using Evpu16ths = int32_t;
62using Efix = int32_t;
63using Edu = int32_t;
64using EduFloat = double;
65
66using MeasCmper = int16_t;
67using StaffCmper = int16_t;
68using SystemCmper = int16_t;
69using PageCmper = int16_t;
70using ClefIndex = uint16_t;
71using EntryNumber = int32_t;
72using NoteNumber = uint16_t;
73using LayerIndex = unsigned int;
74using BeamNumber = unsigned int;
75using PercussionNoteTypeId = uint16_t;
77
78constexpr Cmper MUSX_GLOBALS_CMPER = 65534;
79constexpr int MAX_LAYERS = 4;
80constexpr int MAX_ALTERATIONS = 7;
81constexpr Cmper SCORE_PARTID = 0;
82
83constexpr double EVPU_PER_INCH = 288.0;
84constexpr double EVPU_PER_POINT = 4.0;
85constexpr double EVPU_PER_MM = EVPU_PER_INCH / 25.4;
86constexpr double EVPU_PER_CM = EVPU_PER_MM * 10.0;
87constexpr double EVPU_PER_PX = EVPU_PER_INCH / 96.0;
88constexpr double EVPU_PER_PICA = EVPU_PER_POINT * 12.0;
89constexpr double EVPU_PER_SPACE = 24.0;
90constexpr double EVPU_PER_STANDARD_STAFF = 4.0 * EVPU_PER_SPACE;
91constexpr double EVPU_PER_STAFF_POSITION = EVPU_PER_SPACE / 2.0;
92constexpr double EFIX_PER_EVPU = 64.0;
94
95constexpr Edu EDU_PER_WHOLE_NOTE = 0x1000;
96
97constexpr Cmper BASE_SYSTEM_ID = 0;
100constexpr Cmper STAFF_SET_1_SYSTEM_ID = 65500;
102constexpr Cmper STUDIO_VIEW_SYSTEM_ID = 65400;
105constexpr Cmper TEMP_SYSTEM_ID = 65529;
107
108constexpr int MAX_CUE_PERCENTAGE = 90;
109
114namespace smufl_glyph {
115// Use namespace instead of enum class due to comparison ugliness with enum class.
116constexpr char32_t unpitchedPercussionClef2 = 0xE06A;
117constexpr char32_t timeSigCommon = 0xE08A;
118constexpr char32_t timeSigCutCommon = 0xE08B;
119constexpr char32_t noteheadBlack = 0xE0A4;
120constexpr char32_t accidentalNatural = 0xE261;
121constexpr char32_t restQuarter = 0xE4E5;
122constexpr char32_t sixStringTabClefSerif = 0xF40B;
123constexpr char32_t fourStringTabClefSerif = 0xF40D;
124constexpr char32_t arpeggioVerticalSegment = 0xF700;
125} //namespace smufl_glyph
126
131namespace symbol_glyph {
132// Use namespace instead of enum class due to comparison ugliness with enum class.
133constexpr char32_t unpitchedPercussionClef2 = 214;
134} //namespace symbol_glyph
135
136} // namespace dom
137} // namespace musx
constexpr int MAX_ALTERATIONS
Maximum absolute value for chromatic alterations supported in Finale.
Definition Fundamentals.h:80
constexpr double EVPU_PER_SPACE
Number of Evpu units per space (spatium)
Definition Fundamentals.h:89
constexpr double EVPU_PER_POINT
Number of Evpu units per 72 DPI point.
Definition Fundamentals.h:84
uint16_t PercussionNoteTypeId
multiple times in one layout. The rest are the "pure" note type. See percussion::PercussionNoteType.
Definition Fundamentals.h:76
constexpr double EVPU_PER_PX
Number of Evpu units per CSS pixel.
Definition Fundamentals.h:87
constexpr int MAX_CUE_PERCENTAGE
Arbitrary value that determines the max scaling value for cue notes. This could be configurable in th...
Definition Fundamentals.h:108
constexpr double EFIX_PER_SPACE
Number of Efix units per space (spatium)
Definition Fundamentals.h:93
constexpr Cmper STUDIO_VIEW_SYSTEM_ID
The system cmper for Studio View. Studio View has entries for every click in the click track.
Definition Fundamentals.h:102
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
constexpr Cmper MUSX_GLOBALS_CMPER
The prefs cmper for global variables (used sparingly since Finale 26.2)
Definition Fundamentals.h:78
constexpr Cmper STAFF_SET_1_SYSTEM_ID
Definition Fundamentals.h:100
constexpr double EVPU_PER_CM
Number of Evpu units per centimeter.
Definition Fundamentals.h:86
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
constexpr double EVPU_PER_PICA
Number of Evpu units per pica.
Definition Fundamentals.h:88
constexpr double EFIX_PER_EVPU
Number of Efix units per Evpu.
Definition Fundamentals.h:92
int32_t Evpu16ths
1/16 of an EVPU.
Definition Fundamentals.h:61
int16_t Inci
Enigma "incident" key type.
Definition Fundamentals.h:58
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:59
constexpr int MAX_LAYERS
The maximum number of music layers in a Finale document.
Definition Fundamentals.h:79
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:57
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:70
constexpr double EVPU_PER_MM
Number of Evpu units per millimeter.
Definition Fundamentals.h:85
double EvpuFloat
EVPU fractional value (288.0 per inch)
Definition Fundamentals.h:60
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
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:71
constexpr double EVPU_PER_STANDARD_STAFF
Number of Evpu units per standard 5-line staff.
Definition Fundamentals.h:90
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:72
constexpr Cmper BASE_SYSTEM_ID
Definition Fundamentals.h:97
constexpr Edu EDU_PER_WHOLE_NOTE
Number of Edu units per whole note.
Definition Fundamentals.h:95
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
constexpr double EVPU_PER_INCH
Number of Evpu units per inch.
Definition Fundamentals.h:83
double EduFloat
"Enigma Durational Units" floating point value (1024.0 per quarter note)
Definition Fundamentals.h:64
constexpr Cmper TEMP_SYSTEM_ID
Definition Fundamentals.h:105
constexpr Cmper SPECIAL_PART_EXTRACTION_SYSTEM_ID
Definition Fundamentals.h:103
int16_t PageCmper
Enigma page Cmper (may be negative when not applicable)
Definition Fundamentals.h:69
unsigned int BeamNumber
A number where 1 corresponds to the primary (8th note) beam, 2 the 16th beam, 3 the 32nd beam,...
Definition Fundamentals.h:74
object model for musx file (enigmaxml)
Definition BaseClasses.h:38
List of SMuFL codepoints used by musxdom.
List of symbol codepoints used by musxdom.