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 InstCmper = int16_t;
66using SystemCmper = int16_t;
67using ClefIndex = uint16_t;
68using EntryNumber = int32_t;
69using NoteNumber = uint16_t;
70using LayerIndex = unsigned int;
71using BeamNumber = unsigned int;
72
73constexpr Cmper MUSX_GLOBALS_CMPER = 65534;
74constexpr int MAX_LAYERS = 4;
75constexpr Cmper SCORE_PARTID = 0;
76constexpr Cmper BASE_SYSTEM_ID = 0;
77
78} // namespace dom
79} // namespace musx
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:73
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:70
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:75
int32_t Evpu16ths
1/16 of an EVPU.
Definition Fundamentals.h:59
int16_t InstCmper
Enigma staff (inst) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
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:74
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:67
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:68
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:69
constexpr Cmper BASE_SYSTEM_ID
The base system cmper that gives a list of all available staves and their score order (others::Instru...
Definition Fundamentals.h:76
int16_t SystemCmper
Enigma systems Cmper (may be negative when not applicable)
Definition Fundamentals.h:66
double EduFloat
"Enigma Durational Units" floating point value (1024.0 per quarter note)
Definition Fundamentals.h:62
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:71
object model for musx file (enigmaxml)
Definition BaseClasses.h:32