@mcqj/vexflow 0.0.1-alpha.1
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/LICENSE +22 -0
- package/README.md +208 -0
- package/build/cjs/vexflow-bravura.js +2 -0
- package/build/cjs/vexflow-bravura.js.map +1 -0
- package/build/cjs/vexflow-core.js +2 -0
- package/build/cjs/vexflow-core.js.map +1 -0
- package/build/cjs/vexflow-debug-with-tests.js +43475 -0
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -0
- package/build/cjs/vexflow-debug.js +19194 -0
- package/build/cjs/vexflow-debug.js.map +1 -0
- package/build/cjs/vexflow.js +2 -0
- package/build/cjs/vexflow.js.map +1 -0
- package/build/esm/entry/vexflow-bravura.js +17 -0
- package/build/esm/entry/vexflow-core.js +4 -0
- package/build/esm/entry/vexflow-debug-with-tests.js +38 -0
- package/build/esm/entry/vexflow-debug.js +31 -0
- package/build/esm/entry/vexflow.js +31 -0
- package/build/esm/package.json +3 -0
- package/build/esm/src/accidental.js +330 -0
- package/build/esm/src/annotation.js +231 -0
- package/build/esm/src/articulation.js +281 -0
- package/build/esm/src/barnote.js +56 -0
- package/build/esm/src/beam.js +644 -0
- package/build/esm/src/bend.js +186 -0
- package/build/esm/src/boundingbox.js +59 -0
- package/build/esm/src/canvascontext.js +216 -0
- package/build/esm/src/chordsymbol.js +325 -0
- package/build/esm/src/clef.js +120 -0
- package/build/esm/src/clefnote.js +35 -0
- package/build/esm/src/crescendo.js +78 -0
- package/build/esm/src/curve.js +126 -0
- package/build/esm/src/dot.js +129 -0
- package/build/esm/src/easyscore.js +374 -0
- package/build/esm/src/element.js +409 -0
- package/build/esm/src/factory.js +463 -0
- package/build/esm/src/flag.js +22 -0
- package/build/esm/src/font.js +237 -0
- package/build/esm/src/fonts/academico.js +1 -0
- package/build/esm/src/fonts/academicobold.js +1 -0
- package/build/esm/src/fonts/bravura.js +1 -0
- package/build/esm/src/fonts/gonville.js +1 -0
- package/build/esm/src/fonts/petaluma.js +1 -0
- package/build/esm/src/fonts/petalumascript.js +1 -0
- package/build/esm/src/formatter.js +610 -0
- package/build/esm/src/fraction.js +170 -0
- package/build/esm/src/frethandfinger.js +141 -0
- package/build/esm/src/ghostnote.js +50 -0
- package/build/esm/src/glyphnote.js +44 -0
- package/build/esm/src/glyphs.js +2936 -0
- package/build/esm/src/gracenote.js +106 -0
- package/build/esm/src/gracenotegroup.js +138 -0
- package/build/esm/src/gracetabnote.js +11 -0
- package/build/esm/src/index.js +86 -0
- package/build/esm/src/keymanager.js +99 -0
- package/build/esm/src/keysignature.js +220 -0
- package/build/esm/src/keysignote.js +28 -0
- package/build/esm/src/metrics.js +237 -0
- package/build/esm/src/modifier.js +121 -0
- package/build/esm/src/modifiercontext.js +110 -0
- package/build/esm/src/multimeasurerest.js +127 -0
- package/build/esm/src/music.js +322 -0
- package/build/esm/src/note.js +383 -0
- package/build/esm/src/notehead.js +89 -0
- package/build/esm/src/notesubgroup.js +59 -0
- package/build/esm/src/ornament.js +192 -0
- package/build/esm/src/parenthesis.js +61 -0
- package/build/esm/src/parser.js +164 -0
- package/build/esm/src/pedalmarking.js +168 -0
- package/build/esm/src/registry.js +81 -0
- package/build/esm/src/rendercontext.js +20 -0
- package/build/esm/src/renderer.js +112 -0
- package/build/esm/src/repeatnote.js +17 -0
- package/build/esm/src/stave.js +579 -0
- package/build/esm/src/stavebarline.js +237 -0
- package/build/esm/src/staveconnector.js +180 -0
- package/build/esm/src/stavehairpin.js +115 -0
- package/build/esm/src/staveline.js +199 -0
- package/build/esm/src/stavemodifier.js +56 -0
- package/build/esm/src/stavenote.js +861 -0
- package/build/esm/src/staverepetition.js +120 -0
- package/build/esm/src/stavesection.js +36 -0
- package/build/esm/src/stavetempo.js +110 -0
- package/build/esm/src/stavetext.js +55 -0
- package/build/esm/src/stavetie.js +186 -0
- package/build/esm/src/stavevolta.js +53 -0
- package/build/esm/src/stem.js +133 -0
- package/build/esm/src/stemmablenote.js +193 -0
- package/build/esm/src/stringnumber.js +228 -0
- package/build/esm/src/strokes.js +164 -0
- package/build/esm/src/svgcontext.js +402 -0
- package/build/esm/src/system.js +166 -0
- package/build/esm/src/tables.js +696 -0
- package/build/esm/src/tabnote.js +278 -0
- package/build/esm/src/tabslide.js +68 -0
- package/build/esm/src/tabstave.js +17 -0
- package/build/esm/src/tabtie.js +19 -0
- package/build/esm/src/textbracket.js +128 -0
- package/build/esm/src/textdynamics.js +53 -0
- package/build/esm/src/textnote.js +116 -0
- package/build/esm/src/tickable.js +224 -0
- package/build/esm/src/tickcontext.js +189 -0
- package/build/esm/src/timesignature.js +169 -0
- package/build/esm/src/timesignote.js +30 -0
- package/build/esm/src/tremolo.js +30 -0
- package/build/esm/src/tuning.js +55 -0
- package/build/esm/src/tuplet.js +258 -0
- package/build/esm/src/typeguard.js +30 -0
- package/build/esm/src/util.js +67 -0
- package/build/esm/src/version.js +3 -0
- package/build/esm/src/vexflow.js +309 -0
- package/build/esm/src/vibrato.js +68 -0
- package/build/esm/src/vibratobracket.js +44 -0
- package/build/esm/src/voice.js +178 -0
- package/build/esm/src/web.js +15 -0
- package/build/esm/tests/accidental_tests.js +1055 -0
- package/build/esm/tests/annotation_tests.js +381 -0
- package/build/esm/tests/articulation_tests.js +432 -0
- package/build/esm/tests/auto_beam_formatting_tests.js +551 -0
- package/build/esm/tests/barline_tests.js +52 -0
- package/build/esm/tests/beam_tests.js +669 -0
- package/build/esm/tests/bend_tests.js +223 -0
- package/build/esm/tests/boundingbox_tests.js +53 -0
- package/build/esm/tests/browser_test_runner.js +128 -0
- package/build/esm/tests/chordsymbol_tests.js +405 -0
- package/build/esm/tests/clef_tests.js +141 -0
- package/build/esm/tests/crossbeam_tests.js +306 -0
- package/build/esm/tests/curve_tests.js +152 -0
- package/build/esm/tests/demo_petzold_tests.js +335 -0
- package/build/esm/tests/dot_tests.js +119 -0
- package/build/esm/tests/easyscore_tests.js +488 -0
- package/build/esm/tests/factory_tests.js +44 -0
- package/build/esm/tests/font_tests.js +134 -0
- package/build/esm/tests/formatter/framestack.js +61 -0
- package/build/esm/tests/formatter/tests.js +251 -0
- package/build/esm/tests/formatter_tests.js +759 -0
- package/build/esm/tests/fraction_tests.js +72 -0
- package/build/esm/tests/ghostnote_tests.js +77 -0
- package/build/esm/tests/glyphnote_tests.js +119 -0
- package/build/esm/tests/gracenote_tests.js +414 -0
- package/build/esm/tests/gracetabnote_tests.js +79 -0
- package/build/esm/tests/index.js +68 -0
- package/build/esm/tests/key_clef_tests.js +106 -0
- package/build/esm/tests/keymanager_tests.js +68 -0
- package/build/esm/tests/keysignature_tests.js +322 -0
- package/build/esm/tests/mocks.js +70 -0
- package/build/esm/tests/modifier_tests.js +24 -0
- package/build/esm/tests/multimeasurerest_tests.js +141 -0
- package/build/esm/tests/music_tests.js +161 -0
- package/build/esm/tests/node_test_runner.js +31 -0
- package/build/esm/tests/notehead_tests.js +224 -0
- package/build/esm/tests/notesubgroup_tests.js +149 -0
- package/build/esm/tests/offscreencanvas_tests.js +47 -0
- package/build/esm/tests/ornament_tests.js +333 -0
- package/build/esm/tests/parser_tests.js +122 -0
- package/build/esm/tests/pedalmarking_tests.js +91 -0
- package/build/esm/tests/percussion_tests.js +184 -0
- package/build/esm/tests/playwright/flow.spec.js +127 -0
- package/build/esm/tests/playwright/visual_helpers.js +30 -0
- package/build/esm/tests/registry_tests.js +64 -0
- package/build/esm/tests/renderer_tests.js +113 -0
- package/build/esm/tests/rests_tests.js +266 -0
- package/build/esm/tests/rhythm_tests.js +357 -0
- package/build/esm/tests/stave_tests.js +570 -0
- package/build/esm/tests/staveconnector_tests.js +402 -0
- package/build/esm/tests/stavehairpin_tests.js +90 -0
- package/build/esm/tests/staveline_tests.js +123 -0
- package/build/esm/tests/stavemodifier_tests.js +51 -0
- package/build/esm/tests/stavenote_tests.js +936 -0
- package/build/esm/tests/stavetie_tests.js +137 -0
- package/build/esm/tests/stringnumber_tests.js +283 -0
- package/build/esm/tests/strokes_tests.js +289 -0
- package/build/esm/tests/style_tests.js +96 -0
- package/build/esm/tests/tabnote_tests.js +462 -0
- package/build/esm/tests/tabslide_tests.js +133 -0
- package/build/esm/tests/tabstave_tests.js +24 -0
- package/build/esm/tests/tabtie_tests.js +171 -0
- package/build/esm/tests/test_runner.js +23 -0
- package/build/esm/tests/textbracket_tests.js +100 -0
- package/build/esm/tests/textnote_tests.js +216 -0
- package/build/esm/tests/threevoice_tests.js +132 -0
- package/build/esm/tests/tickcontext_tests.js +36 -0
- package/build/esm/tests/timesignature_tests.js +173 -0
- package/build/esm/tests/tremolo_tests.js +34 -0
- package/build/esm/tests/tuning_tests.js +56 -0
- package/build/esm/tests/tuplet_tests.js +711 -0
- package/build/esm/tests/typeguard_tests.js +82 -0
- package/build/esm/tests/unison_tests.js +74 -0
- package/build/esm/tests/vexflow_test_helpers.js +318 -0
- package/build/esm/tests/vf_prefix_tests.js +101 -0
- package/build/esm/tests/vibrato_tests.js +93 -0
- package/build/esm/tests/vibratobracket_tests.js +45 -0
- package/build/esm/tests/vitest/job-0.test.js +2 -0
- package/build/esm/tests/vitest/job-1.test.js +2 -0
- package/build/esm/tests/vitest/job-2.test.js +2 -0
- package/build/esm/tests/vitest/job-3.test.js +2 -0
- package/build/esm/tests/vitest/run.js +5 -0
- package/build/esm/tests/vitest.setup.js +44 -0
- package/build/esm/tests/voice_tests.js +69 -0
- package/build/types/entry/vexflow-bravura.d.ts +3 -0
- package/build/types/entry/vexflow-core.d.ts +3 -0
- package/build/types/entry/vexflow-debug.d.ts +3 -0
- package/build/types/entry/vexflow.d.ts +3 -0
- package/build/types/src/accidental.d.ts +60 -0
- package/build/types/src/annotation.d.ts +58 -0
- package/build/types/src/articulation.d.ts +78 -0
- package/build/types/src/barnote.d.ts +29 -0
- package/build/types/src/beam.d.ts +158 -0
- package/build/types/src/bend.d.ts +67 -0
- package/build/types/src/boundingbox.d.ts +42 -0
- package/build/types/src/canvascontext.d.ts +93 -0
- package/build/types/src/chordsymbol.d.ts +109 -0
- package/build/types/src/clef.d.ts +38 -0
- package/build/types/src/clefnote.d.ts +17 -0
- package/build/types/src/crescendo.d.ts +26 -0
- package/build/types/src/curve.d.ts +42 -0
- package/build/types/src/dot.d.ts +19 -0
- package/build/types/src/easyscore.d.ts +152 -0
- package/build/types/src/element.d.ts +278 -0
- package/build/types/src/factory.d.ts +273 -0
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/font.d.ts +96 -0
- package/build/types/src/fonts/academico.d.ts +1 -0
- package/build/types/src/fonts/academicobold.d.ts +1 -0
- package/build/types/src/fonts/bravura.d.ts +1 -0
- package/build/types/src/fonts/gonville.d.ts +1 -0
- package/build/types/src/fonts/petaluma.d.ts +1 -0
- package/build/types/src/fonts/petalumascript.d.ts +1 -0
- package/build/types/src/formatter.d.ts +226 -0
- package/build/types/src/fraction.d.ts +65 -0
- package/build/types/src/frethandfinger.d.ts +19 -0
- package/build/types/src/ghostnote.d.ts +16 -0
- package/build/types/src/glyphnote.d.ts +14 -0
- package/build/types/src/glyphs.d.ts +2935 -0
- package/build/types/src/gracenote.d.ts +17 -0
- package/build/types/src/gracenotegroup.d.ts +33 -0
- package/build/types/src/gracetabnote.d.ts +5 -0
- package/build/types/src/index.d.ts +86 -0
- package/build/types/src/keymanager.d.ts +25 -0
- package/build/types/src/keysignature.d.ts +50 -0
- package/build/types/src/keysignote.d.ts +11 -0
- package/build/types/src/metrics.d.ts +25 -0
- package/build/types/src/modifier.d.ts +90 -0
- package/build/types/src/modifiercontext.d.ts +48 -0
- package/build/types/src/multimeasurerest.d.ts +61 -0
- package/build/types/src/music.d.ts +91 -0
- package/build/types/src/note.d.ts +232 -0
- package/build/types/src/notehead.d.ts +50 -0
- package/build/types/src/notesubgroup.d.ts +18 -0
- package/build/types/src/ornament.d.ts +71 -0
- package/build/types/src/parenthesis.d.ts +21 -0
- package/build/types/src/parser.d.ts +45 -0
- package/build/types/src/pedalmarking.d.ts +63 -0
- package/build/types/src/registry.d.ts +40 -0
- package/build/types/src/rendercontext.d.ts +59 -0
- package/build/types/src/renderer.d.ts +35 -0
- package/build/types/src/repeatnote.d.ts +6 -0
- package/build/types/src/stave.d.ts +181 -0
- package/build/types/src/stavebarline.d.ts +38 -0
- package/build/types/src/staveconnector.d.ts +53 -0
- package/build/types/src/stavehairpin.d.ts +56 -0
- package/build/types/src/staveline.d.ts +49 -0
- package/build/types/src/stavemodifier.d.ts +35 -0
- package/build/types/src/stavenote.d.ts +150 -0
- package/build/types/src/staverepetition.d.ts +30 -0
- package/build/types/src/stavesection.d.ts +8 -0
- package/build/types/src/stavetempo.d.ts +43 -0
- package/build/types/src/stavetext.d.ts +11 -0
- package/build/types/src/stavetie.d.ts +104 -0
- package/build/types/src/stavevolta.d.ts +15 -0
- package/build/types/src/stem.d.ts +58 -0
- package/build/types/src/stemmablenote.d.ts +39 -0
- package/build/types/src/stringnumber.d.ts +26 -0
- package/build/types/src/strokes.d.ts +35 -0
- package/build/types/src/svgcontext.d.ts +135 -0
- package/build/types/src/system.d.ts +121 -0
- package/build/types/src/tables.d.ts +86 -0
- package/build/types/src/tabnote.d.ts +45 -0
- package/build/types/src/tabslide.d.ts +36 -0
- package/build/types/src/tabstave.d.ts +7 -0
- package/build/types/src/tabtie.d.ts +18 -0
- package/build/types/src/textbracket.d.ts +45 -0
- package/build/types/src/textdynamics.d.ts +34 -0
- package/build/types/src/textnote.d.ts +48 -0
- package/build/types/src/tickable.d.ts +149 -0
- package/build/types/src/tickcontext.d.ts +112 -0
- package/build/types/src/timesignature.d.ts +75 -0
- package/build/types/src/timesignote.d.ts +11 -0
- package/build/types/src/tremolo.d.ts +12 -0
- package/build/types/src/tuning.d.ts +23 -0
- package/build/types/src/tuplet.d.ts +98 -0
- package/build/types/src/typeguard.d.ts +100 -0
- package/build/types/src/util.d.ts +42 -0
- package/build/types/src/version.d.ts +3 -0
- package/build/types/src/vexflow.d.ts +261 -0
- package/build/types/src/vibrato.d.ts +20 -0
- package/build/types/src/vibratobracket.d.ts +28 -0
- package/build/types/src/voice.d.ts +109 -0
- package/build/types/src/web.d.ts +2 -0
- package/package.json +145 -0
- package/tests/flow.html +256 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Accidental } from './accidental';
|
|
2
|
+
import { Annotation } from './annotation';
|
|
3
|
+
import { Dot } from './dot';
|
|
4
|
+
import { GraceNote } from './gracenote';
|
|
5
|
+
import { GraceNoteGroup } from './gracenotegroup';
|
|
6
|
+
import { Note } from './note';
|
|
7
|
+
import { RenderContext } from './rendercontext';
|
|
8
|
+
import { Barline } from './stavebarline';
|
|
9
|
+
import { StaveNote } from './stavenote';
|
|
10
|
+
import { StemmableNote } from './stemmablenote';
|
|
11
|
+
import { TabNote } from './tabnote';
|
|
12
|
+
/**
|
|
13
|
+
* Use instead of `instanceof` as a more flexible type guard.
|
|
14
|
+
* @param obj check if this object's CATEGORY matches the provided category.
|
|
15
|
+
* @param category a string representing a category of VexFlow objects.
|
|
16
|
+
* @param checkAncestors defaults to `true`, so we walk up the prototype chain to look for a matching `CATEGORY`.
|
|
17
|
+
* If `false`, we do not check the superclass or other ancestors.
|
|
18
|
+
* @returns true if `obj` has a static `CATEGORY` property that matches `category`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isCategory<T>(obj: any, category: string, checkAncestors?: boolean): obj is T;
|
|
21
|
+
export declare const isAccidental: (obj: unknown) => obj is Accidental;
|
|
22
|
+
export declare const isAnnotation: (obj: unknown) => obj is Annotation;
|
|
23
|
+
export declare const isBarline: (obj: unknown) => obj is Barline;
|
|
24
|
+
export declare const isDot: (obj: unknown) => obj is Dot;
|
|
25
|
+
export declare const isGraceNote: (obj: unknown) => obj is GraceNote;
|
|
26
|
+
export declare const isGraceNoteGroup: (obj: unknown) => obj is GraceNoteGroup;
|
|
27
|
+
export declare const isNote: (obj: unknown) => obj is Note;
|
|
28
|
+
export declare const isRenderContext: (obj: unknown) => obj is RenderContext;
|
|
29
|
+
export declare const isStaveNote: (obj: unknown) => obj is StaveNote;
|
|
30
|
+
export declare const isStemmableNote: (obj: unknown) => obj is StemmableNote;
|
|
31
|
+
export declare const isTabNote: (obj: unknown) => obj is TabNote;
|
|
32
|
+
export declare const enum Category {
|
|
33
|
+
Accidental = "Accidental",
|
|
34
|
+
Annotation = "Annotation",
|
|
35
|
+
Articulation = "Articulation",
|
|
36
|
+
Barline = "Barline",
|
|
37
|
+
BarNote = "BarNote",
|
|
38
|
+
Beam = "Beam",
|
|
39
|
+
Bend = "Bend",
|
|
40
|
+
ChordSymbol = "ChordSymbol",
|
|
41
|
+
Clef = "Clef",
|
|
42
|
+
ClefNote = "ClefNote",
|
|
43
|
+
Crescendo = "Crescendo",
|
|
44
|
+
Curve = "Curve",
|
|
45
|
+
Dot = "Dot",
|
|
46
|
+
Element = "Element",
|
|
47
|
+
Flag = "Flag",
|
|
48
|
+
Fraction = "Fraction",
|
|
49
|
+
FretHandFinger = "FretHandFinger",
|
|
50
|
+
GhostNote = "GhostNote",
|
|
51
|
+
Glyph = "Glyph",
|
|
52
|
+
GlyphNote = "GlyphNote",
|
|
53
|
+
GraceNote = "GraceNote",
|
|
54
|
+
GraceNoteGroup = "GraceNoteGroup",
|
|
55
|
+
GraceTabNote = "GraceTabNote",
|
|
56
|
+
KeySignature = "KeySignature",
|
|
57
|
+
KeySigNote = "KeySigNote",
|
|
58
|
+
Modifier = "Modifier",
|
|
59
|
+
MultiMeasureRest = "MultiMeasureRest",
|
|
60
|
+
Note = "Note",
|
|
61
|
+
NoteHead = "NoteHead",
|
|
62
|
+
NoteSubGroup = "NoteSubGroup",
|
|
63
|
+
Ornament = "Ornament",
|
|
64
|
+
Parenthesis = "Parenthesis",
|
|
65
|
+
PedalMarking = "PedalMarking",
|
|
66
|
+
RenderContext = "RenderContext",
|
|
67
|
+
RepeatNote = "RepeatNote",
|
|
68
|
+
Repetition = "Repetition",
|
|
69
|
+
Stave = "Stave",
|
|
70
|
+
StaveConnector = "StaveConnector",
|
|
71
|
+
StaveHairpin = "StaveHairpin",
|
|
72
|
+
StaveLine = "StaveLine",
|
|
73
|
+
StaveModifier = "StaveModifier",
|
|
74
|
+
StaveNote = "StaveNote",
|
|
75
|
+
StaveSection = "StaveSection",
|
|
76
|
+
StaveTempo = "StaveTempo",
|
|
77
|
+
StaveText = "StaveText",
|
|
78
|
+
StaveTie = "StaveTie",
|
|
79
|
+
Stem = "Stem",
|
|
80
|
+
StemmableNote = "StemmableNote",
|
|
81
|
+
StringNumber = "StringNumber",
|
|
82
|
+
Stroke = "Stroke",
|
|
83
|
+
System = "System",
|
|
84
|
+
TabNote = "TabNote",
|
|
85
|
+
TabSlide = "TabSlide",
|
|
86
|
+
TabStave = "TabStave",
|
|
87
|
+
TabTie = "TabTie",
|
|
88
|
+
TextBracket = "TextBracket",
|
|
89
|
+
TextDynamics = "TextDynamics",
|
|
90
|
+
TextNote = "TextNote",
|
|
91
|
+
Tickable = "Tickable",
|
|
92
|
+
TimeSignature = "TimeSignature",
|
|
93
|
+
TimeSigNote = "TimeSigNote",
|
|
94
|
+
Tremolo = "Tremolo",
|
|
95
|
+
Tuplet = "Tuplet",
|
|
96
|
+
Vibrato = "Vibrato",
|
|
97
|
+
VibratoBracket = "VibratoBracket",
|
|
98
|
+
Voice = "Voice",
|
|
99
|
+
Volta = "Volta"
|
|
100
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const structuredClone: typeof globalThis.structuredClone;
|
|
2
|
+
/** `RuntimeError` will be thrown by VexFlow classes in case of error. */
|
|
3
|
+
export declare class RuntimeError extends Error {
|
|
4
|
+
code: string;
|
|
5
|
+
constructor(code: string, message?: string);
|
|
6
|
+
}
|
|
7
|
+
/** VexFlow can be used outside of the browser (e.g., Node) where `window` may not be defined. */
|
|
8
|
+
export declare function globalObject(): typeof globalThis & any;
|
|
9
|
+
/**
|
|
10
|
+
* Check that `x` is of type `T` and not `undefined`.
|
|
11
|
+
* If `x` is `undefined`, throw a RuntimeError with the optionally provided error code and message.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defined<T>(x?: T, code?: string, message?: string): T;
|
|
14
|
+
/** Default log function sends all arguments to console. */
|
|
15
|
+
export declare function log(block: string, ...args: any[]): void;
|
|
16
|
+
/** Dump warning to console. */
|
|
17
|
+
export declare function warn(...args: any[]): void;
|
|
18
|
+
/** Locate the mid point between stave lines. Returns a fractional line if a space. */
|
|
19
|
+
export declare function midLine(a: number, b: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Used by various classes (e.g., SVGContext) to provide a
|
|
22
|
+
* unique prefix to element names (or other keys in shared namespaces).
|
|
23
|
+
*/
|
|
24
|
+
export declare function prefix(text: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* @param s
|
|
27
|
+
* @returns `s` with the first letter capitalized.
|
|
28
|
+
*/
|
|
29
|
+
export declare function upperFirst(s?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Convert an arbitrary angle in radians to the equivalent one in the range [0, pi).
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeAngle(a: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Return the sum of an array of numbers.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sumArray(arr: number[]): number;
|
|
38
|
+
/**
|
|
39
|
+
* Take `arr` and return a new array consisting of the sorted, unique'd,
|
|
40
|
+
* contents of arr. Does not modify `arr`.
|
|
41
|
+
*/
|
|
42
|
+
/** Benchmark. Run function `f` once and report time elapsed shifted by `s` milliseconds. */
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Accidental } from './accidental';
|
|
2
|
+
import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } from './annotation';
|
|
3
|
+
import { Articulation } from './articulation';
|
|
4
|
+
import { BarNote } from './barnote';
|
|
5
|
+
import { Beam } from './beam';
|
|
6
|
+
import { Bend } from './bend';
|
|
7
|
+
import { BoundingBox } from './boundingbox';
|
|
8
|
+
import { CanvasContext } from './canvascontext';
|
|
9
|
+
import { ChordSymbol, ChordSymbolHorizontalJustify, ChordSymbolVerticalJustify, SymbolModifiers } from './chordsymbol';
|
|
10
|
+
import { Clef } from './clef';
|
|
11
|
+
import { ClefNote } from './clefnote';
|
|
12
|
+
import { Crescendo } from './crescendo';
|
|
13
|
+
import { Curve, CurvePosition } from './curve';
|
|
14
|
+
import { Dot } from './dot';
|
|
15
|
+
import { EasyScore } from './easyscore';
|
|
16
|
+
import { Element } from './element';
|
|
17
|
+
import { Factory } from './factory';
|
|
18
|
+
import { Font, FontStyle, FontWeight } from './font';
|
|
19
|
+
import { Formatter } from './formatter';
|
|
20
|
+
import { Fraction } from './fraction';
|
|
21
|
+
import { FretHandFinger } from './frethandfinger';
|
|
22
|
+
import { GhostNote } from './ghostnote';
|
|
23
|
+
import { GlyphNote } from './glyphnote';
|
|
24
|
+
import { Glyphs } from './glyphs';
|
|
25
|
+
import { GraceNote } from './gracenote';
|
|
26
|
+
import { GraceNoteGroup } from './gracenotegroup';
|
|
27
|
+
import { GraceTabNote } from './gracetabnote';
|
|
28
|
+
import { KeyManager } from './keymanager';
|
|
29
|
+
import { KeySignature } from './keysignature';
|
|
30
|
+
import { KeySigNote } from './keysignote';
|
|
31
|
+
import { Modifier, ModifierPosition } from './modifier';
|
|
32
|
+
import { ModifierContext } from './modifiercontext';
|
|
33
|
+
import { MultiMeasureRest } from './multimeasurerest';
|
|
34
|
+
import { Music } from './music';
|
|
35
|
+
import { Note } from './note';
|
|
36
|
+
import { NoteHead } from './notehead';
|
|
37
|
+
import { NoteSubGroup } from './notesubgroup';
|
|
38
|
+
import { Ornament } from './ornament';
|
|
39
|
+
import { Parenthesis } from './parenthesis';
|
|
40
|
+
import { Parser } from './parser';
|
|
41
|
+
import { PedalMarking } from './pedalmarking';
|
|
42
|
+
import { Registry } from './registry';
|
|
43
|
+
import { RenderContext } from './rendercontext';
|
|
44
|
+
import { Renderer, RendererBackends, RendererLineEndType } from './renderer';
|
|
45
|
+
import { RepeatNote } from './repeatnote';
|
|
46
|
+
import { Stave } from './stave';
|
|
47
|
+
import { Barline, BarlineType, RepeatBracketType } from './stavebarline';
|
|
48
|
+
import { StaveConnector } from './staveconnector';
|
|
49
|
+
import { StaveHairpin } from './stavehairpin';
|
|
50
|
+
import { StaveLine } from './staveline';
|
|
51
|
+
import { StaveModifier, StaveModifierPosition } from './stavemodifier';
|
|
52
|
+
import { StaveNote } from './stavenote';
|
|
53
|
+
import { Repetition } from './staverepetition';
|
|
54
|
+
import { StaveTempo } from './stavetempo';
|
|
55
|
+
import { StaveText } from './stavetext';
|
|
56
|
+
import { StaveTie } from './stavetie';
|
|
57
|
+
import { Volta, VoltaType } from './stavevolta';
|
|
58
|
+
import { Stem } from './stem';
|
|
59
|
+
import { StringNumber } from './stringnumber';
|
|
60
|
+
import { Stroke } from './strokes';
|
|
61
|
+
import { SVGContext } from './svgcontext';
|
|
62
|
+
import { System } from './system';
|
|
63
|
+
import { TabNote } from './tabnote';
|
|
64
|
+
import { TabSlide } from './tabslide';
|
|
65
|
+
import { TabStave } from './tabstave';
|
|
66
|
+
import { TabTie } from './tabtie';
|
|
67
|
+
import { TextBracket, TextBracketPosition } from './textbracket';
|
|
68
|
+
import { TextDynamics } from './textdynamics';
|
|
69
|
+
import { TextJustification, TextNote } from './textnote';
|
|
70
|
+
import { TickContext } from './tickcontext';
|
|
71
|
+
import { TimeSignature } from './timesignature';
|
|
72
|
+
import { TimeSigNote } from './timesignote';
|
|
73
|
+
import { Tremolo } from './tremolo';
|
|
74
|
+
import { Tuning } from './tuning';
|
|
75
|
+
import { Tuplet } from './tuplet';
|
|
76
|
+
import { RuntimeError } from './util';
|
|
77
|
+
import { Vibrato } from './vibrato';
|
|
78
|
+
import { VibratoBracket } from './vibratobracket';
|
|
79
|
+
import { Voice, VoiceMode, VoiceTime } from './voice';
|
|
80
|
+
export declare class VexFlow {
|
|
81
|
+
static BUILD: {
|
|
82
|
+
VERSION: string;
|
|
83
|
+
ID: string;
|
|
84
|
+
DATE: string;
|
|
85
|
+
INFO: string;
|
|
86
|
+
};
|
|
87
|
+
static Accidental: typeof Accidental;
|
|
88
|
+
static Annotation: typeof Annotation;
|
|
89
|
+
static Articulation: typeof Articulation;
|
|
90
|
+
static Barline: typeof Barline;
|
|
91
|
+
static BarNote: typeof BarNote;
|
|
92
|
+
static Beam: typeof Beam;
|
|
93
|
+
static Bend: typeof Bend;
|
|
94
|
+
static BoundingBox: typeof BoundingBox;
|
|
95
|
+
static CanvasContext: typeof CanvasContext;
|
|
96
|
+
static ChordSymbol: typeof ChordSymbol;
|
|
97
|
+
static Clef: typeof Clef;
|
|
98
|
+
static ClefNote: typeof ClefNote;
|
|
99
|
+
static Crescendo: typeof Crescendo;
|
|
100
|
+
static Curve: typeof Curve;
|
|
101
|
+
static Dot: typeof Dot;
|
|
102
|
+
static EasyScore: typeof EasyScore;
|
|
103
|
+
static Element: typeof Element;
|
|
104
|
+
static Factory: typeof Factory;
|
|
105
|
+
static Font: typeof Font;
|
|
106
|
+
static Formatter: typeof Formatter;
|
|
107
|
+
static Fraction: typeof Fraction;
|
|
108
|
+
static FretHandFinger: typeof FretHandFinger;
|
|
109
|
+
static GhostNote: typeof GhostNote;
|
|
110
|
+
static GlyphNote: typeof GlyphNote;
|
|
111
|
+
static GraceNote: typeof GraceNote;
|
|
112
|
+
static GraceNoteGroup: typeof GraceNoteGroup;
|
|
113
|
+
static GraceTabNote: typeof GraceTabNote;
|
|
114
|
+
static KeyManager: typeof KeyManager;
|
|
115
|
+
static KeySignature: typeof KeySignature;
|
|
116
|
+
static KeySigNote: typeof KeySigNote;
|
|
117
|
+
static Modifier: typeof Modifier;
|
|
118
|
+
static ModifierContext: typeof ModifierContext;
|
|
119
|
+
static MultiMeasureRest: typeof MultiMeasureRest;
|
|
120
|
+
static Music: typeof Music;
|
|
121
|
+
static Note: typeof Note;
|
|
122
|
+
static NoteHead: typeof NoteHead;
|
|
123
|
+
static NoteSubGroup: typeof NoteSubGroup;
|
|
124
|
+
static Ornament: typeof Ornament;
|
|
125
|
+
static Parenthesis: typeof Parenthesis;
|
|
126
|
+
static Parser: typeof Parser;
|
|
127
|
+
static PedalMarking: typeof PedalMarking;
|
|
128
|
+
static Registry: typeof Registry;
|
|
129
|
+
static RenderContext: typeof RenderContext;
|
|
130
|
+
static Renderer: typeof Renderer;
|
|
131
|
+
static RepeatNote: typeof RepeatNote;
|
|
132
|
+
static Repetition: typeof Repetition;
|
|
133
|
+
static Stave: typeof Stave;
|
|
134
|
+
static StaveConnector: typeof StaveConnector;
|
|
135
|
+
static StaveHairpin: typeof StaveHairpin;
|
|
136
|
+
static StaveLine: typeof StaveLine;
|
|
137
|
+
static StaveModifier: typeof StaveModifier;
|
|
138
|
+
static StaveNote: typeof StaveNote;
|
|
139
|
+
static StaveTempo: typeof StaveTempo;
|
|
140
|
+
static StaveText: typeof StaveText;
|
|
141
|
+
static StaveTie: typeof StaveTie;
|
|
142
|
+
static Stem: typeof Stem;
|
|
143
|
+
static StringNumber: typeof StringNumber;
|
|
144
|
+
static Stroke: typeof Stroke;
|
|
145
|
+
static SVGContext: typeof SVGContext;
|
|
146
|
+
static System: typeof System;
|
|
147
|
+
static TabNote: typeof TabNote;
|
|
148
|
+
static TabSlide: typeof TabSlide;
|
|
149
|
+
static TabStave: typeof TabStave;
|
|
150
|
+
static TabTie: typeof TabTie;
|
|
151
|
+
static TextBracket: typeof TextBracket;
|
|
152
|
+
static TextDynamics: typeof TextDynamics;
|
|
153
|
+
static TextNote: typeof TextNote;
|
|
154
|
+
static TickContext: typeof TickContext;
|
|
155
|
+
static TimeSignature: typeof TimeSignature;
|
|
156
|
+
static TimeSigNote: typeof TimeSigNote;
|
|
157
|
+
static Tremolo: typeof Tremolo;
|
|
158
|
+
static Tuning: typeof Tuning;
|
|
159
|
+
static Tuplet: typeof Tuplet;
|
|
160
|
+
static Vibrato: typeof Vibrato;
|
|
161
|
+
static VibratoBracket: typeof VibratoBracket;
|
|
162
|
+
static Voice: typeof Voice;
|
|
163
|
+
static Volta: typeof Volta;
|
|
164
|
+
static RuntimeError: typeof RuntimeError;
|
|
165
|
+
static Test: undefined;
|
|
166
|
+
static AnnotationHorizontalJustify: typeof AnnotationHorizontalJustify;
|
|
167
|
+
static AnnotationVerticalJustify: typeof AnnotationVerticalJustify;
|
|
168
|
+
static ChordSymbolHorizontalJustify: typeof ChordSymbolHorizontalJustify;
|
|
169
|
+
static ChordSymbolVerticalJustify: typeof ChordSymbolVerticalJustify;
|
|
170
|
+
static SymbolModifiers: typeof SymbolModifiers;
|
|
171
|
+
static CurvePosition: typeof CurvePosition;
|
|
172
|
+
static FontWeight: typeof FontWeight;
|
|
173
|
+
static FontStyle: typeof FontStyle;
|
|
174
|
+
static Glyphs: typeof Glyphs;
|
|
175
|
+
static ModifierPosition: typeof ModifierPosition;
|
|
176
|
+
static RendererBackends: typeof RendererBackends;
|
|
177
|
+
static RendererLineEndType: typeof RendererLineEndType;
|
|
178
|
+
static BarlineType: typeof BarlineType;
|
|
179
|
+
static RepeatBracketType: typeof RepeatBracketType;
|
|
180
|
+
static StaveModifierPosition: typeof StaveModifierPosition;
|
|
181
|
+
static VoltaType: typeof VoltaType;
|
|
182
|
+
static TextBracketPosition: typeof TextBracketPosition;
|
|
183
|
+
static TextJustification: typeof TextJustification;
|
|
184
|
+
static VoiceMode: typeof VoiceMode;
|
|
185
|
+
/**
|
|
186
|
+
* Load the fonts that are used by your app.
|
|
187
|
+
*
|
|
188
|
+
* Call this if you are using `vexflow-core.js` to take advantage of lazy loading for fonts.
|
|
189
|
+
*
|
|
190
|
+
* If you are using `vexflow.js` or `vexflow-bravura.js`, this method is unnecessary, since
|
|
191
|
+
* they already call loadFonts(...) and setFonts(...) for you.
|
|
192
|
+
*
|
|
193
|
+
* If `fontNames` is undefined, all fonts in Font.FILES will be loaded.
|
|
194
|
+
* This is useful for debugging, but not recommended for production because it will load lots of fonts.
|
|
195
|
+
*
|
|
196
|
+
* For example, on the `flow.html` test page, you could call:
|
|
197
|
+
* `await VexFlow.loadFonts();`
|
|
198
|
+
*
|
|
199
|
+
* Alternatively, you may load web fonts with a stylesheet link (e.g., from Google Fonts),
|
|
200
|
+
* and a @font-face { font-family: ... } rule in your CSS.
|
|
201
|
+
*
|
|
202
|
+
* Customize `Font.HOST_URL` and `Font.FILES` to load different fonts for your app.
|
|
203
|
+
*/
|
|
204
|
+
static loadFonts(...fontNames: string[]): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Call this if you are using `vexflow-core.js` to take advantage of lazy loading for fonts.
|
|
207
|
+
*
|
|
208
|
+
* `vexflow.js` and `vexflow-bravura.js` already call setFonts('Bravura', 'Academico'), so you only
|
|
209
|
+
* need to call this when switching fonts.
|
|
210
|
+
*
|
|
211
|
+
* Example:
|
|
212
|
+
* ```
|
|
213
|
+
* await VexFlow.loadFonts('Bravura', 'Academico', 'Petaluma', 'Petaluma Script');
|
|
214
|
+
* VexFlow.setFonts('Bravura', 'Academico');
|
|
215
|
+
* ... render a score in Bravura ...
|
|
216
|
+
* VexFlow.setFonts('Petaluma', 'Petaluma Script');
|
|
217
|
+
* ... render a score in Petaluma...
|
|
218
|
+
* ```
|
|
219
|
+
* See `demos/fonts/` for more examples.
|
|
220
|
+
*/
|
|
221
|
+
static setFonts(...fontNames: string[]): void;
|
|
222
|
+
static getFonts(): string[];
|
|
223
|
+
static get RENDER_PRECISION_PLACES(): number;
|
|
224
|
+
static set RENDER_PRECISION_PLACES(precision: number);
|
|
225
|
+
static get SOFTMAX_FACTOR(): number;
|
|
226
|
+
static set SOFTMAX_FACTOR(factor: number);
|
|
227
|
+
static get UNISON(): boolean;
|
|
228
|
+
static set UNISON(unison: boolean);
|
|
229
|
+
static get NOTATION_FONT_SCALE(): number;
|
|
230
|
+
static set NOTATION_FONT_SCALE(value: number);
|
|
231
|
+
static get TABLATURE_FONT_SCALE(): number;
|
|
232
|
+
static set TABLATURE_FONT_SCALE(value: number);
|
|
233
|
+
static get RESOLUTION(): number;
|
|
234
|
+
static set RESOLUTION(value: number);
|
|
235
|
+
static get SLASH_NOTEHEAD_WIDTH(): number;
|
|
236
|
+
static set SLASH_NOTEHEAD_WIDTH(value: number);
|
|
237
|
+
static get STAVE_LINE_DISTANCE(): number;
|
|
238
|
+
static set STAVE_LINE_DISTANCE(value: number);
|
|
239
|
+
static get STAVE_LINE_THICKNESS(): number;
|
|
240
|
+
static set STAVE_LINE_THICKNESS(value: number);
|
|
241
|
+
static get STEM_HEIGHT(): number;
|
|
242
|
+
static set STEM_HEIGHT(value: number);
|
|
243
|
+
static get STEM_WIDTH(): number;
|
|
244
|
+
static set STEM_WIDTH(value: number);
|
|
245
|
+
static get TIME4_4(): VoiceTime;
|
|
246
|
+
static get unicode(): Record<string, string>;
|
|
247
|
+
static keySignature(spec: string): {
|
|
248
|
+
type: string;
|
|
249
|
+
line: number;
|
|
250
|
+
}[];
|
|
251
|
+
static hasKeySignature(spec: string): boolean;
|
|
252
|
+
static getKeySignatures(): Record<string, {
|
|
253
|
+
acc?: string;
|
|
254
|
+
num: number;
|
|
255
|
+
}>;
|
|
256
|
+
static clefProperties(clef: string): {
|
|
257
|
+
lineShift: number;
|
|
258
|
+
};
|
|
259
|
+
static keyProperties(key: string, clef?: string, params?: any): any;
|
|
260
|
+
static durationToTicks(duration: string): number;
|
|
261
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Modifier } from './modifier';
|
|
2
|
+
import { ModifierContext, ModifierContextState } from './modifiercontext';
|
|
3
|
+
export interface VibratoRenderOptions {
|
|
4
|
+
code: number;
|
|
5
|
+
width: number;
|
|
6
|
+
}
|
|
7
|
+
/** `Vibrato` implements diverse vibratos. */
|
|
8
|
+
export declare class Vibrato extends Modifier {
|
|
9
|
+
static get CATEGORY(): string;
|
|
10
|
+
protected renderOptions: VibratoRenderOptions;
|
|
11
|
+
/** Arrange vibratos inside a `ModifierContext`. */
|
|
12
|
+
static format(vibratos: Vibrato[], state: ModifierContextState, context: ModifierContext): boolean;
|
|
13
|
+
constructor();
|
|
14
|
+
/** Set vibrato width in pixels. */
|
|
15
|
+
setVibratoWidth(width: number): this;
|
|
16
|
+
/** Set vibrato code. */
|
|
17
|
+
setVibratoCode(code: number): this;
|
|
18
|
+
/** Draw the vibrato on the rendering context. */
|
|
19
|
+
draw(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Element } from './element';
|
|
2
|
+
import { Note } from './note';
|
|
3
|
+
import { Vibrato } from './vibrato';
|
|
4
|
+
/** `VibratoBracket` renders vibrato effect between two notes. */
|
|
5
|
+
export declare class VibratoBracket extends Element {
|
|
6
|
+
/** To enable logging for this class. Set `VexFlow.VibratoBracket.DEBUG` to `true`. */
|
|
7
|
+
static DEBUG: boolean;
|
|
8
|
+
static get CATEGORY(): string;
|
|
9
|
+
protected line: number;
|
|
10
|
+
protected vibrato: Vibrato;
|
|
11
|
+
protected start?: Note;
|
|
12
|
+
protected stop?: Note;
|
|
13
|
+
/**
|
|
14
|
+
* Either the stop or start note must be set, or both of them.
|
|
15
|
+
* An undefined value for the start or stop note indicates that the vibrato
|
|
16
|
+
* is drawn from the beginning or until the end of the stave accordingly.
|
|
17
|
+
*/
|
|
18
|
+
constructor(bracketData: {
|
|
19
|
+
stop?: Note | null;
|
|
20
|
+
start?: Note | null;
|
|
21
|
+
});
|
|
22
|
+
/** Set line position of the vibrato bracket. */
|
|
23
|
+
setLine(line: number): this;
|
|
24
|
+
/** Set vibrato code. */
|
|
25
|
+
setVibratoCode(code: number): this;
|
|
26
|
+
/** Draw the vibrato bracket on the rendering context. */
|
|
27
|
+
draw(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
2
|
+
import { Element } from './element';
|
|
3
|
+
import { Fraction } from './fraction';
|
|
4
|
+
import { RenderContext } from './rendercontext';
|
|
5
|
+
import { Stave } from './stave';
|
|
6
|
+
import { Tickable } from './tickable';
|
|
7
|
+
export interface VoiceTime {
|
|
8
|
+
numBeats: number;
|
|
9
|
+
beatValue: number;
|
|
10
|
+
/** Defaults to `VexFlow.RESOLUTION` if not provided. */
|
|
11
|
+
resolution?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare enum VoiceMode {
|
|
14
|
+
STRICT = 1,
|
|
15
|
+
SOFT = 2,
|
|
16
|
+
FULL = 3
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `Voice` is mainly a container object to group `Tickables` for formatting.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Voice extends Element {
|
|
22
|
+
static get CATEGORY(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Modes allow the addition of ticks in three different ways:
|
|
25
|
+
* - STRICT: This is the default. Ticks must fill the voice.
|
|
26
|
+
* - SOFT: Ticks can be added without restrictions.
|
|
27
|
+
* - FULL: Ticks do not need to fill the voice, but can't exceed the maximum tick length.
|
|
28
|
+
*/
|
|
29
|
+
static get Mode(): typeof VoiceMode;
|
|
30
|
+
protected resolutionMultiplier: number;
|
|
31
|
+
protected smallestTickCount: Fraction;
|
|
32
|
+
protected stave?: Stave;
|
|
33
|
+
protected mode: VoiceMode;
|
|
34
|
+
protected expTicksUsed?: number;
|
|
35
|
+
protected preFormatted: boolean;
|
|
36
|
+
protected options: {
|
|
37
|
+
softmaxFactor: number;
|
|
38
|
+
};
|
|
39
|
+
protected readonly totalTicks: Fraction;
|
|
40
|
+
protected readonly ticksUsed: Fraction;
|
|
41
|
+
protected readonly largestTickWidth: number;
|
|
42
|
+
protected readonly tickables: Tickable[];
|
|
43
|
+
protected readonly time: Required<VoiceTime>;
|
|
44
|
+
constructor(time?: VoiceTime | string);
|
|
45
|
+
/** Get the total ticks in the voice. */
|
|
46
|
+
getTotalTicks(): Fraction;
|
|
47
|
+
/** Get the total ticks used in the voice by all the tickables. */
|
|
48
|
+
getTicksUsed(): Fraction;
|
|
49
|
+
/** Get the largest width of all the tickables. */
|
|
50
|
+
getLargestTickWidth(): number;
|
|
51
|
+
/** Get the tick count for the shortest tickable */
|
|
52
|
+
getSmallestTickCount(): Fraction;
|
|
53
|
+
/** Get the tickables in the voice. */
|
|
54
|
+
getTickables(): Tickable[];
|
|
55
|
+
/** Get the voice mode (Voice.Mode.SOFT, STRICT, or FULL) */
|
|
56
|
+
getMode(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Set the voice mode.
|
|
59
|
+
* @param mode value from `VoiceMode` or Voice.Mode
|
|
60
|
+
*/
|
|
61
|
+
setMode(mode: number): this;
|
|
62
|
+
/** Get the resolution multiplier for the voice. */
|
|
63
|
+
getResolutionMultiplier(): number;
|
|
64
|
+
/** Get the actual tick resolution for the voice. */
|
|
65
|
+
getActualResolution(): number;
|
|
66
|
+
/** Set the voice's stave. */
|
|
67
|
+
setStave(stave: Stave): this;
|
|
68
|
+
getStave(): Stave | undefined;
|
|
69
|
+
/** Get the bounding box for the voice. */
|
|
70
|
+
getBoundingBox(): BoundingBox;
|
|
71
|
+
/** Set the voice mode to strict or soft. */
|
|
72
|
+
setStrict(strict: boolean): this;
|
|
73
|
+
/** Determine if the voice is complete according to the voice mode. */
|
|
74
|
+
isComplete(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* We use softmax to layout the tickables proportional to the exponent of
|
|
77
|
+
* their duration. The softmax factor is used to determine the 'linearness' of
|
|
78
|
+
* the layout.
|
|
79
|
+
*
|
|
80
|
+
* The softmax of all the tickables in this voice should sum to 1.
|
|
81
|
+
*/
|
|
82
|
+
setSoftmaxFactor(factor: number): this;
|
|
83
|
+
/**
|
|
84
|
+
* Calculate the sum of the exponents of all the ticks in this voice to use
|
|
85
|
+
* as the denominator of softmax. (It is not the sum of the softmax(t) over all tickables)
|
|
86
|
+
*
|
|
87
|
+
* Note that the "exp" of "expTicksUsed" stands for "expontential" ticks used,
|
|
88
|
+
* not "expected" ticks used.
|
|
89
|
+
*/
|
|
90
|
+
protected reCalculateExpTicksUsed(): number;
|
|
91
|
+
/** Get the softmax-scaled value of a tick duration. 'tickValue' is a number. */
|
|
92
|
+
softmax(tickValue: number): number;
|
|
93
|
+
/** Add a tickable to the voice. */
|
|
94
|
+
addTickable(tickable: Tickable): this;
|
|
95
|
+
/** Add an array of tickables to the voice. */
|
|
96
|
+
addTickables(tickables: Tickable[]): this;
|
|
97
|
+
/** Preformat the voice by applying the voice's stave to each note. */
|
|
98
|
+
preFormat(): this;
|
|
99
|
+
checkStave(): Stave;
|
|
100
|
+
/**
|
|
101
|
+
* Render the voice onto the canvas `context` and an optional `stave`.
|
|
102
|
+
* If `stave` is omitted, it is expected that the notes have staves
|
|
103
|
+
* already set.
|
|
104
|
+
*
|
|
105
|
+
* This method also calculates the voice's boundingBox while drawing
|
|
106
|
+
* the notes. Note the similarities with this.getBoundingBox().
|
|
107
|
+
*/
|
|
108
|
+
draw(context?: RenderContext, stave?: Stave): void;
|
|
109
|
+
}
|