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(__unix__) || defined(__linux__)
31#define MUSX_RUNNING_ON_LINUX_UNIX
32#else
33#error "Unable to detect operating system platform."
34#endif
35
36#ifdef MUSX_THROW_ON_INTEGRITY_CHECK_FAIL
37#define MUSX_INTEGRITY_ERROR(S) throw ::musx::dom::integrity_error(S)
38#else
39#define MUSX_INTEGRITY_ERROR(S) ::musx::util::Logger::log(::musx::util::Logger::LogLevel::Warning, (S))
40#endif
41
42#ifdef MUSX_THROW_ON_UNKNOWN_XML
43#define MUSX_UNKNOWN_XML(S) throw ::musx::factory::unknown_xml_error(S)
44#else
45#define MUSX_UNKNOWN_XML(S) ::musx::util::Logger::log(::musx::util::Logger::LogLevel::Warning, (S))
46#endif
47
48#define MUSX_ASSERT_IF(TEST) \
49assert(!(TEST)); \
50if (TEST)
51
52namespace musx {
53namespace dom {
54
55using Cmper = uint16_t;
56using Inci = int16_t;
57using Evpu = int32_t;
58using EvpuFloat = double;
59using Evpu16ths = int32_t;
60using Efix = int32_t;
61using Edu = int32_t;
62using EduFloat = double;
63
64using MeasCmper = int16_t;
65using StaffCmper = int16_t;
66using SystemCmper = int16_t;
67using PageCmper = int16_t;
68using ClefIndex = uint16_t;
69using EntryNumber = int32_t;
70using NoteNumber = uint16_t;
71using LayerIndex = unsigned int;
72using BeamNumber = unsigned int;
73using PercussionNoteTypeId = uint16_t;
75
76constexpr Cmper MUSX_GLOBALS_CMPER = 65534;
77constexpr int MAX_LAYERS = 4;
78constexpr int MAX_ALTERATIONS = 7;
79constexpr Cmper SCORE_PARTID = 0;
80
81constexpr double EVPU_PER_INCH = 288.0;
82constexpr double EVPU_PER_POINT = 4.0;
83constexpr double EVPU_PER_MM = EVPU_PER_INCH / 25.4;
84constexpr double EVPU_PER_CM = EVPU_PER_MM * 10.0;
85constexpr double EVPU_PER_PX = EVPU_PER_INCH / 96.0;
86constexpr double EVPU_PER_PICA = EVPU_PER_POINT * 12.0;
87constexpr double EVPU_PER_SPACE = 24.0;
88constexpr double EFIX_PER_EVPU = 64.0;
90constexpr Edu EDU_PER_WHOLE_NOTE = 0x1000;
91
92constexpr Cmper BASE_SYSTEM_ID = 0;
95constexpr Cmper STAFF_SET_1_SYSTEM_ID = 65500;
97constexpr Cmper STUDIO_VIEW_SYSTEM_ID = 65400;
100constexpr Cmper TEMP_SYSTEM_ID = 65529;
102
103constexpr int MAX_CUE_PERCENTAGE = 90;
104
109namespace smulf_glyph {
110// Use namespace instead of enum class due to comparison ugliness with enum class.
111constexpr char32_t unpitchedPercussionClef2 = 0xE06A;
112constexpr char32_t timeSigCommon = 0xE08A;
113constexpr char32_t timeSigCutCommon = 0xE08B;
114constexpr char32_t sixStringTabClefSerif = 0xF40B;
115constexpr char32_t fourStringTabClefSerif = 0xF40D;
116} //namespace smulf_glyph
117
122namespace symbol_glyph {
123// Use namespace instead of enum class due to comparison ugliness with enum class.
124constexpr char32_t unpitchedPercussionClef2 = 214;
125} //namespace symbol_glyph
126
127} // namespace dom
128} // namespace musx
constexpr int MAX_ALTERATIONS
Maximum absolute value for chromatic alterations supported in Finale.
Definition Fundamentals.h:78
constexpr double EVPU_PER_SPACE
Number of Evpu units per space (spatium)
Definition Fundamentals.h:87
constexpr double EVPU_PER_POINT
Number of Evpu units per 72 DPI point.
Definition Fundamentals.h:82
uint16_t PercussionNoteTypeId
multiple times in one layout. The rest are the "pure" note type. See percussion::PercussionNoteType.
Definition Fundamentals.h:74
constexpr double EVPU_PER_PX
Number of Evpu units per CSS pixel.
Definition Fundamentals.h:85
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:103
constexpr double EFIX_PER_SPACE
Number of Efix units per space (spatium)
Definition Fundamentals.h:89
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:97
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
constexpr Cmper MUSX_GLOBALS_CMPER
The prefs cmper for global variables (used sparingly since Finale 26.2)
Definition Fundamentals.h:76
constexpr Cmper STAFF_SET_1_SYSTEM_ID
Definition Fundamentals.h:95
constexpr double EVPU_PER_CM
Number of Evpu units per centimeter.
Definition Fundamentals.h:84
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:71
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:79
constexpr double EVPU_PER_PICA
Number of Evpu units per pica.
Definition Fundamentals.h:86
constexpr double EFIX_PER_EVPU
Number of Efix units per Evpu.
Definition Fundamentals.h:88
int32_t Evpu16ths
1/16 of an EVPU.
Definition Fundamentals.h:59
int16_t Inci
Enigma "incident" key type.
Definition Fundamentals.h:56
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:57
constexpr int MAX_LAYERS
The maximum number of music layers in a Finale document.
Definition Fundamentals.h:77
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:68
constexpr double EVPU_PER_MM
Number of Evpu units per millimeter.
Definition Fundamentals.h:83
double EvpuFloat
EVPU fractional value (288.0 per inch)
Definition Fundamentals.h:58
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:69
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:70
constexpr Cmper BASE_SYSTEM_ID
Definition Fundamentals.h:92
constexpr Edu EDU_PER_WHOLE_NOTE
Number of Edu units per whole note.
Definition Fundamentals.h:90
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
int16_t SystemCmper
Enigma systems Cmper (may be negative when not applicable)
Definition Fundamentals.h:66
constexpr double EVPU_PER_INCH
Number of Evpu units per inch.
Definition Fundamentals.h:81
double EduFloat
"Enigma Durational Units" floating point value (1024.0 per quarter note)
Definition Fundamentals.h:62
constexpr Cmper TEMP_SYSTEM_ID
Definition Fundamentals.h:100
constexpr Cmper SPECIAL_PART_EXTRACTION_SYSTEM_ID
Definition Fundamentals.h:98
int16_t PageCmper
Enigma page Cmper (may be negative when not applicable)
Definition Fundamentals.h:67
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:72
object model for musx file (enigmaxml)
Definition BaseClasses.h:36
List of SMuFL codepoints used by musxdom.
List of symbol codepoints used by musxdom.