smoosic 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +1 -1
- package/package.json +1 -1
- package/release/smoosic.js +1 -1
- package/src/application/exports.ts +1 -0
- package/types/src/application/application.d.ts +102 -102
- package/types/src/application/common.d.ts +74 -74
- package/types/src/application/configuration.d.ts +74 -74
- package/types/src/application/dom.d.ts +8 -8
- package/types/src/application/dynamicInit.d.ts +1 -1
- package/types/src/application/eventHandler.d.ts +78 -78
- package/types/src/application/exports.d.ts +494 -493
- package/types/src/application/generateVexTests.d.ts +10 -10
- package/types/src/application/keyCommands.d.ts +90 -90
- package/types/src/common/bootstrap.bundle.d.ts +1138 -1138
- package/types/src/common/htmlHelpers.d.ts +105 -105
- package/types/src/common/jszip.d.ts +2 -2
- package/types/src/common/midi-parser.d.ts +38 -38
- package/types/src/common/promiseHelpers.d.ts +30 -30
- package/types/src/common/serializationHelpers.d.ts +29 -29
- package/types/src/common/textformatter.d.ts +140 -140
- package/types/src/common/vex.d.ts +222 -222
- package/types/src/render/audio/musicCursor.d.ts +25 -25
- package/types/src/render/audio/oscillator.d.ts +98 -98
- package/types/src/render/audio/player.d.ts +141 -141
- package/types/src/render/audio/samples.d.ts +56 -56
- package/types/src/render/sui/configuration.d.ts +12 -12
- package/types/src/render/sui/formatter.d.ts +151 -151
- package/types/src/render/sui/layoutDebug.d.ts +43 -43
- package/types/src/render/sui/mapper.d.ts +116 -116
- package/types/src/render/sui/piano.d.ts +46 -46
- package/types/src/render/sui/renderState.d.ts +88 -88
- package/types/src/render/sui/scoreRender.d.ts +93 -93
- package/types/src/render/sui/scoreView.d.ts +267 -267
- package/types/src/render/sui/scoreViewOperations.d.ts +594 -594
- package/types/src/render/sui/scroller.d.ts +34 -34
- package/types/src/render/sui/svgHelpers.d.ts +85 -85
- package/types/src/render/sui/svgPageMap.d.ts +318 -318
- package/types/src/render/sui/textEdit.d.ts +310 -310
- package/types/src/render/sui/textRender.d.ts +189 -189
- package/types/src/render/sui/tracker.d.ts +90 -90
- package/types/src/render/vex/glyphDimensions.d.ts +23 -23
- package/types/src/render/vex/smoAdapter.d.ts +46 -46
- package/types/src/render/vex/toVex.d.ts +13 -13
- package/types/src/render/vex/vxMeasure.d.ts +95 -95
- package/types/src/render/vex/vxNote.d.ts +55 -55
- package/types/src/render/vex/vxSystem.d.ts +64 -64
- package/types/src/smo/data/common.d.ts +220 -220
- package/types/src/smo/data/measure.d.ts +510 -510
- package/types/src/smo/data/measureModifiers.d.ts +506 -506
- package/types/src/smo/data/music.d.ts +438 -438
- package/types/src/smo/data/note.d.ts +485 -485
- package/types/src/smo/data/noteModifiers.d.ts +590 -590
- package/types/src/smo/data/partInfo.d.ts +162 -162
- package/types/src/smo/data/score.d.ts +395 -395
- package/types/src/smo/data/scoreModifiers.d.ts +433 -433
- package/types/src/smo/data/scoreText.d.ts +277 -277
- package/types/src/smo/data/staffModifiers.d.ts +767 -767
- package/types/src/smo/data/systemStaff.d.ts +238 -238
- package/types/src/smo/data/tuplet.d.ts +146 -146
- package/types/src/smo/midi/midiToSmo.d.ts +198 -198
- package/types/src/smo/midi/smoToMidi.d.ts +23 -23
- package/types/src/smo/mxml/smoToXml.d.ts +165 -165
- package/types/src/smo/mxml/xmlHelpers.d.ts +140 -140
- package/types/src/smo/mxml/xmlState.d.ts +257 -257
- package/types/src/smo/mxml/xmlToSmo.d.ts +92 -92
- package/types/src/smo/xform/beamers.d.ts +46 -46
- package/types/src/smo/xform/copypaste.d.ts +99 -99
- package/types/src/smo/xform/operations.d.ts +127 -127
- package/types/src/smo/xform/roadmap.d.ts +70 -70
- package/types/src/smo/xform/selections.d.ts +153 -153
- package/types/src/smo/xform/tickDuration.d.ts +155 -155
- package/types/src/smo/xform/tickMap.d.ts +34 -34
- package/types/src/smo/xform/undo.d.ts +142 -142
- package/types/src/smo/xform/updateAudio.d.ts +9 -9
- package/types/src/styles/font_metrics/Commissioner-Medium-Metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/ConcertOne-Regular.d.ts +871 -871
- package/types/src/styles/font_metrics/Merriweather-Regular.d.ts +871 -871
- package/types/src/styles/font_metrics/arial_metrics.d.ts +870 -870
- package/types/src/styles/font_metrics/ssp-sans-metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/ssp-serif-metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/times_metrics.d.ts +870 -870
- package/types/src/ui/buttons/button.d.ts +95 -95
- package/types/src/ui/buttons/collapsable.d.ts +42 -42
- package/types/src/ui/buttons/display.d.ts +23 -23
- package/types/src/ui/buttons/ribbon.d.ts +76 -76
- package/types/src/ui/common.d.ts +45 -45
- package/types/src/ui/composable/draggable.d.ts +12 -12
- package/types/src/ui/configuration.d.ts +31 -31
- package/types/src/ui/dialogs/adapter.d.ts +107 -107
- package/types/src/ui/dialogs/addMeasure.d.ts +20 -20
- package/types/src/ui/dialogs/arpeggio.d.ts +2 -2
- package/types/src/ui/dialogs/articulation.d.ts +2 -2
- package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
- package/types/src/ui/dialogs/chordChange.d.ts +35 -35
- package/types/src/ui/dialogs/clefChange.d.ts +2 -2
- package/types/src/ui/dialogs/components/baseComponent.d.ts +158 -158
- package/types/src/ui/dialogs/components/button.d.ts +54 -54
- package/types/src/ui/dialogs/components/buttonArray.d.ts +101 -101
- package/types/src/ui/dialogs/components/checkdrop.d.ts +27 -27
- package/types/src/ui/dialogs/components/dragText.d.ts +27 -27
- package/types/src/ui/dialogs/components/dropdown.d.ts +78 -78
- package/types/src/ui/dialogs/components/fileDownload.d.ts +28 -28
- package/types/src/ui/dialogs/components/fontComponent.d.ts +32 -32
- package/types/src/ui/dialogs/components/noteText.d.ts +98 -98
- package/types/src/ui/dialogs/components/pitch.d.ts +95 -95
- package/types/src/ui/dialogs/components/rocker.d.ts +66 -66
- package/types/src/ui/dialogs/components/staffComponents.d.ts +77 -77
- package/types/src/ui/dialogs/components/textCheck.d.ts +38 -38
- package/types/src/ui/dialogs/components/textInPlace.d.ts +90 -90
- package/types/src/ui/dialogs/components/textInput.d.ts +58 -58
- package/types/src/ui/dialogs/components/tie.d.ts +41 -41
- package/types/src/ui/dialogs/components/toggle.d.ts +53 -53
- package/types/src/ui/dialogs/components/tree.d.ts +46 -46
- package/types/src/ui/dialogs/customTuplets.d.ts +25 -25
- package/types/src/ui/dialogs/dialog.d.ts +201 -201
- package/types/src/ui/dialogs/durations.d.ts +2 -2
- package/types/src/ui/dialogs/dynamics.d.ts +37 -37
- package/types/src/ui/dialogs/endings.d.ts +61 -61
- package/types/src/ui/dialogs/factory.d.ts +15 -15
- package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
- package/types/src/ui/dialogs/fonts.d.ts +2 -2
- package/types/src/ui/dialogs/globalLayout.d.ts +2 -2
- package/types/src/ui/dialogs/gracenote.d.ts +2 -2
- package/types/src/ui/dialogs/hairpin.d.ts +35 -35
- package/types/src/ui/dialogs/instrument.d.ts +3 -3
- package/types/src/ui/dialogs/keySignature.d.ts +33 -33
- package/types/src/ui/dialogs/library.d.ts +70 -70
- package/types/src/ui/dialogs/lyric.d.ts +39 -39
- package/types/src/ui/dialogs/measureFormat.d.ts +52 -52
- package/types/src/ui/dialogs/microtones.d.ts +2 -2
- package/types/src/ui/dialogs/noteHead.d.ts +2 -2
- package/types/src/ui/dialogs/ornament.d.ts +2 -2
- package/types/src/ui/dialogs/pageLayout.d.ts +2 -2
- package/types/src/ui/dialogs/partInfo.d.ts +2 -2
- package/types/src/ui/dialogs/pedalMarking.d.ts +35 -35
- package/types/src/ui/dialogs/pitch.d.ts +2 -2
- package/types/src/ui/dialogs/preferences.d.ts +2 -2
- package/types/src/ui/dialogs/scoreId.d.ts +2 -2
- package/types/src/ui/dialogs/scoreView.d.ts +2 -2
- package/types/src/ui/dialogs/slur.d.ts +57 -57
- package/types/src/ui/dialogs/staffGroup.d.ts +2 -2
- package/types/src/ui/dialogs/tabNote.d.ts +32 -32
- package/types/src/ui/dialogs/tabStave.d.ts +43 -43
- package/types/src/ui/dialogs/tempo.d.ts +50 -50
- package/types/src/ui/dialogs/textBlock.d.ts +61 -61
- package/types/src/ui/dialogs/textBracket.d.ts +35 -35
- package/types/src/ui/dialogs/tie.d.ts +41 -41
- package/types/src/ui/dialogs/timeSignature.d.ts +34 -34
- package/types/src/ui/dialogs/transposeScore.d.ts +2 -2
- package/types/src/ui/dialogs/volta.d.ts +40 -40
- package/types/src/ui/eventSource.d.ts +63 -63
- package/types/src/ui/exceptions.d.ts +12 -12
- package/types/src/ui/fileio/fileInput.d.ts +12 -12
- package/types/src/ui/fileio/library.d.ts +40 -40
- package/types/src/ui/fileio/xhrLoader.d.ts +18 -18
- package/types/src/ui/help.d.ts +22 -22
- package/types/src/ui/i18n/language.d.ts +37 -37
- package/types/src/ui/i18n/language_ar.d.ts +5 -5
- package/types/src/ui/i18n/language_de.d.ts +1 -1
- package/types/src/ui/i18n/language_en.d.ts +18 -18
- package/types/src/ui/i18n/translationEditor.d.ts +14 -14
- package/types/src/ui/keyBindings/default/editorKeys.d.ts +7 -7
- package/types/src/ui/keyBindings/default/trackerKeys.d.ts +7 -7
- package/types/src/ui/menus/beams.d.ts +13 -13
- package/types/src/ui/menus/edit.d.ts +8 -8
- package/types/src/ui/menus/file.d.ts +26 -26
- package/types/src/ui/menus/help.d.ts +8 -8
- package/types/src/ui/menus/keySignature.d.ts +13 -13
- package/types/src/ui/menus/language.d.ts +12 -12
- package/types/src/ui/menus/manager.d.ts +57 -57
- package/types/src/ui/menus/measure.d.ts +8 -8
- package/types/src/ui/menus/menu.d.ts +136 -136
- package/types/src/ui/menus/note.d.ts +8 -8
- package/types/src/ui/menus/partSelection.d.ts +19 -19
- package/types/src/ui/menus/parts.d.ts +50 -50
- package/types/src/ui/menus/score.d.ts +20 -20
- package/types/src/ui/menus/staffModifier.d.ts +21 -21
- package/types/src/ui/menus/text.d.ts +8 -8
- package/types/src/ui/menus/timeSignature.d.ts +12 -12
- package/types/src/ui/menus/tuplets.d.ts +13 -13
- package/types/src/ui/menus/voices.d.ts +8 -8
- package/types/src/ui/modalDialogs.d.ts +1 -1
- package/types/src/ui/navigation.d.ts +15 -15
- package/types/src/ui/qwerty.d.ts +41 -41
- package/types/src/ui/ribbonLayout/default/defaultRibbon.d.ts +15 -15
- package/types/src/ui/ribbonLayout/default/tabletRibbon.d.ts +22 -22
- package/types/typedoc.d.ts +158 -158
|
@@ -1,510 +1,510 @@
|
|
|
1
|
-
import { SmoBarline, SmoMeasureModifierBase, SmoRepeatSymbol, SmoTempoText, SmoMeasureFormat, SmoVolta, SmoRehearsalMarkParams, SmoTempoTextParams, TimeSignature, TimeSignatureParametersSer, SmoTempoTextParamsSer } from './measureModifiers';
|
|
2
|
-
import { SmoNote, NoteType, SmoNoteParamsSer } from './note';
|
|
3
|
-
import { SmoTuplet, SmoTupletTreeParamsSer, SmoTupletTree } from './tuplet';
|
|
4
|
-
import { TickMap } from '../xform/tickMap';
|
|
5
|
-
import { MeasureNumber, SvgBox, SmoAttrs, Pitch, Clef, TickAccidental, AccidentalArray } from './common';
|
|
6
|
-
import { FontInfo } from '../../common/vex';
|
|
7
|
-
/**
|
|
8
|
-
* Voice is just a container for {@link SmoNote}
|
|
9
|
-
* @category SmoObject
|
|
10
|
-
*/
|
|
11
|
-
export interface SmoVoice {
|
|
12
|
-
notes: SmoNote[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @category SmoObject
|
|
16
|
-
*/
|
|
17
|
-
export interface SmoVoiceSer {
|
|
18
|
-
notes: SmoNoteParamsSer[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* TickMappable breaks up a circular dependency on modifiers
|
|
22
|
-
* like @SmoDuration
|
|
23
|
-
* @category SmoObject
|
|
24
|
-
*/
|
|
25
|
-
export interface TickMappable {
|
|
26
|
-
voices: SmoVoice[];
|
|
27
|
-
keySignature: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @category SmoObject
|
|
31
|
-
*/
|
|
32
|
-
export interface MeasureTick {
|
|
33
|
-
voiceIndex: number;
|
|
34
|
-
tickIndex: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Break up a circlar dependency with {@link SmoBeamGroup}
|
|
38
|
-
* @category SmoObject
|
|
39
|
-
*/
|
|
40
|
-
export interface ISmoBeamGroup {
|
|
41
|
-
notes: SmoNote[];
|
|
42
|
-
secondaryBeamBreaks: number[];
|
|
43
|
-
voice: number;
|
|
44
|
-
attrs: SmoAttrs;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* geometry information about the current measure for rendering and
|
|
48
|
-
* score layout.
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
export interface MeasureSvg {
|
|
52
|
-
staffWidth: number;
|
|
53
|
-
unjustifiedWidth: number;
|
|
54
|
-
adjX: number;
|
|
55
|
-
maxColumnStartX: number;
|
|
56
|
-
staffX: number;
|
|
57
|
-
staffY: number;
|
|
58
|
-
logicalBox: SvgBox;
|
|
59
|
-
yTop: number;
|
|
60
|
-
adjRight: number;
|
|
61
|
-
history: string[];
|
|
62
|
-
lineIndex: number;
|
|
63
|
-
pageIndex: number;
|
|
64
|
-
rowInSystem: number;
|
|
65
|
-
forceClef: boolean;
|
|
66
|
-
forceKeySignature: boolean;
|
|
67
|
-
forceTimeSignature: boolean;
|
|
68
|
-
forceTempo: boolean;
|
|
69
|
-
hideEmptyMeasure: boolean;
|
|
70
|
-
hideMultimeasure: boolean;
|
|
71
|
-
multimeasureLength: number;
|
|
72
|
-
multimeasureEndBarline: number;
|
|
73
|
-
element: SVGSVGElement | null;
|
|
74
|
-
tabStaveBox?: SvgBox;
|
|
75
|
-
tabElement?: SVGSVGElement;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Interface for a {@link TickMap} for each voice
|
|
79
|
-
* for formatting
|
|
80
|
-
* @category SmoObject
|
|
81
|
-
*/
|
|
82
|
-
export interface MeasureTickmaps {
|
|
83
|
-
tickmaps: TickMap[];
|
|
84
|
-
accidentalMap: Record<string | number, Record<string, TickAccidental>>;
|
|
85
|
-
accidentalArray: AccidentalArray[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Column-mapped modifiers, managed by the {@link SmoScore}
|
|
89
|
-
* @category SmoObject
|
|
90
|
-
*/
|
|
91
|
-
export interface ColumnMappedParams {
|
|
92
|
-
timeSignature: any;
|
|
93
|
-
keySignature: string;
|
|
94
|
-
tempo: any;
|
|
95
|
-
}
|
|
96
|
-
export type SmoMeasureNumberParam = 'transposeIndex' | 'activeVoice' | 'lines' | 'repeatCount';
|
|
97
|
-
export declare const SmoMeasureNumberParams: SmoMeasureNumberParam[];
|
|
98
|
-
export type SmoMeasureStringParam = 'keySignature';
|
|
99
|
-
export declare const SmoMeasureStringParams: SmoMeasureStringParam[];
|
|
100
|
-
/**
|
|
101
|
-
* constructor parameters for a {@link SmoMeasure}. Usually you will call
|
|
102
|
-
* {@link SmoMeasure.defaults}, and modify the parameters you need to change.
|
|
103
|
-
*
|
|
104
|
-
* @param timeSignature
|
|
105
|
-
* @param keySignature
|
|
106
|
-
* @param tuplets
|
|
107
|
-
* @param transposeIndex calculated from {@link SmoPartInfo} for non-concert-key instruments
|
|
108
|
-
* @param lines number of lines in the stave
|
|
109
|
-
* @param staffY Y coordinate (UL corner) of the measure stave
|
|
110
|
-
* @param measureNumber combination configured/calculated measure number
|
|
111
|
-
* @param clef
|
|
112
|
-
* @param voices
|
|
113
|
-
* @param activeVoice the active voice in the editor
|
|
114
|
-
* @param tempo
|
|
115
|
-
* @param format measure format, is managed by the score
|
|
116
|
-
* @param modifiers All measure modifiers that5 aren't format, timeSignature or tempo
|
|
117
|
-
* @category SmoObject
|
|
118
|
-
*/
|
|
119
|
-
export interface SmoMeasureParams {
|
|
120
|
-
timeSignature: TimeSignature;
|
|
121
|
-
keySignature: string;
|
|
122
|
-
tupletTrees: SmoTupletTree[];
|
|
123
|
-
transposeIndex: number;
|
|
124
|
-
lines: number;
|
|
125
|
-
measureNumber: MeasureNumber;
|
|
126
|
-
clef: Clef;
|
|
127
|
-
voices: SmoVoice[];
|
|
128
|
-
activeVoice: number;
|
|
129
|
-
tempo: SmoTempoText;
|
|
130
|
-
format: SmoMeasureFormat | null;
|
|
131
|
-
modifiers: SmoMeasureModifierBase[];
|
|
132
|
-
repeatSymbol: boolean;
|
|
133
|
-
repeatCount: number;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* The serializeable bits of SmoMeasure. Some parameters are
|
|
137
|
-
* mapped by the stave if the don't change every measure, e.g.
|
|
138
|
-
* time signature.
|
|
139
|
-
* @category serialization
|
|
140
|
-
*/
|
|
141
|
-
export interface SmoMeasureParamsSer {
|
|
142
|
-
/**
|
|
143
|
-
* constructor
|
|
144
|
-
*/
|
|
145
|
-
ctor: string;
|
|
146
|
-
/**
|
|
147
|
-
* a list of tuplets (serialized)
|
|
148
|
-
*/
|
|
149
|
-
tupletTrees: SmoTupletTreeParamsSer[];
|
|
150
|
-
/**
|
|
151
|
-
* transpose the notes up/down. TODO: this should not be serialized
|
|
152
|
-
* as its part of the instrument parameters
|
|
153
|
-
*/
|
|
154
|
-
transposeIndex: number;
|
|
155
|
-
/**
|
|
156
|
-
* lines in the staff (e.g. percussion)
|
|
157
|
-
*/
|
|
158
|
-
lines: number;
|
|
159
|
-
/**
|
|
160
|
-
* measure number, absolute and relative/remapped
|
|
161
|
-
*/
|
|
162
|
-
measureNumber: MeasureNumber;
|
|
163
|
-
/**
|
|
164
|
-
* start clef
|
|
165
|
-
*/
|
|
166
|
-
clef: Clef;
|
|
167
|
-
/**
|
|
168
|
-
* voices contain notes
|
|
169
|
-
*/
|
|
170
|
-
voices: SmoVoiceSer[];
|
|
171
|
-
/**
|
|
172
|
-
* all other modifiers (barlines, etc)
|
|
173
|
-
*/
|
|
174
|
-
modifiers: SmoMeasureModifierBase[];
|
|
175
|
-
/**
|
|
176
|
-
* key signature
|
|
177
|
-
*/
|
|
178
|
-
keySignature?: string;
|
|
179
|
-
/**
|
|
180
|
-
* time signature serialization
|
|
181
|
-
*/
|
|
182
|
-
timeSignature?: TimeSignatureParametersSer;
|
|
183
|
-
/**
|
|
184
|
-
* tempo at this point
|
|
185
|
-
*/
|
|
186
|
-
tempo: SmoTempoTextParamsSer;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Data for a measure of music. Many rules of musical engraving are
|
|
190
|
-
* enforced at a measure level: the duration of notes, accidentals, etc.
|
|
191
|
-
*
|
|
192
|
-
* Measures contain {@link SmoNote}, {@link SmoTuplet}, and {@link SmoBeamGroup}
|
|
193
|
-
* Measures are contained in {@link SmoSystemStaff}
|
|
194
|
-
* @category SmoObject
|
|
195
|
-
*/
|
|
196
|
-
export declare class SmoMeasure implements SmoMeasureParams, TickMappable {
|
|
197
|
-
static get timeSignatureDefault(): TimeSignature;
|
|
198
|
-
static defaultDupleDuration: number;
|
|
199
|
-
static defaultTripleDuration: number;
|
|
200
|
-
static readonly _defaults: SmoMeasureParams;
|
|
201
|
-
/**
|
|
202
|
-
* Default constructor parameters. Defaults are always copied so the
|
|
203
|
-
* caller can modify them to create a new measure.
|
|
204
|
-
* @returns constructor params for a new measure
|
|
205
|
-
*/
|
|
206
|
-
static get defaults(): SmoMeasureParams;
|
|
207
|
-
static convertLegacyTimeSignature(ts: string): TimeSignature;
|
|
208
|
-
timeSignature: TimeSignature;
|
|
209
|
-
/**
|
|
210
|
-
* Overrides display of actual time signature, in the case of
|
|
211
|
-
* pick-up notes where the actual and displayed durations are different
|
|
212
|
-
*/
|
|
213
|
-
keySignature: string;
|
|
214
|
-
canceledKeySignature: string;
|
|
215
|
-
tupletTrees: SmoTupletTree[];
|
|
216
|
-
repeatSymbol: boolean;
|
|
217
|
-
repeatCount: number;
|
|
218
|
-
ctor: string;
|
|
219
|
-
/**
|
|
220
|
-
* Adjust for non-concert pitch intstruments
|
|
221
|
-
*/
|
|
222
|
-
transposeIndex: number;
|
|
223
|
-
modifiers: SmoMeasureModifierBase[];
|
|
224
|
-
/**
|
|
225
|
-
* Row, column, and custom numbering information about this measure.
|
|
226
|
-
*/
|
|
227
|
-
measureNumber: MeasureNumber;
|
|
228
|
-
clef: Clef;
|
|
229
|
-
voices: SmoVoice[];
|
|
230
|
-
/**
|
|
231
|
-
* the active voice in the editor, if there are multiple voices
|
|
232
|
-
* */
|
|
233
|
-
activeVoice: number;
|
|
234
|
-
tempo: SmoTempoText;
|
|
235
|
-
beamGroups: ISmoBeamGroup[];
|
|
236
|
-
lines: number;
|
|
237
|
-
/**
|
|
238
|
-
* Runtime information about rendering
|
|
239
|
-
*/
|
|
240
|
-
svg: MeasureSvg;
|
|
241
|
-
/**
|
|
242
|
-
* Measure-specific formatting parameters.
|
|
243
|
-
*/
|
|
244
|
-
format: SmoMeasureFormat;
|
|
245
|
-
/**
|
|
246
|
-
* Information for identifying this object
|
|
247
|
-
*/
|
|
248
|
-
id: string;
|
|
249
|
-
/**
|
|
250
|
-
* Fill in components. We assume the modifiers are already constructed,
|
|
251
|
-
* e.g. by deserialize or the calling function.
|
|
252
|
-
* @param params
|
|
253
|
-
*/
|
|
254
|
-
constructor(params: SmoMeasureParams);
|
|
255
|
-
static get defaultAttributes(): string[];
|
|
256
|
-
static get formattingOptions(): string[];
|
|
257
|
-
static get columnMappedAttributes(): string[];
|
|
258
|
-
static get serializableAttributes(): any;
|
|
259
|
-
/**
|
|
260
|
-
// Return true if the time signatures are the same, for display purposes (e.g. if a time sig change
|
|
261
|
-
// is required)
|
|
262
|
-
*/
|
|
263
|
-
static timeSigEqual(o1: TimeSignature, o2: TimeSignature): boolean;
|
|
264
|
-
/**
|
|
265
|
-
* If there is a clef change mid-measure, update the actual clefs of the notes
|
|
266
|
-
* so they display correctly.
|
|
267
|
-
*/
|
|
268
|
-
updateClefChangeNotes(): void;
|
|
269
|
-
/**
|
|
270
|
-
* @internal
|
|
271
|
-
* @returns column mapped parameters, serialized. caller will
|
|
272
|
-
* decide if the parameters need to be persisted
|
|
273
|
-
*/
|
|
274
|
-
serializeColumnMapped(): ColumnMappedParams;
|
|
275
|
-
getColumnMapped(): ColumnMappedParams;
|
|
276
|
-
/**
|
|
277
|
-
* Convert this measure object to a JSON object, recursively serializing all the notes,
|
|
278
|
-
* note modifiers, etc.
|
|
279
|
-
*/
|
|
280
|
-
serialize(): SmoMeasureParamsSer;
|
|
281
|
-
/**
|
|
282
|
-
* Due to a bug, some tuplets have incorrect ticks. Fix it when we are deserializing the measure
|
|
283
|
-
* @param voices
|
|
284
|
-
* @param tupletTree
|
|
285
|
-
*/
|
|
286
|
-
static fixTupletLengths(voices: SmoVoice[], tupletTree: SmoTupletTree): void;
|
|
287
|
-
/**
|
|
288
|
-
* restore a serialized measure object. Usually called as part of deserializing a score,
|
|
289
|
-
* but can also be used to restore a measure due to an undo operation. Recursively
|
|
290
|
-
* deserialize all the notes and modifiers to construct a new measure.
|
|
291
|
-
* @param jsonObj the serialized SmoMeasure
|
|
292
|
-
* @returns
|
|
293
|
-
*/
|
|
294
|
-
static deserialize(jsonObj: SmoMeasureParamsSer): SmoMeasure;
|
|
295
|
-
static clone(measure: SmoMeasure): SmoMeasure;
|
|
296
|
-
static cloneForPasteOrUndo(measure: SmoMeasure): SmoMeasure;
|
|
297
|
-
hasNonRestNotes(): boolean;
|
|
298
|
-
/**
|
|
299
|
-
* When creating a new measure, the 'default' settings can vary depending on
|
|
300
|
-
* what comes before/after the measure. This determines the default pitch
|
|
301
|
-
* for a clef (appears on 3rd line)
|
|
302
|
-
*/
|
|
303
|
-
static get defaultPitchForClef(): Record<Clef, Pitch>;
|
|
304
|
-
static _emptyMeasureNoteType: NoteType;
|
|
305
|
-
static set emptyMeasureNoteType(tt: NoteType);
|
|
306
|
-
static get emptyMeasureNoteType(): NoteType;
|
|
307
|
-
static timeSignatureNotes(timeSignature: TimeSignature, clef: Clef): SmoNote[];
|
|
308
|
-
/**
|
|
309
|
-
* Get a measure full of default notes for a given timeSignature/clef.
|
|
310
|
-
* returns 8th notes for triple-time meters, etc.
|
|
311
|
-
* @param params
|
|
312
|
-
* @returns
|
|
313
|
-
*/
|
|
314
|
-
static getDefaultNotes(params: SmoMeasureParams): SmoNote[];
|
|
315
|
-
/**
|
|
316
|
-
* When creating a new measure, the 'default' settings can vary depending on
|
|
317
|
-
* what comes before/after the measure. This determines the defaults from the
|
|
318
|
-
* parameters that are passed in, which could be another measure in the score.
|
|
319
|
-
* This version returns params with no notes, for callers that want to use their own notes.
|
|
320
|
-
* If you want the default notes, see {@link getDefaultMeasureWithNotes}
|
|
321
|
-
*
|
|
322
|
-
* @param params
|
|
323
|
-
* @returns
|
|
324
|
-
*/
|
|
325
|
-
static getDefaultMeasure(params: SmoMeasureParams): SmoMeasure;
|
|
326
|
-
/**
|
|
327
|
-
* When creating a new measure, the 'default' settings can vary depending on
|
|
328
|
-
* what comes before/after the measure. This determines the defaults from the
|
|
329
|
-
* parameters that are passed in, which could be another measure in the score.
|
|
330
|
-
*
|
|
331
|
-
* @param params
|
|
332
|
-
* @returns
|
|
333
|
-
*/
|
|
334
|
-
static getDefaultMeasureWithNotes(params: SmoMeasureParams): SmoMeasure;
|
|
335
|
-
/**
|
|
336
|
-
* used by xml export
|
|
337
|
-
* @internal
|
|
338
|
-
* @param val
|
|
339
|
-
*/
|
|
340
|
-
getForceSystemBreak(): boolean;
|
|
341
|
-
setDefaultBarlines(): void;
|
|
342
|
-
get containsSound(): boolean;
|
|
343
|
-
/**
|
|
344
|
-
* The rendered width of the measure, or estimate of same
|
|
345
|
-
*/
|
|
346
|
-
get staffWidth(): number;
|
|
347
|
-
/**
|
|
348
|
-
* set the rendered width of the measure, or estimate of same
|
|
349
|
-
*/
|
|
350
|
-
setWidth(width: number, description: string): void;
|
|
351
|
-
/**
|
|
352
|
-
* Get rendered or estimated start x
|
|
353
|
-
*/
|
|
354
|
-
get staffX(): number;
|
|
355
|
-
/**
|
|
356
|
-
* Set rendered or estimated start x
|
|
357
|
-
*/
|
|
358
|
-
setX(x: number, description: string): void;
|
|
359
|
-
/**
|
|
360
|
-
* A time signature has possibly changed. add/remove notes to
|
|
361
|
-
* match the new length
|
|
362
|
-
*/
|
|
363
|
-
alignNotesWithTimeSignature(): true | undefined;
|
|
364
|
-
get measureNumberDbg(): string;
|
|
365
|
-
/**
|
|
366
|
-
* Get rendered or estimated start y
|
|
367
|
-
*/
|
|
368
|
-
get staffY(): number;
|
|
369
|
-
/**
|
|
370
|
-
* Set rendered or estimated start y
|
|
371
|
-
*/
|
|
372
|
-
setY(y: number, description: string): void;
|
|
373
|
-
/**
|
|
374
|
-
* Return actual or estimated highest point in score
|
|
375
|
-
*/
|
|
376
|
-
get yTop(): number;
|
|
377
|
-
/**
|
|
378
|
-
* return the lowest y (highest value) in this measure svg
|
|
379
|
-
*
|
|
380
|
-
* @readonly
|
|
381
|
-
*/
|
|
382
|
-
get lowestY(): number;
|
|
383
|
-
/**
|
|
384
|
-
* adjust the y for the render boxes to account for the page and margins
|
|
385
|
-
*/
|
|
386
|
-
adjustY(yOffset: number): void;
|
|
387
|
-
/**
|
|
388
|
-
* WHen setting an instrument, offset the pitches to match the instrument key
|
|
389
|
-
* @param offset
|
|
390
|
-
* @param newClef
|
|
391
|
-
*/
|
|
392
|
-
transposeToOffset(offset: number, targetKey: string, newClef?: Clef): void;
|
|
393
|
-
/**
|
|
394
|
-
* Return actual or estimated highest point in score
|
|
395
|
-
*/
|
|
396
|
-
setYTop(y: number, description: string): void;
|
|
397
|
-
/**
|
|
398
|
-
* Return actual or estimated bounding box
|
|
399
|
-
*/
|
|
400
|
-
setBox(box: SvgBox, description: string): void;
|
|
401
|
-
/**
|
|
402
|
-
* @returns the DOM identifier for this measure when rendered
|
|
403
|
-
*/
|
|
404
|
-
getClassId(): string;
|
|
405
|
-
/**
|
|
406
|
-
*
|
|
407
|
-
* @param id
|
|
408
|
-
* @returns
|
|
409
|
-
*/
|
|
410
|
-
getRenderedNote(id: string): {
|
|
411
|
-
smoNote: SmoNote;
|
|
412
|
-
voice: number;
|
|
413
|
-
tick: number;
|
|
414
|
-
} | null;
|
|
415
|
-
getNotes(): SmoNote[];
|
|
416
|
-
getActiveVoice(): number;
|
|
417
|
-
setActiveVoice(vix: number): void;
|
|
418
|
-
getSwapVoicePairs(): number[][];
|
|
419
|
-
swapVoices(voice1: number, voice2: number): void;
|
|
420
|
-
tickmapForVoice(voiceIx: number): TickMap;
|
|
421
|
-
createMeasureTickmaps(): MeasureTickmaps;
|
|
422
|
-
static createRestNoteWithDuration(duration: number, clef: Clef): SmoNote;
|
|
423
|
-
/**
|
|
424
|
-
* Count the number of ticks in each voice and return max
|
|
425
|
-
* @returns
|
|
426
|
-
*/
|
|
427
|
-
getMaxTicksVoice(): number;
|
|
428
|
-
/**
|
|
429
|
-
* For pasting, paste into the target measure if the voice exists, else paste into
|
|
430
|
-
* voice 0
|
|
431
|
-
* @param voiceIndex
|
|
432
|
-
* @returns
|
|
433
|
-
*/
|
|
434
|
-
getTicksFromThisOrAnyVoice(voiceIndex: number): number;
|
|
435
|
-
/**
|
|
436
|
-
* Count the number of ticks in a specific voice
|
|
437
|
-
* @param voiceIndex
|
|
438
|
-
* @returns
|
|
439
|
-
*/
|
|
440
|
-
getTicksFromVoice(voiceIndex: number): number;
|
|
441
|
-
/**
|
|
442
|
-
* Count all the ticks up to the provided tickIndex
|
|
443
|
-
* @param voiceIndex
|
|
444
|
-
* @param tickIndex
|
|
445
|
-
*/
|
|
446
|
-
getNotePositionInTicks(voiceIndex: number, tickIndex: number): number;
|
|
447
|
-
/**
|
|
448
|
-
* Count all the ticks up to the provided tickIndex
|
|
449
|
-
* @param voiceIndex
|
|
450
|
-
* @param tickIndex
|
|
451
|
-
*/
|
|
452
|
-
getTickCountForNote(voiceIndex: number, note: SmoNote): number;
|
|
453
|
-
getClosestIndexFromTickCount(voiceIndex: number, tickCount: number): number;
|
|
454
|
-
isPickup(): boolean;
|
|
455
|
-
clearBeamGroups(): void;
|
|
456
|
-
setLyricFont(fontInfo: FontInfo): void;
|
|
457
|
-
setLyricAdjustWidth(adjustNoteWidth: boolean): void;
|
|
458
|
-
setChordAdjustWidth(adjustNoteWidth: boolean): void;
|
|
459
|
-
setChordFont(fontInfo: FontInfo): void;
|
|
460
|
-
tupletNotes(smoTuplet: SmoTuplet): SmoNote[];
|
|
461
|
-
getStemDirectionForTuplet(smoTuplet: SmoTuplet): number;
|
|
462
|
-
getNoteById(id: string): SmoNote | null;
|
|
463
|
-
setClef(clef: Clef): void;
|
|
464
|
-
/**
|
|
465
|
-
* Get the clef that this measure ends with.
|
|
466
|
-
* @returns
|
|
467
|
-
*/
|
|
468
|
-
getLastClef(): Clef;
|
|
469
|
-
isRest(): boolean;
|
|
470
|
-
populateVoice(index: number): void;
|
|
471
|
-
private _removeSingletonModifier;
|
|
472
|
-
addRehearsalMark(parameters: SmoRehearsalMarkParams): void;
|
|
473
|
-
removeRehearsalMark(): void;
|
|
474
|
-
getRehearsalMark(): SmoMeasureModifierBase | undefined;
|
|
475
|
-
getModifiersByType(type: string): SmoMeasureModifierBase[];
|
|
476
|
-
setTempo(params: SmoTempoTextParams): void;
|
|
477
|
-
/**
|
|
478
|
-
* Set measure tempo to the default {@link SmoTempoText}
|
|
479
|
-
*/
|
|
480
|
-
resetTempo(): void;
|
|
481
|
-
getTempo(): SmoTempoText;
|
|
482
|
-
/**
|
|
483
|
-
* Measure text is deprecated, and may not be supported in the future.
|
|
484
|
-
* Better to use SmoTextGroup and attach to the measure.
|
|
485
|
-
* @param mod
|
|
486
|
-
* @returns
|
|
487
|
-
*/
|
|
488
|
-
addMeasureText(mod: SmoMeasureModifierBase): void;
|
|
489
|
-
getMeasureText(): SmoMeasureModifierBase[];
|
|
490
|
-
removeMeasureText(id: string): void;
|
|
491
|
-
setRepeatSymbol(rs: SmoRepeatSymbol): void;
|
|
492
|
-
getRepeatSymbol(): SmoRepeatSymbol | null;
|
|
493
|
-
get isToDc(): boolean;
|
|
494
|
-
get isToDs(): boolean;
|
|
495
|
-
get isSegno(): boolean;
|
|
496
|
-
get isCoda(): boolean;
|
|
497
|
-
get isToCoda(): boolean;
|
|
498
|
-
get isFine(): boolean;
|
|
499
|
-
clearRepeatSymbols(): void;
|
|
500
|
-
setBarline(barline: SmoBarline): void;
|
|
501
|
-
private _getBarline;
|
|
502
|
-
getEndBarline(): SmoBarline;
|
|
503
|
-
getStartBarline(): SmoBarline;
|
|
504
|
-
addNthEnding(ending: SmoVolta): void;
|
|
505
|
-
removeNthEnding(ending: SmoVolta): void;
|
|
506
|
-
getNthEndings(): SmoVolta[];
|
|
507
|
-
setKeySignature(sig: string): void;
|
|
508
|
-
setMeasureNumber(num: MeasureNumber): void;
|
|
509
|
-
getBeamGroupForNote(note: SmoNote): ISmoBeamGroup | null;
|
|
510
|
-
}
|
|
1
|
+
import { SmoBarline, SmoMeasureModifierBase, SmoRepeatSymbol, SmoTempoText, SmoMeasureFormat, SmoVolta, SmoRehearsalMarkParams, SmoTempoTextParams, TimeSignature, TimeSignatureParametersSer, SmoTempoTextParamsSer } from './measureModifiers';
|
|
2
|
+
import { SmoNote, NoteType, SmoNoteParamsSer } from './note';
|
|
3
|
+
import { SmoTuplet, SmoTupletTreeParamsSer, SmoTupletTree } from './tuplet';
|
|
4
|
+
import { TickMap } from '../xform/tickMap';
|
|
5
|
+
import { MeasureNumber, SvgBox, SmoAttrs, Pitch, Clef, TickAccidental, AccidentalArray } from './common';
|
|
6
|
+
import { FontInfo } from '../../common/vex';
|
|
7
|
+
/**
|
|
8
|
+
* Voice is just a container for {@link SmoNote}
|
|
9
|
+
* @category SmoObject
|
|
10
|
+
*/
|
|
11
|
+
export interface SmoVoice {
|
|
12
|
+
notes: SmoNote[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @category SmoObject
|
|
16
|
+
*/
|
|
17
|
+
export interface SmoVoiceSer {
|
|
18
|
+
notes: SmoNoteParamsSer[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* TickMappable breaks up a circular dependency on modifiers
|
|
22
|
+
* like @SmoDuration
|
|
23
|
+
* @category SmoObject
|
|
24
|
+
*/
|
|
25
|
+
export interface TickMappable {
|
|
26
|
+
voices: SmoVoice[];
|
|
27
|
+
keySignature: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @category SmoObject
|
|
31
|
+
*/
|
|
32
|
+
export interface MeasureTick {
|
|
33
|
+
voiceIndex: number;
|
|
34
|
+
tickIndex: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Break up a circlar dependency with {@link SmoBeamGroup}
|
|
38
|
+
* @category SmoObject
|
|
39
|
+
*/
|
|
40
|
+
export interface ISmoBeamGroup {
|
|
41
|
+
notes: SmoNote[];
|
|
42
|
+
secondaryBeamBreaks: number[];
|
|
43
|
+
voice: number;
|
|
44
|
+
attrs: SmoAttrs;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* geometry information about the current measure for rendering and
|
|
48
|
+
* score layout.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export interface MeasureSvg {
|
|
52
|
+
staffWidth: number;
|
|
53
|
+
unjustifiedWidth: number;
|
|
54
|
+
adjX: number;
|
|
55
|
+
maxColumnStartX: number;
|
|
56
|
+
staffX: number;
|
|
57
|
+
staffY: number;
|
|
58
|
+
logicalBox: SvgBox;
|
|
59
|
+
yTop: number;
|
|
60
|
+
adjRight: number;
|
|
61
|
+
history: string[];
|
|
62
|
+
lineIndex: number;
|
|
63
|
+
pageIndex: number;
|
|
64
|
+
rowInSystem: number;
|
|
65
|
+
forceClef: boolean;
|
|
66
|
+
forceKeySignature: boolean;
|
|
67
|
+
forceTimeSignature: boolean;
|
|
68
|
+
forceTempo: boolean;
|
|
69
|
+
hideEmptyMeasure: boolean;
|
|
70
|
+
hideMultimeasure: boolean;
|
|
71
|
+
multimeasureLength: number;
|
|
72
|
+
multimeasureEndBarline: number;
|
|
73
|
+
element: SVGSVGElement | null;
|
|
74
|
+
tabStaveBox?: SvgBox;
|
|
75
|
+
tabElement?: SVGSVGElement;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Interface for a {@link TickMap} for each voice
|
|
79
|
+
* for formatting
|
|
80
|
+
* @category SmoObject
|
|
81
|
+
*/
|
|
82
|
+
export interface MeasureTickmaps {
|
|
83
|
+
tickmaps: TickMap[];
|
|
84
|
+
accidentalMap: Record<string | number, Record<string, TickAccidental>>;
|
|
85
|
+
accidentalArray: AccidentalArray[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Column-mapped modifiers, managed by the {@link SmoScore}
|
|
89
|
+
* @category SmoObject
|
|
90
|
+
*/
|
|
91
|
+
export interface ColumnMappedParams {
|
|
92
|
+
timeSignature: any;
|
|
93
|
+
keySignature: string;
|
|
94
|
+
tempo: any;
|
|
95
|
+
}
|
|
96
|
+
export type SmoMeasureNumberParam = 'transposeIndex' | 'activeVoice' | 'lines' | 'repeatCount';
|
|
97
|
+
export declare const SmoMeasureNumberParams: SmoMeasureNumberParam[];
|
|
98
|
+
export type SmoMeasureStringParam = 'keySignature';
|
|
99
|
+
export declare const SmoMeasureStringParams: SmoMeasureStringParam[];
|
|
100
|
+
/**
|
|
101
|
+
* constructor parameters for a {@link SmoMeasure}. Usually you will call
|
|
102
|
+
* {@link SmoMeasure.defaults}, and modify the parameters you need to change.
|
|
103
|
+
*
|
|
104
|
+
* @param timeSignature
|
|
105
|
+
* @param keySignature
|
|
106
|
+
* @param tuplets
|
|
107
|
+
* @param transposeIndex calculated from {@link SmoPartInfo} for non-concert-key instruments
|
|
108
|
+
* @param lines number of lines in the stave
|
|
109
|
+
* @param staffY Y coordinate (UL corner) of the measure stave
|
|
110
|
+
* @param measureNumber combination configured/calculated measure number
|
|
111
|
+
* @param clef
|
|
112
|
+
* @param voices
|
|
113
|
+
* @param activeVoice the active voice in the editor
|
|
114
|
+
* @param tempo
|
|
115
|
+
* @param format measure format, is managed by the score
|
|
116
|
+
* @param modifiers All measure modifiers that5 aren't format, timeSignature or tempo
|
|
117
|
+
* @category SmoObject
|
|
118
|
+
*/
|
|
119
|
+
export interface SmoMeasureParams {
|
|
120
|
+
timeSignature: TimeSignature;
|
|
121
|
+
keySignature: string;
|
|
122
|
+
tupletTrees: SmoTupletTree[];
|
|
123
|
+
transposeIndex: number;
|
|
124
|
+
lines: number;
|
|
125
|
+
measureNumber: MeasureNumber;
|
|
126
|
+
clef: Clef;
|
|
127
|
+
voices: SmoVoice[];
|
|
128
|
+
activeVoice: number;
|
|
129
|
+
tempo: SmoTempoText;
|
|
130
|
+
format: SmoMeasureFormat | null;
|
|
131
|
+
modifiers: SmoMeasureModifierBase[];
|
|
132
|
+
repeatSymbol: boolean;
|
|
133
|
+
repeatCount: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The serializeable bits of SmoMeasure. Some parameters are
|
|
137
|
+
* mapped by the stave if the don't change every measure, e.g.
|
|
138
|
+
* time signature.
|
|
139
|
+
* @category serialization
|
|
140
|
+
*/
|
|
141
|
+
export interface SmoMeasureParamsSer {
|
|
142
|
+
/**
|
|
143
|
+
* constructor
|
|
144
|
+
*/
|
|
145
|
+
ctor: string;
|
|
146
|
+
/**
|
|
147
|
+
* a list of tuplets (serialized)
|
|
148
|
+
*/
|
|
149
|
+
tupletTrees: SmoTupletTreeParamsSer[];
|
|
150
|
+
/**
|
|
151
|
+
* transpose the notes up/down. TODO: this should not be serialized
|
|
152
|
+
* as its part of the instrument parameters
|
|
153
|
+
*/
|
|
154
|
+
transposeIndex: number;
|
|
155
|
+
/**
|
|
156
|
+
* lines in the staff (e.g. percussion)
|
|
157
|
+
*/
|
|
158
|
+
lines: number;
|
|
159
|
+
/**
|
|
160
|
+
* measure number, absolute and relative/remapped
|
|
161
|
+
*/
|
|
162
|
+
measureNumber: MeasureNumber;
|
|
163
|
+
/**
|
|
164
|
+
* start clef
|
|
165
|
+
*/
|
|
166
|
+
clef: Clef;
|
|
167
|
+
/**
|
|
168
|
+
* voices contain notes
|
|
169
|
+
*/
|
|
170
|
+
voices: SmoVoiceSer[];
|
|
171
|
+
/**
|
|
172
|
+
* all other modifiers (barlines, etc)
|
|
173
|
+
*/
|
|
174
|
+
modifiers: SmoMeasureModifierBase[];
|
|
175
|
+
/**
|
|
176
|
+
* key signature
|
|
177
|
+
*/
|
|
178
|
+
keySignature?: string;
|
|
179
|
+
/**
|
|
180
|
+
* time signature serialization
|
|
181
|
+
*/
|
|
182
|
+
timeSignature?: TimeSignatureParametersSer;
|
|
183
|
+
/**
|
|
184
|
+
* tempo at this point
|
|
185
|
+
*/
|
|
186
|
+
tempo: SmoTempoTextParamsSer;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Data for a measure of music. Many rules of musical engraving are
|
|
190
|
+
* enforced at a measure level: the duration of notes, accidentals, etc.
|
|
191
|
+
*
|
|
192
|
+
* Measures contain {@link SmoNote}, {@link SmoTuplet}, and {@link SmoBeamGroup}
|
|
193
|
+
* Measures are contained in {@link SmoSystemStaff}
|
|
194
|
+
* @category SmoObject
|
|
195
|
+
*/
|
|
196
|
+
export declare class SmoMeasure implements SmoMeasureParams, TickMappable {
|
|
197
|
+
static get timeSignatureDefault(): TimeSignature;
|
|
198
|
+
static defaultDupleDuration: number;
|
|
199
|
+
static defaultTripleDuration: number;
|
|
200
|
+
static readonly _defaults: SmoMeasureParams;
|
|
201
|
+
/**
|
|
202
|
+
* Default constructor parameters. Defaults are always copied so the
|
|
203
|
+
* caller can modify them to create a new measure.
|
|
204
|
+
* @returns constructor params for a new measure
|
|
205
|
+
*/
|
|
206
|
+
static get defaults(): SmoMeasureParams;
|
|
207
|
+
static convertLegacyTimeSignature(ts: string): TimeSignature;
|
|
208
|
+
timeSignature: TimeSignature;
|
|
209
|
+
/**
|
|
210
|
+
* Overrides display of actual time signature, in the case of
|
|
211
|
+
* pick-up notes where the actual and displayed durations are different
|
|
212
|
+
*/
|
|
213
|
+
keySignature: string;
|
|
214
|
+
canceledKeySignature: string;
|
|
215
|
+
tupletTrees: SmoTupletTree[];
|
|
216
|
+
repeatSymbol: boolean;
|
|
217
|
+
repeatCount: number;
|
|
218
|
+
ctor: string;
|
|
219
|
+
/**
|
|
220
|
+
* Adjust for non-concert pitch intstruments
|
|
221
|
+
*/
|
|
222
|
+
transposeIndex: number;
|
|
223
|
+
modifiers: SmoMeasureModifierBase[];
|
|
224
|
+
/**
|
|
225
|
+
* Row, column, and custom numbering information about this measure.
|
|
226
|
+
*/
|
|
227
|
+
measureNumber: MeasureNumber;
|
|
228
|
+
clef: Clef;
|
|
229
|
+
voices: SmoVoice[];
|
|
230
|
+
/**
|
|
231
|
+
* the active voice in the editor, if there are multiple voices
|
|
232
|
+
* */
|
|
233
|
+
activeVoice: number;
|
|
234
|
+
tempo: SmoTempoText;
|
|
235
|
+
beamGroups: ISmoBeamGroup[];
|
|
236
|
+
lines: number;
|
|
237
|
+
/**
|
|
238
|
+
* Runtime information about rendering
|
|
239
|
+
*/
|
|
240
|
+
svg: MeasureSvg;
|
|
241
|
+
/**
|
|
242
|
+
* Measure-specific formatting parameters.
|
|
243
|
+
*/
|
|
244
|
+
format: SmoMeasureFormat;
|
|
245
|
+
/**
|
|
246
|
+
* Information for identifying this object
|
|
247
|
+
*/
|
|
248
|
+
id: string;
|
|
249
|
+
/**
|
|
250
|
+
* Fill in components. We assume the modifiers are already constructed,
|
|
251
|
+
* e.g. by deserialize or the calling function.
|
|
252
|
+
* @param params
|
|
253
|
+
*/
|
|
254
|
+
constructor(params: SmoMeasureParams);
|
|
255
|
+
static get defaultAttributes(): string[];
|
|
256
|
+
static get formattingOptions(): string[];
|
|
257
|
+
static get columnMappedAttributes(): string[];
|
|
258
|
+
static get serializableAttributes(): any;
|
|
259
|
+
/**
|
|
260
|
+
// Return true if the time signatures are the same, for display purposes (e.g. if a time sig change
|
|
261
|
+
// is required)
|
|
262
|
+
*/
|
|
263
|
+
static timeSigEqual(o1: TimeSignature, o2: TimeSignature): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* If there is a clef change mid-measure, update the actual clefs of the notes
|
|
266
|
+
* so they display correctly.
|
|
267
|
+
*/
|
|
268
|
+
updateClefChangeNotes(): void;
|
|
269
|
+
/**
|
|
270
|
+
* @internal
|
|
271
|
+
* @returns column mapped parameters, serialized. caller will
|
|
272
|
+
* decide if the parameters need to be persisted
|
|
273
|
+
*/
|
|
274
|
+
serializeColumnMapped(): ColumnMappedParams;
|
|
275
|
+
getColumnMapped(): ColumnMappedParams;
|
|
276
|
+
/**
|
|
277
|
+
* Convert this measure object to a JSON object, recursively serializing all the notes,
|
|
278
|
+
* note modifiers, etc.
|
|
279
|
+
*/
|
|
280
|
+
serialize(): SmoMeasureParamsSer;
|
|
281
|
+
/**
|
|
282
|
+
* Due to a bug, some tuplets have incorrect ticks. Fix it when we are deserializing the measure
|
|
283
|
+
* @param voices
|
|
284
|
+
* @param tupletTree
|
|
285
|
+
*/
|
|
286
|
+
static fixTupletLengths(voices: SmoVoice[], tupletTree: SmoTupletTree): void;
|
|
287
|
+
/**
|
|
288
|
+
* restore a serialized measure object. Usually called as part of deserializing a score,
|
|
289
|
+
* but can also be used to restore a measure due to an undo operation. Recursively
|
|
290
|
+
* deserialize all the notes and modifiers to construct a new measure.
|
|
291
|
+
* @param jsonObj the serialized SmoMeasure
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
static deserialize(jsonObj: SmoMeasureParamsSer): SmoMeasure;
|
|
295
|
+
static clone(measure: SmoMeasure): SmoMeasure;
|
|
296
|
+
static cloneForPasteOrUndo(measure: SmoMeasure): SmoMeasure;
|
|
297
|
+
hasNonRestNotes(): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* When creating a new measure, the 'default' settings can vary depending on
|
|
300
|
+
* what comes before/after the measure. This determines the default pitch
|
|
301
|
+
* for a clef (appears on 3rd line)
|
|
302
|
+
*/
|
|
303
|
+
static get defaultPitchForClef(): Record<Clef, Pitch>;
|
|
304
|
+
static _emptyMeasureNoteType: NoteType;
|
|
305
|
+
static set emptyMeasureNoteType(tt: NoteType);
|
|
306
|
+
static get emptyMeasureNoteType(): NoteType;
|
|
307
|
+
static timeSignatureNotes(timeSignature: TimeSignature, clef: Clef): SmoNote[];
|
|
308
|
+
/**
|
|
309
|
+
* Get a measure full of default notes for a given timeSignature/clef.
|
|
310
|
+
* returns 8th notes for triple-time meters, etc.
|
|
311
|
+
* @param params
|
|
312
|
+
* @returns
|
|
313
|
+
*/
|
|
314
|
+
static getDefaultNotes(params: SmoMeasureParams): SmoNote[];
|
|
315
|
+
/**
|
|
316
|
+
* When creating a new measure, the 'default' settings can vary depending on
|
|
317
|
+
* what comes before/after the measure. This determines the defaults from the
|
|
318
|
+
* parameters that are passed in, which could be another measure in the score.
|
|
319
|
+
* This version returns params with no notes, for callers that want to use their own notes.
|
|
320
|
+
* If you want the default notes, see {@link getDefaultMeasureWithNotes}
|
|
321
|
+
*
|
|
322
|
+
* @param params
|
|
323
|
+
* @returns
|
|
324
|
+
*/
|
|
325
|
+
static getDefaultMeasure(params: SmoMeasureParams): SmoMeasure;
|
|
326
|
+
/**
|
|
327
|
+
* When creating a new measure, the 'default' settings can vary depending on
|
|
328
|
+
* what comes before/after the measure. This determines the defaults from the
|
|
329
|
+
* parameters that are passed in, which could be another measure in the score.
|
|
330
|
+
*
|
|
331
|
+
* @param params
|
|
332
|
+
* @returns
|
|
333
|
+
*/
|
|
334
|
+
static getDefaultMeasureWithNotes(params: SmoMeasureParams): SmoMeasure;
|
|
335
|
+
/**
|
|
336
|
+
* used by xml export
|
|
337
|
+
* @internal
|
|
338
|
+
* @param val
|
|
339
|
+
*/
|
|
340
|
+
getForceSystemBreak(): boolean;
|
|
341
|
+
setDefaultBarlines(): void;
|
|
342
|
+
get containsSound(): boolean;
|
|
343
|
+
/**
|
|
344
|
+
* The rendered width of the measure, or estimate of same
|
|
345
|
+
*/
|
|
346
|
+
get staffWidth(): number;
|
|
347
|
+
/**
|
|
348
|
+
* set the rendered width of the measure, or estimate of same
|
|
349
|
+
*/
|
|
350
|
+
setWidth(width: number, description: string): void;
|
|
351
|
+
/**
|
|
352
|
+
* Get rendered or estimated start x
|
|
353
|
+
*/
|
|
354
|
+
get staffX(): number;
|
|
355
|
+
/**
|
|
356
|
+
* Set rendered or estimated start x
|
|
357
|
+
*/
|
|
358
|
+
setX(x: number, description: string): void;
|
|
359
|
+
/**
|
|
360
|
+
* A time signature has possibly changed. add/remove notes to
|
|
361
|
+
* match the new length
|
|
362
|
+
*/
|
|
363
|
+
alignNotesWithTimeSignature(): true | undefined;
|
|
364
|
+
get measureNumberDbg(): string;
|
|
365
|
+
/**
|
|
366
|
+
* Get rendered or estimated start y
|
|
367
|
+
*/
|
|
368
|
+
get staffY(): number;
|
|
369
|
+
/**
|
|
370
|
+
* Set rendered or estimated start y
|
|
371
|
+
*/
|
|
372
|
+
setY(y: number, description: string): void;
|
|
373
|
+
/**
|
|
374
|
+
* Return actual or estimated highest point in score
|
|
375
|
+
*/
|
|
376
|
+
get yTop(): number;
|
|
377
|
+
/**
|
|
378
|
+
* return the lowest y (highest value) in this measure svg
|
|
379
|
+
*
|
|
380
|
+
* @readonly
|
|
381
|
+
*/
|
|
382
|
+
get lowestY(): number;
|
|
383
|
+
/**
|
|
384
|
+
* adjust the y for the render boxes to account for the page and margins
|
|
385
|
+
*/
|
|
386
|
+
adjustY(yOffset: number): void;
|
|
387
|
+
/**
|
|
388
|
+
* WHen setting an instrument, offset the pitches to match the instrument key
|
|
389
|
+
* @param offset
|
|
390
|
+
* @param newClef
|
|
391
|
+
*/
|
|
392
|
+
transposeToOffset(offset: number, targetKey: string, newClef?: Clef): void;
|
|
393
|
+
/**
|
|
394
|
+
* Return actual or estimated highest point in score
|
|
395
|
+
*/
|
|
396
|
+
setYTop(y: number, description: string): void;
|
|
397
|
+
/**
|
|
398
|
+
* Return actual or estimated bounding box
|
|
399
|
+
*/
|
|
400
|
+
setBox(box: SvgBox, description: string): void;
|
|
401
|
+
/**
|
|
402
|
+
* @returns the DOM identifier for this measure when rendered
|
|
403
|
+
*/
|
|
404
|
+
getClassId(): string;
|
|
405
|
+
/**
|
|
406
|
+
*
|
|
407
|
+
* @param id
|
|
408
|
+
* @returns
|
|
409
|
+
*/
|
|
410
|
+
getRenderedNote(id: string): {
|
|
411
|
+
smoNote: SmoNote;
|
|
412
|
+
voice: number;
|
|
413
|
+
tick: number;
|
|
414
|
+
} | null;
|
|
415
|
+
getNotes(): SmoNote[];
|
|
416
|
+
getActiveVoice(): number;
|
|
417
|
+
setActiveVoice(vix: number): void;
|
|
418
|
+
getSwapVoicePairs(): number[][];
|
|
419
|
+
swapVoices(voice1: number, voice2: number): void;
|
|
420
|
+
tickmapForVoice(voiceIx: number): TickMap;
|
|
421
|
+
createMeasureTickmaps(): MeasureTickmaps;
|
|
422
|
+
static createRestNoteWithDuration(duration: number, clef: Clef): SmoNote;
|
|
423
|
+
/**
|
|
424
|
+
* Count the number of ticks in each voice and return max
|
|
425
|
+
* @returns
|
|
426
|
+
*/
|
|
427
|
+
getMaxTicksVoice(): number;
|
|
428
|
+
/**
|
|
429
|
+
* For pasting, paste into the target measure if the voice exists, else paste into
|
|
430
|
+
* voice 0
|
|
431
|
+
* @param voiceIndex
|
|
432
|
+
* @returns
|
|
433
|
+
*/
|
|
434
|
+
getTicksFromThisOrAnyVoice(voiceIndex: number): number;
|
|
435
|
+
/**
|
|
436
|
+
* Count the number of ticks in a specific voice
|
|
437
|
+
* @param voiceIndex
|
|
438
|
+
* @returns
|
|
439
|
+
*/
|
|
440
|
+
getTicksFromVoice(voiceIndex: number): number;
|
|
441
|
+
/**
|
|
442
|
+
* Count all the ticks up to the provided tickIndex
|
|
443
|
+
* @param voiceIndex
|
|
444
|
+
* @param tickIndex
|
|
445
|
+
*/
|
|
446
|
+
getNotePositionInTicks(voiceIndex: number, tickIndex: number): number;
|
|
447
|
+
/**
|
|
448
|
+
* Count all the ticks up to the provided tickIndex
|
|
449
|
+
* @param voiceIndex
|
|
450
|
+
* @param tickIndex
|
|
451
|
+
*/
|
|
452
|
+
getTickCountForNote(voiceIndex: number, note: SmoNote): number;
|
|
453
|
+
getClosestIndexFromTickCount(voiceIndex: number, tickCount: number): number;
|
|
454
|
+
isPickup(): boolean;
|
|
455
|
+
clearBeamGroups(): void;
|
|
456
|
+
setLyricFont(fontInfo: FontInfo): void;
|
|
457
|
+
setLyricAdjustWidth(adjustNoteWidth: boolean): void;
|
|
458
|
+
setChordAdjustWidth(adjustNoteWidth: boolean): void;
|
|
459
|
+
setChordFont(fontInfo: FontInfo): void;
|
|
460
|
+
tupletNotes(smoTuplet: SmoTuplet): SmoNote[];
|
|
461
|
+
getStemDirectionForTuplet(smoTuplet: SmoTuplet): number;
|
|
462
|
+
getNoteById(id: string): SmoNote | null;
|
|
463
|
+
setClef(clef: Clef): void;
|
|
464
|
+
/**
|
|
465
|
+
* Get the clef that this measure ends with.
|
|
466
|
+
* @returns
|
|
467
|
+
*/
|
|
468
|
+
getLastClef(): Clef;
|
|
469
|
+
isRest(): boolean;
|
|
470
|
+
populateVoice(index: number): void;
|
|
471
|
+
private _removeSingletonModifier;
|
|
472
|
+
addRehearsalMark(parameters: SmoRehearsalMarkParams): void;
|
|
473
|
+
removeRehearsalMark(): void;
|
|
474
|
+
getRehearsalMark(): SmoMeasureModifierBase | undefined;
|
|
475
|
+
getModifiersByType(type: string): SmoMeasureModifierBase[];
|
|
476
|
+
setTempo(params: SmoTempoTextParams): void;
|
|
477
|
+
/**
|
|
478
|
+
* Set measure tempo to the default {@link SmoTempoText}
|
|
479
|
+
*/
|
|
480
|
+
resetTempo(): void;
|
|
481
|
+
getTempo(): SmoTempoText;
|
|
482
|
+
/**
|
|
483
|
+
* Measure text is deprecated, and may not be supported in the future.
|
|
484
|
+
* Better to use SmoTextGroup and attach to the measure.
|
|
485
|
+
* @param mod
|
|
486
|
+
* @returns
|
|
487
|
+
*/
|
|
488
|
+
addMeasureText(mod: SmoMeasureModifierBase): void;
|
|
489
|
+
getMeasureText(): SmoMeasureModifierBase[];
|
|
490
|
+
removeMeasureText(id: string): void;
|
|
491
|
+
setRepeatSymbol(rs: SmoRepeatSymbol): void;
|
|
492
|
+
getRepeatSymbol(): SmoRepeatSymbol | null;
|
|
493
|
+
get isToDc(): boolean;
|
|
494
|
+
get isToDs(): boolean;
|
|
495
|
+
get isSegno(): boolean;
|
|
496
|
+
get isCoda(): boolean;
|
|
497
|
+
get isToCoda(): boolean;
|
|
498
|
+
get isFine(): boolean;
|
|
499
|
+
clearRepeatSymbols(): void;
|
|
500
|
+
setBarline(barline: SmoBarline): void;
|
|
501
|
+
private _getBarline;
|
|
502
|
+
getEndBarline(): SmoBarline;
|
|
503
|
+
getStartBarline(): SmoBarline;
|
|
504
|
+
addNthEnding(ending: SmoVolta): void;
|
|
505
|
+
removeNthEnding(ending: SmoVolta): void;
|
|
506
|
+
getNthEndings(): SmoVolta[];
|
|
507
|
+
setKeySignature(sig: string): void;
|
|
508
|
+
setMeasureNumber(num: MeasureNumber): void;
|
|
509
|
+
getBeamGroupForNote(note: SmoNote): ISmoBeamGroup | null;
|
|
510
|
+
}
|