@coderline/alphatab 1.3.0-alpha.139 → 1.3.0-alpha.140

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/dist/alphaTab.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.139 (develop, build 139)
2
+ * alphaTab v1.3.0-alpha.140 (develop, build 140)
3
3
  *
4
4
  * Copyright © 2021, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -138,7 +138,7 @@
138
138
  })(exports.AlphaTabErrorType || (exports.AlphaTabErrorType = {}));
139
139
  class AlphaTabError extends Error {
140
140
  constructor(type, message = "", inner) {
141
- super(message);
141
+ super(message !== null && message !== void 0 ? message : "");
142
142
  this.type = type;
143
143
  this.inner = inner !== null && inner !== void 0 ? inner : null;
144
144
  Object.setPrototypeOf(this, AlphaTabError.prototype);
@@ -150,8 +150,8 @@
150
150
  * binary data does not contain a reader compatible structure.
151
151
  */
152
152
  class UnsupportedFormatError extends AlphaTabError {
153
- constructor(message = 'Unsupported format', inner = null) {
154
- super(exports.AlphaTabErrorType.Format, message);
153
+ constructor(message = null, inner = null) {
154
+ super(exports.AlphaTabErrorType.Format, message !== null && message !== void 0 ? message : 'Unsupported format');
155
155
  this.inner = inner;
156
156
  Object.setPrototypeOf(this, UnsupportedFormatError.prototype);
157
157
  }
@@ -202,6 +202,7 @@
202
202
  * Automations are used to change the behaviour of a song.
203
203
  * @cloneable
204
204
  * @json
205
+ * @json_strict
205
206
  */
206
207
  class Automation {
207
208
  constructor() {
@@ -330,6 +331,7 @@
330
331
  /**
331
332
  * A bar is a single block within a track, also known as Measure.
332
333
  * @json
334
+ * @json_strict
333
335
  */
334
336
  class Bar {
335
337
  constructor() {
@@ -391,11 +393,11 @@
391
393
  voice.index = this.voices.length;
392
394
  this.voices.push(voice);
393
395
  }
394
- finish(settings) {
396
+ finish(settings, sharedDataBag) {
395
397
  this.isMultiVoice = false;
396
398
  for (let i = 0, j = this.voices.length; i < j; i++) {
397
399
  let voice = this.voices[i];
398
- voice.finish(settings);
400
+ voice.finish(settings, sharedDataBag);
399
401
  if (i > 0 && !voice.isEmpty) {
400
402
  this.isMultiVoice = true;
401
403
  }
@@ -475,6 +477,7 @@
475
477
  * describe WhammyBar and String Bending effects.
476
478
  * @cloneable
477
479
  * @json
480
+ * @json_strict
478
481
  */
479
482
  class BendPoint {
480
483
  /**
@@ -1742,6 +1745,7 @@
1742
1745
  /**
1743
1746
  * Describes an instrument articulation which is used for percussions.
1744
1747
  * @json
1748
+ * @json_strict
1745
1749
  */
1746
1750
  class InstrumentArticulation {
1747
1751
  constructor(elementType = "", staffLine = 0, outputMidiNumber = 0, noteHeadDefault = MusicFontSymbol.None, noteHeadHalf = MusicFontSymbol.None, noteHeadWhole = MusicFontSymbol.None, techniqueSymbol = MusicFontSymbol.None, techniqueSymbolPlacement = TextBaseline.Middle) {
@@ -1963,12 +1967,23 @@
1963
1967
  [34, new InstrumentArticulation("snare", 3, 38, MusicFontSymbol.NoteheadBlack, MusicFontSymbol.NoteheadBlack, MusicFontSymbol.NoteheadBlack)]
1964
1968
  ]);
1965
1969
 
1970
+ class NoteIdBag {
1971
+ constructor() {
1972
+ this.tieDestinationNoteId = -1;
1973
+ this.tieOriginNoteId = -1;
1974
+ this.slurDestinationNoteId = -1;
1975
+ this.slurOriginNoteId = -1;
1976
+ this.hammerPullDestinationNoteId = -1;
1977
+ this.hammerPullOriginNoteId = -1;
1978
+ }
1979
+ }
1966
1980
  /**
1967
1981
  * A note is a single played sound on a fretted instrument.
1968
1982
  * It consists of a fret offset and a string on which the note is played on.
1969
1983
  * It also can be modified by a lot of different effects.
1970
1984
  * @cloneable
1971
1985
  * @json
1986
+ * @json_strict
1972
1987
  */
1973
1988
  class Note {
1974
1989
  constructor() {
@@ -2009,7 +2024,7 @@
2009
2024
  * @clone_add addBendPoint
2010
2025
  * @json_add addBendPoint
2011
2026
  */
2012
- this.bendPoints = [];
2027
+ this.bendPoints = null;
2013
2028
  /**
2014
2029
  * Gets or sets the bend point with the highest bend value.
2015
2030
  * @clone_ignore
@@ -2147,25 +2162,33 @@
2147
2162
  */
2148
2163
  this.isHammerPullOrigin = false;
2149
2164
  /**
2150
- * Gets the origin note id of the hammeron/pull-off of this note.
2165
+ * Gets the origin of the hammeron/pulloff of this note.
2166
+ * @clone_ignore
2167
+ * @json_ignore
2151
2168
  */
2152
- this.hammerPullOriginNoteId = -1;
2169
+ this.hammerPullOrigin = null;
2153
2170
  /**
2154
- * Gets the destination note id of the hammeron/pull-off of this note.
2171
+ * Gets the destination for the hammeron/pullof started by this note.
2172
+ * @clone_ignore
2173
+ * @json_ignore
2155
2174
  */
2156
- this.hammerPullDestinationNoteId = -1;
2175
+ this.hammerPullDestination = null;
2157
2176
  /**
2158
2177
  * Gets or sets whether this note finishes a slur.
2159
2178
  */
2160
2179
  this.isSlurDestination = false;
2161
2180
  /**
2162
- * Gets the note id where the slur of this note starts.
2181
+ * Gets or sets the note where the slur of this note starts.
2182
+ * @clone_ignore
2183
+ * @json_ignore
2163
2184
  */
2164
- this.slurOriginNoteId = -1;
2185
+ this.slurOrigin = null;
2165
2186
  /**
2166
- * Gets or sets the note id where the slur of this note ends.
2187
+ * Gets or sets the note where the slur of this note ends.
2188
+ * @clone_ignore
2189
+ * @json_ignore
2167
2190
  */
2168
- this.slurDestinationNoteId = -1;
2191
+ this.slurDestination = null;
2169
2192
  /**
2170
2193
  * Gets or sets the harmonic type applied to this note.
2171
2194
  */
@@ -2231,13 +2254,17 @@
2231
2254
  */
2232
2255
  this.vibrato = VibratoType.None;
2233
2256
  /**
2234
- * Gets the origin note id of the tied if this note is tied.
2257
+ * Gets the origin of the tied if this note is tied.
2258
+ * @clone_ignore
2259
+ * @json_ignore
2235
2260
  */
2236
- this.tieOriginNoteId = -1;
2261
+ this.tieOrigin = null;
2237
2262
  /**
2238
- * Gets the desination note id of the tie.
2263
+ * Gets the desination of the tie.
2264
+ * @clone_ignore
2265
+ * @json_ignore
2239
2266
  */
2240
- this.tieDestinationNoteId = -1;
2267
+ this.tieDestination = null;
2241
2268
  /**
2242
2269
  * Gets or sets whether this note is ends a tied note.
2243
2270
  */
@@ -2294,9 +2321,10 @@
2294
2321
  * @json_ignore
2295
2322
  */
2296
2323
  this.effectSlurDestination = null;
2324
+ this._noteIdBag = null;
2297
2325
  }
2298
2326
  get hasBend() {
2299
- return this.bendType !== BendType.None;
2327
+ return this.bendPoints !== null && this.bendType !== BendType.None;
2300
2328
  }
2301
2329
  get isStringed() {
2302
2330
  return this.string >= 0;
@@ -2324,50 +2352,14 @@
2324
2352
  get isHammerPullDestination() {
2325
2353
  return !!this.hammerPullOrigin;
2326
2354
  }
2327
- /**
2328
- * Gets the origin of the hammeron/pulloff of this note.
2329
- */
2330
- get hammerPullOrigin() {
2331
- return this.hammerPullOriginNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.hammerPullOriginNoteId);
2332
- }
2333
- /**
2334
- * Gets the destination for the hammeron/pullof started by this note.
2335
- */
2336
- get hammerPullDestination() {
2337
- return this.hammerPullDestinationNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.hammerPullDestinationNoteId);
2338
- }
2339
2355
  get isSlurOrigin() {
2340
2356
  return !!this.slurDestination;
2341
2357
  }
2342
- /**
2343
- * Gets or sets the note where the slur of this note starts.
2344
- */
2345
- get slurOrigin() {
2346
- return this.slurOriginNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.slurOriginNoteId);
2347
- }
2348
- /**
2349
- * Gets or sets the note where the slur of this note ends.
2350
- */
2351
- get slurDestination() {
2352
- return this.slurDestinationNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.slurDestinationNoteId);
2353
- }
2354
2358
  get isHarmonic() {
2355
2359
  return this.harmonicType !== HarmonicType.None;
2356
2360
  }
2357
- /**
2358
- * Gets the origin of the tied if this note is tied.
2359
- */
2360
- get tieOrigin() {
2361
- return this.tieOriginNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.tieOriginNoteId);
2362
- }
2363
- /**
2364
- * Gets the desination of the tie.
2365
- */
2366
- get tieDestination() {
2367
- return this.tieDestinationNoteId === -1 ? null : this.beat.voice.bar.staff.track.score.getNoteById(this.tieDestinationNoteId);
2368
- }
2369
2361
  get isTieOrigin() {
2370
- return this.tieDestinationNoteId !== -1;
2362
+ return this.tieDestination !== null;
2371
2363
  }
2372
2364
  get trillFret() {
2373
2365
  return this.trillValue - this.stringTuning;
@@ -2568,7 +2560,12 @@
2568
2560
  return false;
2569
2561
  }
2570
2562
  addBendPoint(point) {
2571
- this.bendPoints.push(point);
2563
+ let points = this.bendPoints;
2564
+ if (points === null) {
2565
+ points = [];
2566
+ this.bendPoints = points;
2567
+ }
2568
+ points.push(point);
2572
2569
  if (!this.maxBendPoint || point.value > this.maxBendPoint.value) {
2573
2570
  this.maxBendPoint = point;
2574
2571
  }
@@ -2576,12 +2573,12 @@
2576
2573
  this.bendType = BendType.Custom;
2577
2574
  }
2578
2575
  }
2579
- finish(settings) {
2576
+ finish(settings, sharedDataBag) {
2580
2577
  let nextNoteOnLine = new Lazy(() => Note.nextNoteOnSameLine(this));
2581
2578
  let isSongBook = settings && settings.notation.notationMode === exports.NotationMode.SongBook;
2582
2579
  // connect ties
2583
2580
  if (this.isTieDestination) {
2584
- this.chain();
2581
+ this.chain(sharedDataBag);
2585
2582
  // implicit let ring
2586
2583
  if (isSongBook && this.tieOrigin && this.tieOrigin.isLetRing) {
2587
2584
  this.isLetRing = true;
@@ -2615,8 +2612,8 @@
2615
2612
  this.isHammerPullOrigin = false;
2616
2613
  }
2617
2614
  else {
2618
- this.hammerPullDestinationNoteId = hammerPullDestination.id;
2619
- hammerPullDestination.hammerPullOriginNoteId = this.id;
2615
+ this.hammerPullDestination = hammerPullDestination;
2616
+ hammerPullDestination.hammerPullOrigin = this;
2620
2617
  }
2621
2618
  }
2622
2619
  // set slides
@@ -2654,14 +2651,15 @@
2654
2651
  }
2655
2652
  // try to detect what kind of bend was used and cleans unneeded points if required
2656
2653
  // Guitar Pro 6 and above (gpif.xml) uses exactly 4 points to define all bends
2657
- if (this.bendPoints.length > 0 && this.bendType === BendType.Custom) {
2654
+ const points = this.bendPoints;
2655
+ if (points != null && points.length > 0 && this.bendType === BendType.Custom) {
2658
2656
  let isContinuedBend = this.isTieDestination && this.tieOrigin.hasBend;
2659
2657
  this.isContinuedBend = isContinuedBend;
2660
- if (this.bendPoints.length === 4) {
2661
- let origin = this.bendPoints[0];
2662
- let middle1 = this.bendPoints[1];
2663
- let middle2 = this.bendPoints[2];
2664
- let destination = this.bendPoints[3];
2658
+ if (points.length === 4) {
2659
+ let origin = points[0];
2660
+ let middle1 = points[1];
2661
+ let middle2 = points[2];
2662
+ let destination = points[3];
2665
2663
  // the middle points are used for holds, anything else is a new feature we do not support yet
2666
2664
  if (middle1.value === middle2.value) {
2667
2665
  // bend higher?
@@ -2671,26 +2669,26 @@
2671
2669
  }
2672
2670
  else if (!isContinuedBend && origin.value > 0) {
2673
2671
  this.bendType = BendType.PrebendBend;
2674
- this.bendPoints.splice(2, 1);
2675
- this.bendPoints.splice(1, 1);
2672
+ points.splice(2, 1);
2673
+ points.splice(1, 1);
2676
2674
  }
2677
2675
  else {
2678
2676
  this.bendType = BendType.Bend;
2679
- this.bendPoints.splice(2, 1);
2680
- this.bendPoints.splice(1, 1);
2677
+ points.splice(2, 1);
2678
+ points.splice(1, 1);
2681
2679
  }
2682
2680
  }
2683
2681
  else if (destination.value < origin.value) {
2684
2682
  // origin must be > 0 otherwise it's no release, we cannot bend negative
2685
2683
  if (isContinuedBend) {
2686
2684
  this.bendType = BendType.Release;
2687
- this.bendPoints.splice(2, 1);
2688
- this.bendPoints.splice(1, 1);
2685
+ points.splice(2, 1);
2686
+ points.splice(1, 1);
2689
2687
  }
2690
2688
  else {
2691
2689
  this.bendType = BendType.PrebendRelease;
2692
- this.bendPoints.splice(2, 1);
2693
- this.bendPoints.splice(1, 1);
2690
+ points.splice(2, 1);
2691
+ points.splice(1, 1);
2694
2692
  }
2695
2693
  }
2696
2694
  else {
@@ -2699,13 +2697,13 @@
2699
2697
  }
2700
2698
  else if (origin.value > 0 && !isContinuedBend) {
2701
2699
  this.bendType = BendType.Prebend;
2702
- this.bendPoints.splice(2, 1);
2703
- this.bendPoints.splice(1, 1);
2700
+ points.splice(2, 1);
2701
+ points.splice(1, 1);
2704
2702
  }
2705
2703
  else {
2706
2704
  this.bendType = BendType.Hold;
2707
- this.bendPoints.splice(2, 1);
2708
- this.bendPoints.splice(1, 1);
2705
+ points.splice(2, 1);
2706
+ points.splice(1, 1);
2709
2707
  }
2710
2708
  }
2711
2709
  }
@@ -2713,9 +2711,9 @@
2713
2711
  Logger.warning('Model', 'Unsupported bend type detected, fallback to custom', null);
2714
2712
  }
2715
2713
  }
2716
- else if (this.bendPoints.length === 2) {
2717
- let origin = this.bendPoints[0];
2718
- let destination = this.bendPoints[1];
2714
+ else if (points.length === 2) {
2715
+ let origin = points[0];
2716
+ let destination = points[1];
2719
2717
  // bend higher?
2720
2718
  if (destination.value > origin.value) {
2721
2719
  if (!isContinuedBend && origin.value > 0) {
@@ -2739,7 +2737,7 @@
2739
2737
  }
2740
2738
  }
2741
2739
  }
2742
- else if (this.bendPoints.length === 0) {
2740
+ else if (points === null || points.length === 0) {
2743
2741
  this.bendType = BendType.None;
2744
2742
  }
2745
2743
  // initial bend pitch offsets and forced accidentals don't play well together
@@ -2835,35 +2833,134 @@
2835
2833
  }
2836
2834
  return null;
2837
2835
  }
2838
- chain() {
2839
- this.beat.voice.bar.staff.track.score.registerNote(this);
2840
- if (!this.isTieDestination) {
2841
- return;
2842
- }
2843
- let tieOrigin;
2844
- if (this.tieOriginNoteId === -1) {
2845
- tieOrigin = Note.findTieOrigin(this);
2846
- this.tieOriginNoteId = tieOrigin ? tieOrigin.id : -1;
2836
+ chain(sharedDataBag) {
2837
+ // if we have some IDs from a serialization flow,
2838
+ // we need to lookup/register the notes correctly
2839
+ if (this._noteIdBag != null) {
2840
+ // get or create lookup
2841
+ let noteIdLookup;
2842
+ if (sharedDataBag.has(Note.NoteIdLookupKey)) {
2843
+ noteIdLookup = sharedDataBag.get(Note.NoteIdLookupKey);
2844
+ }
2845
+ else {
2846
+ noteIdLookup = new Map();
2847
+ sharedDataBag.set(Note.NoteIdLookupKey, noteIdLookup);
2848
+ }
2849
+ // if this note is a source note for any effect, remember it for later
2850
+ // the destination note will look it up for linking
2851
+ if (this._noteIdBag.hammerPullDestinationNoteId !== -1 ||
2852
+ this._noteIdBag.tieDestinationNoteId !== -1 ||
2853
+ this._noteIdBag.slurDestinationNoteId !== -1) {
2854
+ noteIdLookup.set(this.id, this);
2855
+ }
2856
+ // on any effect destiniation, lookup the origin which should already be
2857
+ // registered
2858
+ if (this._noteIdBag.hammerPullOriginNoteId !== -1) {
2859
+ this.hammerPullOrigin = noteIdLookup.get(this._noteIdBag.hammerPullOriginNoteId);
2860
+ this.hammerPullOrigin.hammerPullDestination = this;
2861
+ }
2862
+ if (this._noteIdBag.tieOriginNoteId !== -1) {
2863
+ this.tieOrigin = noteIdLookup.get(this._noteIdBag.tieOriginNoteId);
2864
+ this.tieOrigin.tieDestination = this;
2865
+ }
2866
+ if (this._noteIdBag.slurOriginNoteId !== -1) {
2867
+ this.slurOrigin = noteIdLookup.get(this._noteIdBag.slurOriginNoteId);
2868
+ this.slurOrigin.slurDestination = this;
2869
+ }
2870
+ this._noteIdBag = null; // not needed anymore
2847
2871
  }
2848
2872
  else {
2849
- tieOrigin = this.tieOrigin;
2873
+ if (!this.isTieDestination && this.tieOrigin == null) {
2874
+ return;
2875
+ }
2876
+ let tieOrigin = Note.findTieOrigin(this);
2877
+ if (!tieOrigin) {
2878
+ this.isTieDestination = false;
2879
+ }
2880
+ else {
2881
+ tieOrigin.tieDestination = this;
2882
+ this.tieOrigin = tieOrigin;
2883
+ this.fret = tieOrigin.fret;
2884
+ this.octave = tieOrigin.octave;
2885
+ this.tone = tieOrigin.tone;
2886
+ if (tieOrigin.hasBend) {
2887
+ this.bendOrigin = this.tieOrigin;
2888
+ }
2889
+ }
2850
2890
  }
2851
- if (!tieOrigin) {
2852
- this.isTieDestination = false;
2891
+ }
2892
+ /**
2893
+ * @internal
2894
+ */
2895
+ toJson(o) {
2896
+ // inject linked note ids into JSON
2897
+ if (this.tieDestination !== null) {
2898
+ o.set("tiedestinationnoteid", this.tieDestination.id);
2853
2899
  }
2854
- else {
2855
- tieOrigin.tieDestinationNoteId = this.id;
2856
- this.fret = tieOrigin.fret;
2857
- this.octave = tieOrigin.octave;
2858
- this.tone = tieOrigin.tone;
2859
- if (tieOrigin.hasBend) {
2860
- this.bendOrigin = this.tieOrigin;
2861
- }
2900
+ if (this.tieOrigin !== null) {
2901
+ o.set("tieoriginnoteid", this.tieOrigin.id);
2902
+ }
2903
+ if (this.slurDestination !== null) {
2904
+ o.set("slurdestinationnoteid", this.slurDestination.id);
2905
+ }
2906
+ if (this.slurOrigin !== null) {
2907
+ o.set("sluroriginnoteid", this.slurOrigin.id);
2908
+ }
2909
+ if (this.hammerPullOrigin !== null) {
2910
+ o.set("hammerpulloriginnoteid", this.hammerPullOrigin.id);
2911
+ }
2912
+ if (this.hammerPullDestination !== null) {
2913
+ o.set("hammerpulldestinationnoteid", this.hammerPullDestination.id);
2914
+ }
2915
+ }
2916
+ /**
2917
+ * @internal
2918
+ */
2919
+ setProperty(property, v) {
2920
+ switch (property) {
2921
+ case "tiedestinationnoteid":
2922
+ if (this._noteIdBag == null) {
2923
+ this._noteIdBag = new NoteIdBag();
2924
+ }
2925
+ this._noteIdBag.tieDestinationNoteId = v;
2926
+ return true;
2927
+ case "tieoriginnoteid":
2928
+ if (this._noteIdBag == null) {
2929
+ this._noteIdBag = new NoteIdBag();
2930
+ }
2931
+ this._noteIdBag.tieOriginNoteId = v;
2932
+ return true;
2933
+ case "slurdestinationnoteid":
2934
+ if (this._noteIdBag == null) {
2935
+ this._noteIdBag = new NoteIdBag();
2936
+ }
2937
+ this._noteIdBag.slurDestinationNoteId = v;
2938
+ return true;
2939
+ case "sluroriginnoteid":
2940
+ if (this._noteIdBag == null) {
2941
+ this._noteIdBag = new NoteIdBag();
2942
+ }
2943
+ this._noteIdBag.slurOriginNoteId = v;
2944
+ return true;
2945
+ case "hammerpulloriginnoteid":
2946
+ if (this._noteIdBag == null) {
2947
+ this._noteIdBag = new NoteIdBag();
2948
+ }
2949
+ this._noteIdBag.hammerPullOriginNoteId = v;
2950
+ return true;
2951
+ case "hammerpulldestinationnoteid":
2952
+ if (this._noteIdBag == null) {
2953
+ this._noteIdBag = new NoteIdBag();
2954
+ }
2955
+ this._noteIdBag.hammerPullDestinationNoteId = v;
2956
+ return true;
2862
2957
  }
2958
+ return false;
2863
2959
  }
2864
2960
  }
2865
2961
  Note.GlobalNoteId = 0;
2866
- Note.MaxOffsetForSameLineSearch = 3;
2962
+ Note.MaxOffsetForSameLineSearch = 3;
2963
+ Note.NoteIdLookupKey = "NoteIdLookup";
2867
2964
 
2868
2965
  /**
2869
2966
  * Represents a list of beats that are grouped within the same tuplet.
@@ -3009,9 +3106,11 @@
3009
3106
  clone.bendType = original.bendType;
3010
3107
  clone.bendStyle = original.bendStyle;
3011
3108
  clone.isContinuedBend = original.isContinuedBend;
3012
- clone.bendPoints = [];
3013
- for (const i of original.bendPoints) {
3014
- clone.addBendPoint(BendPointCloner.clone(i));
3109
+ if (original.bendPoints) {
3110
+ clone.bendPoints = [];
3111
+ for (const i of original.bendPoints) {
3112
+ clone.addBendPoint(BendPointCloner.clone(i));
3113
+ }
3015
3114
  }
3016
3115
  clone.fret = original.fret;
3017
3116
  clone.string = original.string;
@@ -3021,11 +3120,7 @@
3021
3120
  clone.isVisible = original.isVisible;
3022
3121
  clone.isLeftHandTapped = original.isLeftHandTapped;
3023
3122
  clone.isHammerPullOrigin = original.isHammerPullOrigin;
3024
- clone.hammerPullOriginNoteId = original.hammerPullOriginNoteId;
3025
- clone.hammerPullDestinationNoteId = original.hammerPullDestinationNoteId;
3026
3123
  clone.isSlurDestination = original.isSlurDestination;
3027
- clone.slurOriginNoteId = original.slurOriginNoteId;
3028
- clone.slurDestinationNoteId = original.slurDestinationNoteId;
3029
3124
  clone.harmonicType = original.harmonicType;
3030
3125
  clone.harmonicValue = original.harmonicValue;
3031
3126
  clone.isGhost = original.isGhost;
@@ -3036,8 +3131,6 @@
3036
3131
  clone.slideInType = original.slideInType;
3037
3132
  clone.slideOutType = original.slideOutType;
3038
3133
  clone.vibrato = original.vibrato;
3039
- clone.tieOriginNoteId = original.tieOriginNoteId;
3040
- clone.tieDestinationNoteId = original.tieDestinationNoteId;
3041
3134
  clone.isTieDestination = original.isTieDestination;
3042
3135
  clone.leftHandFinger = original.leftHandFinger;
3043
3136
  clone.rightHandFinger = original.rightHandFinger;
@@ -3098,9 +3191,11 @@
3098
3191
  clone.tupletNumerator = original.tupletNumerator;
3099
3192
  clone.isContinuedWhammy = original.isContinuedWhammy;
3100
3193
  clone.whammyBarType = original.whammyBarType;
3101
- clone.whammyBarPoints = [];
3102
- for (const i of original.whammyBarPoints) {
3103
- clone.addWhammyBarPoint(BendPointCloner.clone(i));
3194
+ if (original.whammyBarPoints) {
3195
+ clone.whammyBarPoints = [];
3196
+ for (const i of original.whammyBarPoints) {
3197
+ clone.addWhammyBarPoint(BendPointCloner.clone(i));
3198
+ }
3104
3199
  }
3105
3200
  clone.vibrato = original.vibrato;
3106
3201
  clone.chordId = original.chordId;
@@ -3178,6 +3273,7 @@
3178
3273
  * A beat is a single block within a bar. A beat is a combination
3179
3274
  * of several notes played at the same time.
3180
3275
  * @json
3276
+ * @json_strict
3181
3277
  * @cloneable
3182
3278
  */
3183
3279
  class Beat {
@@ -3352,7 +3448,7 @@
3352
3448
  * @json_add addWhammyBarPoint
3353
3449
  * @clone_add addWhammyBarPoint
3354
3450
  */
3355
- this.whammyBarPoints = [];
3451
+ this.whammyBarPoints = null;
3356
3452
  /**
3357
3453
  * Gets or sets the highest point with for the highest whammy bar value.
3358
3454
  * @json_ignore
@@ -3473,13 +3569,13 @@
3473
3569
  !(this.tupletDenominator === 1 && this.tupletNumerator === 1));
3474
3570
  }
3475
3571
  get hasWhammyBar() {
3476
- return this.whammyBarType !== WhammyType.None;
3572
+ return this.whammyBarPoints !== null && this.whammyBarType !== WhammyType.None;
3477
3573
  }
3478
3574
  get hasChord() {
3479
3575
  return !!this.chordId;
3480
3576
  }
3481
3577
  get chord() {
3482
- return this.chordId ? this.voice.bar.staff.chords.get(this.chordId) : null;
3578
+ return this.chordId ? this.voice.bar.staff.getChord(this.chordId) : null;
3483
3579
  }
3484
3580
  get isTremolo() {
3485
3581
  return !!this.tremoloSpeed;
@@ -3494,7 +3590,12 @@
3494
3590
  return !!this.effectSlurOrigin;
3495
3591
  }
3496
3592
  addWhammyBarPoint(point) {
3497
- this.whammyBarPoints.push(point);
3593
+ let points = this.whammyBarPoints;
3594
+ if (points === null) {
3595
+ points = [];
3596
+ this.whammyBarPoints = points;
3597
+ }
3598
+ points.push(point);
3498
3599
  if (!this.maxWhammyPoint || point.value > this.maxWhammyPoint.value) {
3499
3600
  this.maxWhammyPoint = point;
3500
3601
  }
@@ -3507,16 +3608,17 @@
3507
3608
  }
3508
3609
  removeWhammyBarPoint(index) {
3509
3610
  // check index
3510
- if (index < 0 || index >= this.whammyBarPoints.length) {
3611
+ const points = this.whammyBarPoints;
3612
+ if (points === null || index < 0 || index >= points.length) {
3511
3613
  return;
3512
3614
  }
3513
3615
  // remove point
3514
- this.whammyBarPoints.splice(index, 1);
3515
- let point = this.whammyBarPoints[index];
3616
+ points.splice(index, 1);
3617
+ let point = points[index];
3516
3618
  // update maxWhammy point if required
3517
3619
  if (point === this.maxWhammyPoint) {
3518
3620
  this.maxWhammyPoint = null;
3519
- for (let currentPoint of this.whammyBarPoints) {
3621
+ for (let currentPoint of points) {
3520
3622
  if (!this.maxWhammyPoint || currentPoint.value > this.maxWhammyPoint.value) {
3521
3623
  this.maxWhammyPoint = currentPoint;
3522
3624
  }
@@ -3524,7 +3626,7 @@
3524
3626
  }
3525
3627
  if (point === this.minWhammyPoint) {
3526
3628
  this.minWhammyPoint = null;
3527
- for (let currentPoint of this.whammyBarPoints) {
3629
+ for (let currentPoint of points) {
3528
3630
  if (!this.minWhammyPoint || currentPoint.value < this.minWhammyPoint.value) {
3529
3631
  this.minWhammyPoint = currentPoint;
3530
3632
  }
@@ -3619,7 +3721,7 @@
3619
3721
  this.tupletGroup = currentTupletGroup;
3620
3722
  }
3621
3723
  }
3622
- finish(settings) {
3724
+ finish(settings, sharedDataBag) {
3623
3725
  if (this.getAutomation(AutomationType.Instrument) === null &&
3624
3726
  this.index === 0 &&
3625
3727
  this.voice.index === 0 &&
@@ -3658,7 +3760,7 @@
3658
3760
  for (let i = 0, j = this.notes.length; i < j; i++) {
3659
3761
  let note = this.notes[i];
3660
3762
  note.dynamics = this.dynamics;
3661
- note.finish(settings);
3763
+ note.finish(settings, sharedDataBag);
3662
3764
  if (note.isLetRing) {
3663
3765
  this.isLetRing = true;
3664
3766
  }
@@ -3749,17 +3851,18 @@
3749
3851
  }
3750
3852
  // try to detect what kind of bend was used and cleans unneeded points if required
3751
3853
  // Guitar Pro 6 and above (gpif.xml) uses exactly 4 points to define all whammys
3752
- if (this.whammyBarPoints.length > 0 && this.whammyBarType === WhammyType.Custom) {
3854
+ const points = this.whammyBarPoints;
3855
+ if (points !== null && points.length > 0 && this.whammyBarType === WhammyType.Custom) {
3753
3856
  if (displayMode === exports.NotationMode.SongBook) {
3754
3857
  this.whammyStyle = isGradual ? BendStyle.Gradual : BendStyle.Fast;
3755
3858
  }
3756
3859
  let isContinuedWhammy = !!this.previousBeat && this.previousBeat.hasWhammyBar;
3757
3860
  this.isContinuedWhammy = isContinuedWhammy;
3758
- if (this.whammyBarPoints.length === 4) {
3759
- let origin = this.whammyBarPoints[0];
3760
- let middle1 = this.whammyBarPoints[1];
3761
- let middle2 = this.whammyBarPoints[2];
3762
- let destination = this.whammyBarPoints[3];
3861
+ if (points.length === 4) {
3862
+ let origin = points[0];
3863
+ let middle1 = points[1];
3864
+ let middle2 = points[2];
3865
+ let destination = points[3];
3763
3866
  // the middle points are used for holds, anything else is a new feature we do not support yet
3764
3867
  if (middle1.value === middle2.value) {
3765
3868
  // constant decrease or increase
@@ -3771,14 +3874,14 @@
3771
3874
  else {
3772
3875
  this.whammyBarType = WhammyType.Dive;
3773
3876
  }
3774
- this.whammyBarPoints.splice(2, 1);
3775
- this.whammyBarPoints.splice(1, 1);
3877
+ points.splice(2, 1);
3878
+ points.splice(1, 1);
3776
3879
  }
3777
3880
  else if ((origin.value > middle1.value && middle1.value < destination.value) ||
3778
3881
  (origin.value < middle1.value && middle1.value > destination.value)) {
3779
3882
  this.whammyBarType = WhammyType.Dip;
3780
3883
  if (middle1.offset === middle2.offset || displayMode === exports.NotationMode.SongBook) {
3781
- this.whammyBarPoints.splice(2, 1);
3884
+ points.splice(2, 1);
3782
3885
  }
3783
3886
  }
3784
3887
  else if (origin.value === middle1.value && middle1.value === destination.value) {
@@ -3788,8 +3891,8 @@
3788
3891
  else {
3789
3892
  this.whammyBarType = WhammyType.Hold;
3790
3893
  }
3791
- this.whammyBarPoints.splice(2, 1);
3792
- this.whammyBarPoints.splice(1, 1);
3894
+ points.splice(2, 1);
3895
+ points.splice(1, 1);
3793
3896
  }
3794
3897
  else {
3795
3898
  Logger.warning('Model', 'Unsupported whammy type detected, fallback to custom', null);
@@ -3813,17 +3916,17 @@
3813
3916
  // remove bend on cloned note
3814
3917
  cloneNote.bendType = BendType.None;
3815
3918
  cloneNote.maxBendPoint = null;
3816
- cloneNote.bendPoints = [];
3919
+ cloneNote.bendPoints = null;
3817
3920
  cloneNote.bendStyle = BendStyle.Default;
3818
3921
  cloneNote.id = Note.GlobalNoteId++;
3819
3922
  // fix ties
3820
3923
  if (note.isTieOrigin) {
3821
- cloneNote.tieDestinationNoteId = note.tieDestination.id;
3822
- note.tieDestination.tieOriginNoteId = cloneNote.id;
3924
+ cloneNote.tieDestination = note.tieDestination;
3925
+ note.tieDestination.tieOrigin = cloneNote;
3823
3926
  }
3824
3927
  if (note.isTieDestination) {
3825
- cloneNote.tieOriginNoteId = note.tieOrigin ? note.tieOrigin.id : -1;
3826
- note.tieOrigin.tieDestinationNoteId = cloneNote.id;
3928
+ cloneNote.tieOrigin = note.tieOrigin ? note.tieOrigin : null;
3929
+ note.tieOrigin.tieDestination = cloneNote;
3827
3930
  }
3828
3931
  // if the note has a bend which is continued on the next note
3829
3932
  // we need to convert this note into a hold bend
@@ -3876,16 +3979,17 @@
3876
3979
  hasNoteOnString(noteString) {
3877
3980
  return this.noteStringLookup.has(noteString);
3878
3981
  }
3982
+ // TODO: can be likely eliminated
3879
3983
  getNoteWithRealValue(noteRealValue) {
3880
3984
  if (this.noteValueLookup.has(noteRealValue)) {
3881
3985
  return this.noteValueLookup.get(noteRealValue);
3882
3986
  }
3883
3987
  return null;
3884
3988
  }
3885
- chain() {
3989
+ chain(sharedDataBag) {
3886
3990
  for (const n of this.notes) {
3887
3991
  this.noteValueLookup.set(n.realValue, n);
3888
- n.chain();
3992
+ n.chain(sharedDataBag);
3889
3993
  }
3890
3994
  }
3891
3995
  }
@@ -3896,6 +4000,7 @@
3896
4000
  /**
3897
4001
  * A chord definition.
3898
4002
  * @json
4003
+ * @json_strict
3899
4004
  */
3900
4005
  class Chord {
3901
4006
  constructor() {
@@ -4188,6 +4293,7 @@
4188
4293
  * The MasterBar stores information about a bar which affects
4189
4294
  * all tracks.
4190
4295
  * @json
4296
+ * @json_strict
4191
4297
  */
4192
4298
  class MasterBar {
4193
4299
  constructor() {
@@ -4257,8 +4363,9 @@
4257
4363
  this.tempoAutomation = null;
4258
4364
  /**
4259
4365
  * Gets or sets the fermatas for this bar. The key is the offset of the fermata in midi ticks.
4366
+ * @json_add addFermata
4260
4367
  */
4261
- this.fermata = new Map();
4368
+ this.fermata = null;
4262
4369
  /**
4263
4370
  * The timeline position of the voice within the whole score. (unit: midi ticks)
4264
4371
  */
@@ -4300,7 +4407,12 @@
4300
4407
  * @param fermata The fermata.
4301
4408
  */
4302
4409
  addFermata(offset, fermata) {
4303
- this.fermata.set(offset, fermata);
4410
+ let fermataMap = this.fermata;
4411
+ if (fermataMap === null) {
4412
+ fermataMap = new Map();
4413
+ this.fermata = fermataMap;
4414
+ }
4415
+ fermataMap.set(offset, fermata);
4304
4416
  }
4305
4417
  /**
4306
4418
  * Gets the fermata for a given beat.
@@ -4308,8 +4420,12 @@
4308
4420
  * @returns
4309
4421
  */
4310
4422
  getFermata(beat) {
4311
- if (this.fermata.has(beat.playbackStart)) {
4312
- return this.fermata.get(beat.playbackStart);
4423
+ const fermataMap = this.fermata;
4424
+ if (fermataMap === null) {
4425
+ return null;
4426
+ }
4427
+ if (fermataMap.has(beat.playbackStart)) {
4428
+ return fermataMap.get(beat.playbackStart);
4313
4429
  }
4314
4430
  return null;
4315
4431
  }
@@ -4320,6 +4436,7 @@
4320
4436
  * This class represents the rendering stylesheet.
4321
4437
  * It contains settings which control the display of the score when rendered.
4322
4438
  * @json
4439
+ * @json_strict
4323
4440
  */
4324
4441
  class RenderStylesheet {
4325
4442
  constructor() {
@@ -4382,10 +4499,10 @@
4382
4499
  * model. It stores the basic information of
4383
4500
  * a song and stores the sub components.
4384
4501
  * @json
4502
+ * @json_strict
4385
4503
  */
4386
4504
  class Score {
4387
4505
  constructor() {
4388
- this._noteByIdLookup = new Map();
4389
4506
  this._currentRepeatGroup = new RepeatGroup();
4390
4507
  /**
4391
4508
  * The album of this song.
@@ -4485,25 +4602,18 @@
4485
4602
  this.tracks.push(track);
4486
4603
  }
4487
4604
  finish(settings) {
4488
- this._noteByIdLookup.clear();
4605
+ const sharedDataBag = new Map();
4489
4606
  for (let i = 0, j = this.tracks.length; i < j; i++) {
4490
- this.tracks[i].finish(settings);
4607
+ this.tracks[i].finish(settings, sharedDataBag);
4491
4608
  }
4492
4609
  }
4493
- registerNote(note) {
4494
- this._noteByIdLookup.set(note.id, note);
4495
- }
4496
- getNoteById(noteId) {
4497
- return this._noteByIdLookup.has(noteId)
4498
- ? this._noteByIdLookup.get(noteId)
4499
- : null;
4500
- }
4501
4610
  }
4502
4611
 
4503
4612
  /**
4504
4613
  * This public class is used to describe the beginning of a
4505
4614
  * section within a song. It acts like a marker.
4506
4615
  * @json
4616
+ * @json_strict
4507
4617
  */
4508
4618
  class Section {
4509
4619
  constructor() {
@@ -4576,50 +4686,48 @@
4576
4686
  }
4577
4687
  static fromJson(v) {
4578
4688
  switch (typeof v) {
4579
- case 'number':
4580
- {
4581
- const c = new Color(0, 0, 0, 0);
4582
- c.raw = v;
4583
- c.updateRgba();
4584
- return c;
4689
+ case 'number': {
4690
+ const c = new Color(0, 0, 0, 0);
4691
+ c.raw = v;
4692
+ c.updateRgba();
4693
+ return c;
4694
+ }
4695
+ case 'string': {
4696
+ const json = v;
4697
+ if (json.startsWith('#')) {
4698
+ if (json.length === 4) {
4699
+ // #RGB
4700
+ return new Color(parseInt(json.substring(1, 1), 16) * 17, parseInt(json.substring(2, 1), 16) * 17, parseInt(json.substring(3, 1), 16) * 17);
4701
+ }
4702
+ if (json.length === 5) {
4703
+ // #RGBA
4704
+ return new Color(parseInt(json.substring(1, 1), 16) * 17, parseInt(json.substring(2, 1), 16) * 17, parseInt(json.substring(3, 1), 16) * 17, parseInt(json.substring(4, 1), 16) * 17);
4705
+ }
4706
+ if (json.length === 7) {
4707
+ // #RRGGBB
4708
+ return new Color(parseInt(json.substring(1, 2), 16), parseInt(json.substring(3, 2), 16), parseInt(json.substring(5, 2), 16));
4709
+ }
4710
+ if (json.length === 9) {
4711
+ // #RRGGBBAA
4712
+ return new Color(parseInt(json.substring(1, 2), 16), parseInt(json.substring(3, 2), 16), parseInt(json.substring(5, 2), 16), parseInt(json.substring(7, 2), 16));
4713
+ }
4585
4714
  }
4586
- case 'string':
4587
- {
4588
- const json = v;
4589
- if (json.startsWith('#')) {
4590
- if (json.length === 4) {
4591
- // #RGB
4592
- return new Color(parseInt(json.substring(1, 1), 16) * 17, parseInt(json.substring(2, 1), 16) * 17, parseInt(json.substring(3, 1), 16) * 17);
4593
- }
4594
- if (json.length === 5) {
4595
- // #RGBA
4596
- return new Color(parseInt(json.substring(1, 1), 16) * 17, parseInt(json.substring(2, 1), 16) * 17, parseInt(json.substring(3, 1), 16) * 17, parseInt(json.substring(4, 1), 16) * 17);
4597
- }
4598
- if (json.length === 7) {
4599
- // #RRGGBB
4600
- return new Color(parseInt(json.substring(1, 2), 16), parseInt(json.substring(3, 2), 16), parseInt(json.substring(5, 2), 16));
4601
- }
4602
- if (json.length === 9) {
4603
- // #RRGGBBAA
4604
- return new Color(parseInt(json.substring(1, 2), 16), parseInt(json.substring(3, 2), 16), parseInt(json.substring(5, 2), 16), parseInt(json.substring(7, 2), 16));
4605
- }
4715
+ else if (json.startsWith('rgba') || json.startsWith('rgb')) {
4716
+ const start = json.indexOf('(');
4717
+ const end = json.lastIndexOf(')');
4718
+ if (start === -1 || end === -1) {
4719
+ throw new FormatError('No values specified for rgb/rgba function');
4606
4720
  }
4607
- else if (json.startsWith('rgba') || json.startsWith('rgb')) {
4608
- const start = json.indexOf('(');
4609
- const end = json.lastIndexOf(')');
4610
- if (start === -1 || end === -1) {
4611
- throw new FormatError('No values specified for rgb/rgba function');
4612
- }
4613
- const numbers = json.substring(start + 1, end).split(',');
4614
- if (numbers.length === 3) {
4615
- return new Color(parseInt(numbers[0]), parseInt(numbers[1]), parseInt(numbers[2]));
4616
- }
4617
- if (numbers.length === 4) {
4618
- return new Color(parseInt(numbers[0]), parseInt(numbers[1]), parseInt(numbers[2]), parseFloat(numbers[3]) * 255);
4619
- }
4721
+ const numbers = json.substring(start + 1, end).split(',');
4722
+ if (numbers.length === 3) {
4723
+ return new Color(parseInt(numbers[0]), parseInt(numbers[1]), parseInt(numbers[2]));
4724
+ }
4725
+ if (numbers.length === 4) {
4726
+ return new Color(parseInt(numbers[0]), parseInt(numbers[1]), parseInt(numbers[2]), parseFloat(numbers[3]) * 255);
4620
4727
  }
4621
- return null;
4622
4728
  }
4729
+ return null;
4730
+ }
4623
4731
  }
4624
4732
  throw new FormatError('Unsupported format for color');
4625
4733
  }
@@ -4633,6 +4741,7 @@
4633
4741
  * This public class stores the midi specific information of a track needed
4634
4742
  * for playback.
4635
4743
  * @json
4744
+ * @json_strict
4636
4745
  */
4637
4746
  class PlaybackInformation {
4638
4747
  constructor() {
@@ -4674,6 +4783,7 @@
4674
4783
  /**
4675
4784
  * This public class represents a predefined string tuning.
4676
4785
  * @json
4786
+ * @json_strict
4677
4787
  */
4678
4788
  class Tuning {
4679
4789
  /**
@@ -4829,6 +4939,7 @@
4829
4939
  * This class describes a single staff within a track. There are instruments like pianos
4830
4940
  * where a single track can contain multiple staffs.
4831
4941
  * @json
4942
+ * @json_strict
4832
4943
  */
4833
4944
  class Staff {
4834
4945
  constructor() {
@@ -4846,7 +4957,7 @@
4846
4957
  * Gets or sets a list of all chords defined for this staff. {@link Beat.chordId} refers to entries in this lookup.
4847
4958
  * @json_add addChord
4848
4959
  */
4849
- this.chords = new Map();
4960
+ this.chords = null;
4850
4961
  /**
4851
4962
  * Gets or sets the fret on which a capo is set.
4852
4963
  */
@@ -4900,15 +5011,28 @@
4900
5011
  get isStringed() {
4901
5012
  return this.stringTuning.tunings.length > 0;
4902
5013
  }
4903
- finish(settings) {
5014
+ finish(settings, sharedDataBag) {
4904
5015
  this.stringTuning.finish();
4905
5016
  for (let i = 0, j = this.bars.length; i < j; i++) {
4906
- this.bars[i].finish(settings);
5017
+ this.bars[i].finish(settings, sharedDataBag);
4907
5018
  }
4908
5019
  }
4909
5020
  addChord(chordId, chord) {
4910
5021
  chord.staff = this;
4911
- this.chords.set(chordId, chord);
5022
+ let chordMap = this.chords;
5023
+ if (chordMap === null) {
5024
+ chordMap = new Map();
5025
+ this.chords = chordMap;
5026
+ }
5027
+ chordMap.set(chordId, chord);
5028
+ }
5029
+ hasChord(chordId) {
5030
+ var _a, _b;
5031
+ return (_b = (_a = this.chords) === null || _a === void 0 ? void 0 : _a.has(chordId)) !== null && _b !== void 0 ? _b : false;
5032
+ }
5033
+ getChord(chordId) {
5034
+ var _a, _b;
5035
+ return (_b = (_a = this.chords) === null || _a === void 0 ? void 0 : _a.get(chordId)) !== null && _b !== void 0 ? _b : null;
4912
5036
  }
4913
5037
  addBar(bar) {
4914
5038
  let bars = this.bars;
@@ -4926,6 +5050,7 @@
4926
5050
  * This public class describes a single track or instrument of score.
4927
5051
  * It is bascially a list of staffs containing individual music notation kinds.
4928
5052
  * @json
5053
+ * @json_strict
4929
5054
  */
4930
5055
  class Track {
4931
5056
  constructor() {
@@ -4971,7 +5096,7 @@
4971
5096
  staff.track = this;
4972
5097
  this.staves.push(staff);
4973
5098
  }
4974
- finish(settings) {
5099
+ finish(settings, sharedDataBag) {
4975
5100
  if (!this.shortName) {
4976
5101
  this.shortName = this.name;
4977
5102
  if (this.shortName.length > Track.ShortNameMaxLength) {
@@ -4979,7 +5104,7 @@
4979
5104
  }
4980
5105
  }
4981
5106
  for (let i = 0, j = this.staves.length; i < j; i++) {
4982
- this.staves[i].finish(settings);
5107
+ this.staves[i].finish(settings, sharedDataBag);
4983
5108
  }
4984
5109
  }
4985
5110
  applyLyrics(lyrics) {
@@ -5017,6 +5142,7 @@
5017
5142
  * A voice represents a group of beats
5018
5143
  * that can be played during a bar.
5019
5144
  * @json
5145
+ * @json_strict
5020
5146
  */
5021
5147
  class Voice$1 {
5022
5148
  constructor() {
@@ -5057,7 +5183,7 @@
5057
5183
  this.isEmpty = false;
5058
5184
  }
5059
5185
  }
5060
- chain(beat) {
5186
+ chain(beat, sharedDataBag) {
5061
5187
  if (!this.bar) {
5062
5188
  return;
5063
5189
  }
@@ -5075,7 +5201,7 @@
5075
5201
  beat.nextBeat.previousBeat = beat;
5076
5202
  }
5077
5203
  }
5078
- beat.chain();
5204
+ beat.chain(sharedDataBag);
5079
5205
  }
5080
5206
  addGraceBeat(beat) {
5081
5207
  if (this.beats.length === 0) {
@@ -5097,13 +5223,13 @@
5097
5223
  }
5098
5224
  return null;
5099
5225
  }
5100
- finish(settings) {
5226
+ finish(settings, sharedDataBag) {
5101
5227
  this._beatLookup = new Map();
5102
5228
  let currentGraceGroup = null;
5103
5229
  for (let index = 0; index < this.beats.length; index++) {
5104
5230
  let beat = this.beats[index];
5105
5231
  beat.index = index;
5106
- this.chain(beat);
5232
+ this.chain(beat, sharedDataBag);
5107
5233
  if (beat.graceType === GraceType.None) {
5108
5234
  beat.graceGroup = currentGraceGroup;
5109
5235
  if (currentGraceGroup) {
@@ -5123,7 +5249,7 @@
5123
5249
  for (let i = 0; i < this.beats.length; i++) {
5124
5250
  let beat = this.beats[i];
5125
5251
  beat.index = i;
5126
- beat.finish(settings);
5252
+ beat.finish(settings, sharedDataBag);
5127
5253
  // if this beat is a non-grace but has grace notes
5128
5254
  // we need to first steal the duration from the right beat
5129
5255
  // and place the grace beats correctly
@@ -5209,7 +5335,18 @@
5209
5335
  }
5210
5336
  Voice$1._globalBarId = 0;
5211
5337
 
5338
+ /**
5339
+ * @target web
5340
+ */
5212
5341
  class TypeConversions {
5342
+ static float64ToBytes(v) {
5343
+ TypeConversions._dataView.setFloat64(0, v, true);
5344
+ return this._conversionByteArray;
5345
+ }
5346
+ static bytesToFloat64(bytes) {
5347
+ TypeConversions._conversionByteArray.set(bytes, 0);
5348
+ throw TypeConversions._dataView.getFloat64(0, true);
5349
+ }
5213
5350
  static uint16ToInt16(v) {
5214
5351
  TypeConversions._dataView.setUint16(0, v, true);
5215
5352
  return TypeConversions._dataView.getInt16(0, true);
@@ -5236,6 +5373,7 @@
5236
5373
  }
5237
5374
  }
5238
5375
  TypeConversions._conversionBuffer = new ArrayBuffer(8);
5376
+ TypeConversions._conversionByteArray = new Uint8Array(TypeConversions._conversionBuffer);
5239
5377
  TypeConversions._dataView = new DataView(TypeConversions._conversionBuffer);
5240
5378
 
5241
5379
  class IOHelper {
@@ -5374,30 +5512,29 @@
5374
5512
  return decoder.encode(str);
5375
5513
  }
5376
5514
  static writeInt32BE(o, v) {
5377
- o.writeByte((v >> 24) & 0xFF);
5378
- o.writeByte((v >> 16) & 0xFF);
5379
- o.writeByte((v >> 8) & 0xFF);
5380
- o.writeByte((v >> 0) & 0xFF);
5515
+ o.writeByte((v >> 24) & 0xff);
5516
+ o.writeByte((v >> 16) & 0xff);
5517
+ o.writeByte((v >> 8) & 0xff);
5518
+ o.writeByte((v >> 0) & 0xff);
5381
5519
  }
5382
5520
  static writeInt32LE(o, v) {
5383
- o.writeByte((v >> 0) & 0xFF);
5384
- o.writeByte((v >> 8) & 0xFF);
5385
- o.writeByte((v >> 16) & 0xFF);
5386
- o.writeByte((v >> 24) & 0xFF);
5521
+ o.writeByte((v >> 0) & 0xff);
5522
+ o.writeByte((v >> 8) & 0xff);
5523
+ o.writeByte((v >> 16) & 0xff);
5524
+ o.writeByte((v >> 24) & 0xff);
5387
5525
  }
5388
5526
  static writeUInt16LE(o, v) {
5389
- o.writeByte((v >> 0) & 0xFF);
5390
- o.writeByte((v >> 8) & 0xFF);
5527
+ o.writeByte((v >> 0) & 0xff);
5528
+ o.writeByte((v >> 8) & 0xff);
5391
5529
  }
5392
5530
  static writeInt16LE(o, v) {
5393
- o.writeByte((v >> 0) & 0xFF);
5394
- o.writeByte((v >> 8) & 0xFF);
5531
+ o.writeByte((v >> 0) & 0xff);
5532
+ o.writeByte((v >> 8) & 0xff);
5395
5533
  }
5396
5534
  }
5397
5535
 
5398
5536
  class ByteBuffer {
5399
5537
  constructor() {
5400
- this._capacity = 0;
5401
5538
  this.length = 0;
5402
5539
  this.position = 0;
5403
5540
  }
@@ -5413,14 +5550,12 @@
5413
5550
  static withCapacity(capacity) {
5414
5551
  let buffer = new ByteBuffer();
5415
5552
  buffer._buffer = new Uint8Array(capacity);
5416
- buffer._capacity = capacity;
5417
5553
  return buffer;
5418
5554
  }
5419
5555
  static fromBuffer(data) {
5420
5556
  let buffer = new ByteBuffer();
5421
5557
  buffer._buffer = data;
5422
5558
  buffer.length = data.length;
5423
- buffer._capacity = buffer.length;
5424
5559
  return buffer;
5425
5560
  }
5426
5561
  static fromString(contents) {
@@ -5433,18 +5568,6 @@
5433
5568
  skip(offset) {
5434
5569
  this.position += offset;
5435
5570
  }
5436
- setCapacity(value) {
5437
- if (value !== this._capacity) {
5438
- if (value > 0) {
5439
- let newBuffer = new Uint8Array(value);
5440
- if (this.length > 0) {
5441
- newBuffer.set(this._buffer.subarray(0, 0 + this.length), 0);
5442
- }
5443
- this._buffer = newBuffer;
5444
- }
5445
- this._capacity = value;
5446
- }
5447
- }
5448
5571
  readByte() {
5449
5572
  let n = this.length - this.position;
5450
5573
  if (n <= 0) {
@@ -5460,53 +5583,43 @@
5460
5583
  if (n <= 0) {
5461
5584
  return 0;
5462
5585
  }
5463
- if (n <= 8) {
5464
- let byteCount = n;
5465
- while (--byteCount >= 0) {
5466
- buffer[offset + byteCount] = this._buffer[this.position + byteCount];
5467
- }
5468
- }
5469
- else {
5470
- buffer.set(this._buffer.subarray(this.position, this.position + n), offset);
5471
- }
5586
+ buffer.set(this._buffer.subarray(this.position, this.position + n), offset);
5472
5587
  this.position += n;
5473
5588
  return n;
5474
5589
  }
5475
5590
  writeByte(value) {
5476
- let buffer = new Uint8Array(1);
5477
- buffer[0] = value;
5478
- this.write(buffer, 0, 1);
5591
+ let i = this.position + 1;
5592
+ this.ensureCapacity(i);
5593
+ this._buffer[this.position] = value & 0xFF;
5594
+ if (i > this.length) {
5595
+ this.length = i;
5596
+ }
5597
+ this.position = i;
5479
5598
  }
5480
5599
  write(buffer, offset, count) {
5481
5600
  let i = this.position + count;
5601
+ this.ensureCapacity(i);
5602
+ let count1 = Math.min(count, buffer.length - offset);
5603
+ this._buffer.set(buffer.subarray(offset, offset + count1), this.position);
5482
5604
  if (i > this.length) {
5483
- if (i > this._capacity) {
5484
- this.ensureCapacity(i);
5485
- }
5486
5605
  this.length = i;
5487
5606
  }
5488
- if (count <= 8 && buffer !== this._buffer) {
5489
- let byteCount = count;
5490
- while (--byteCount >= 0) {
5491
- this._buffer[this.position + byteCount] = buffer[offset + byteCount];
5492
- }
5493
- }
5494
- else {
5495
- let count1 = Math.min(count, buffer.length - offset);
5496
- this._buffer.set(buffer.subarray(offset, offset + count1), this.position);
5497
- }
5498
5607
  this.position = i;
5499
5608
  }
5500
5609
  ensureCapacity(value) {
5501
- if (value > this._capacity) {
5610
+ if (value > this._buffer.length) {
5502
5611
  let newCapacity = value;
5503
5612
  if (newCapacity < 256) {
5504
5613
  newCapacity = 256;
5505
5614
  }
5506
- if (newCapacity < this._capacity * 2) {
5507
- newCapacity = this._capacity * 2;
5615
+ if (newCapacity < this._buffer.length * 2) {
5616
+ newCapacity = this._buffer.length * 2;
5617
+ }
5618
+ let newBuffer = new Uint8Array(newCapacity);
5619
+ if (this.length > 0) {
5620
+ newBuffer.set(this._buffer.subarray(0, 0 + this.length), 0);
5508
5621
  }
5509
- this.setCapacity(newCapacity);
5622
+ this._buffer = newBuffer;
5510
5623
  }
5511
5624
  }
5512
5625
  readAll() {
@@ -6167,6 +6280,7 @@
6167
6280
  return anyMeta;
6168
6281
  }
6169
6282
  handleStaffMeta() {
6283
+ var _a, _b;
6170
6284
  let syData = this._syData.toLowerCase();
6171
6285
  switch (syData) {
6172
6286
  case 'capo':
@@ -6210,7 +6324,7 @@
6210
6324
  this.error('tuning', AlphaTexSymbols.Tuning, true);
6211
6325
  break;
6212
6326
  }
6213
- if (strings !== this._currentStaff.tuning.length && this._currentStaff.chords.size > 0) {
6327
+ if (strings !== this._currentStaff.tuning.length && ((_b = (_a = this._currentStaff.chords) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0) > 0) {
6214
6328
  this.errorMessage('Tuning must be defined before any chord');
6215
6329
  }
6216
6330
  return true;
@@ -6761,23 +6875,25 @@
6761
6875
  beat.addWhammyBarPoint(new BendPoint(offset, value));
6762
6876
  this._sy = this.newSy();
6763
6877
  }
6764
- while (beat.whammyBarPoints.length > 60) {
6765
- beat.removeWhammyBarPoint(beat.whammyBarPoints.length - 1);
6766
- }
6767
- // set positions
6768
- if (!exact) {
6769
- let count = beat.whammyBarPoints.length;
6770
- let step = (60 / count) | 0;
6771
- let i = 0;
6772
- while (i < count) {
6773
- beat.whammyBarPoints[i].offset = Math.min(60, i * step);
6774
- i++;
6878
+ if (beat.whammyBarPoints != null) {
6879
+ while (beat.whammyBarPoints.length > 60) {
6880
+ beat.removeWhammyBarPoint(beat.whammyBarPoints.length - 1);
6881
+ }
6882
+ // set positions
6883
+ if (!exact) {
6884
+ let count = beat.whammyBarPoints.length;
6885
+ let step = (60 / count) | 0;
6886
+ let i = 0;
6887
+ while (i < count) {
6888
+ beat.whammyBarPoints[i].offset = Math.min(60, i * step);
6889
+ i++;
6890
+ }
6891
+ }
6892
+ else {
6893
+ beat.whammyBarPoints.sort((a, b) => {
6894
+ return a.offset - b.offset;
6895
+ });
6775
6896
  }
6776
- }
6777
- else {
6778
- beat.whammyBarPoints.sort((a, b) => {
6779
- return a.offset - b.offset;
6780
- });
6781
6897
  }
6782
6898
  this._allowNegatives = false;
6783
6899
  if (this._sy !== AlphaTexSymbols.RParensis) {
@@ -6791,7 +6907,7 @@
6791
6907
  this._sy = this.newSy();
6792
6908
  let chordName = this._syData;
6793
6909
  let chordId = this.getChordId(this._currentStaff, chordName);
6794
- if (!this._currentStaff.chords.has(chordId)) {
6910
+ if (!this._currentStaff.hasChord(chordId)) {
6795
6911
  let chord = new Chord();
6796
6912
  chord.showDiagram = false;
6797
6913
  chord.name = chordName;
@@ -7034,22 +7150,25 @@
7034
7150
  note.addBendPoint(new BendPoint(offset, value));
7035
7151
  this._sy = this.newSy();
7036
7152
  }
7037
- while (note.bendPoints.length > 60) {
7038
- note.bendPoints.splice(note.bendPoints.length - 1, 1);
7039
- }
7040
- // set positions
7041
- if (exact) {
7042
- note.bendPoints.sort((a, b) => {
7043
- return a.offset - b.offset;
7044
- });
7045
- }
7046
- else {
7047
- let count = note.bendPoints.length;
7048
- let step = (60 / (count - 1)) | 0;
7049
- let i = 0;
7050
- while (i < count) {
7051
- note.bendPoints[i].offset = Math.min(60, i * step);
7052
- i++;
7153
+ const points = note.bendPoints;
7154
+ if (points != null) {
7155
+ while (points.length > 60) {
7156
+ points.splice(points.length - 1, 1);
7157
+ }
7158
+ // set positions
7159
+ if (exact) {
7160
+ points.sort((a, b) => {
7161
+ return a.offset - b.offset;
7162
+ });
7163
+ }
7164
+ else {
7165
+ let count = points.length;
7166
+ let step = (60 / (count - 1)) | 0;
7167
+ let i = 0;
7168
+ while (i < count) {
7169
+ points[i].offset = Math.min(60, i * step);
7170
+ i++;
7171
+ }
7053
7172
  }
7054
7173
  }
7055
7174
  if (this._sy !== AlphaTexSymbols.RParensis) {
@@ -8785,6 +8904,7 @@
8785
8904
  /**
8786
8905
  * Represents a fermata.
8787
8906
  * @json
8907
+ * @json_strict
8788
8908
  */
8789
8909
  class Fermata {
8790
8910
  constructor() {
@@ -12346,7 +12466,8 @@
12346
12466
  super(exports.AlphaTabErrorType.Format, 'Unexpected end of data within reader');
12347
12467
  Object.setPrototypeOf(this, EndOfReaderError.prototype);
12348
12468
  }
12349
- }
12469
+ }
12470
+
12350
12471
  /**
12351
12472
  * This utility public class allows bitwise reading of a stream
12352
12473
  */
@@ -13428,7 +13549,7 @@
13428
13549
  }
13429
13550
  else if (element.getAttribute('type') === 'stop' && this._tieStarts.length > 0 && !note.isTieDestination) {
13430
13551
  note.isTieDestination = true;
13431
- note.tieOriginNoteId = this._tieStarts[0].id;
13552
+ note.tieOrigin = this._tieStarts[0];
13432
13553
  this._tieStarts.splice(0, 1);
13433
13554
  this._tieStartIds.delete(note.id);
13434
13555
  }
@@ -13471,8 +13592,8 @@
13471
13592
  if (this._slurStarts.has(slurNumber)) {
13472
13593
  note.isSlurDestination = true;
13473
13594
  let slurStart = this._slurStarts.get(slurNumber);
13474
- slurStart.slurDestinationNoteId = note.id;
13475
- note.slurOriginNoteId = note.id;
13595
+ slurStart.slurDestination = note;
13596
+ note.slurOrigin = note;
13476
13597
  }
13477
13598
  break;
13478
13599
  }
@@ -17828,8 +17949,7 @@
17828
17949
  }
17829
17950
  else if (parts.length >= 1) {
17830
17951
  this.size = parts[0];
17831
- if (this._currentToken &&
17832
- this._currentToken.text.indexOf('/') === 0) {
17952
+ if (this._currentToken && this._currentToken.text.indexOf('/') === 0) {
17833
17953
  // size / line-height (with spaces befor and after slash)
17834
17954
  if (this._currentToken.text === '/') {
17835
17955
  this.nextToken();
@@ -18495,20 +18615,20 @@
18495
18615
  }
18496
18616
  const o = new Map();
18497
18617
  /*@target web*/
18498
- o.set("scriptFile", obj.scriptFile);
18618
+ o.set("scriptfile", obj.scriptFile);
18499
18619
  /*@target web*/
18500
- o.set("fontDirectory", obj.fontDirectory);
18620
+ o.set("fontdirectory", obj.fontDirectory);
18501
18621
  /*@target web*/
18502
18622
  o.set("file", obj.file);
18503
18623
  /*@target web*/
18504
18624
  o.set("tex", obj.tex);
18505
18625
  /*@target web*/
18506
18626
  o.set("tracks", obj.tracks);
18507
- o.set("enableLazyLoading", obj.enableLazyLoading);
18627
+ o.set("enablelazyloading", obj.enableLazyLoading);
18508
18628
  o.set("engine", obj.engine);
18509
- o.set("logLevel", obj.logLevel);
18510
- o.set("useWorkers", obj.useWorkers);
18511
- o.set("includeNoteBounds", obj.includeNoteBounds);
18629
+ o.set("loglevel", obj.logLevel);
18630
+ o.set("useworkers", obj.useWorkers);
18631
+ o.set("includenotebounds", obj.includeNoteBounds);
18512
18632
  return o;
18513
18633
  }
18514
18634
  static setProperty(obj, property, v) {
@@ -18565,23 +18685,23 @@
18565
18685
  return null;
18566
18686
  }
18567
18687
  const o = new Map();
18568
- o.set("copyrightFont", Font.toJson(obj.copyrightFont));
18569
- o.set("titleFont", Font.toJson(obj.titleFont));
18570
- o.set("subTitleFont", Font.toJson(obj.subTitleFont));
18571
- o.set("wordsFont", Font.toJson(obj.wordsFont));
18572
- o.set("effectFont", Font.toJson(obj.effectFont));
18573
- o.set("fretboardNumberFont", Font.toJson(obj.fretboardNumberFont));
18574
- o.set("tablatureFont", Font.toJson(obj.tablatureFont));
18575
- o.set("graceFont", Font.toJson(obj.graceFont));
18576
- o.set("staffLineColor", Color.toJson(obj.staffLineColor));
18577
- o.set("barSeparatorColor", Color.toJson(obj.barSeparatorColor));
18578
- o.set("barNumberFont", Font.toJson(obj.barNumberFont));
18579
- o.set("barNumberColor", Color.toJson(obj.barNumberColor));
18580
- o.set("fingeringFont", Font.toJson(obj.fingeringFont));
18581
- o.set("markerFont", Font.toJson(obj.markerFont));
18582
- o.set("mainGlyphColor", Color.toJson(obj.mainGlyphColor));
18583
- o.set("secondaryGlyphColor", Color.toJson(obj.secondaryGlyphColor));
18584
- o.set("scoreInfoColor", Color.toJson(obj.scoreInfoColor));
18688
+ o.set("copyrightfont", Font.toJson(obj.copyrightFont));
18689
+ o.set("titlefont", Font.toJson(obj.titleFont));
18690
+ o.set("subtitlefont", Font.toJson(obj.subTitleFont));
18691
+ o.set("wordsfont", Font.toJson(obj.wordsFont));
18692
+ o.set("effectfont", Font.toJson(obj.effectFont));
18693
+ o.set("fretboardnumberfont", Font.toJson(obj.fretboardNumberFont));
18694
+ o.set("tablaturefont", Font.toJson(obj.tablatureFont));
18695
+ o.set("gracefont", Font.toJson(obj.graceFont));
18696
+ o.set("stafflinecolor", Color.toJson(obj.staffLineColor));
18697
+ o.set("barseparatorcolor", Color.toJson(obj.barSeparatorColor));
18698
+ o.set("barnumberfont", Font.toJson(obj.barNumberFont));
18699
+ o.set("barnumbercolor", Color.toJson(obj.barNumberColor));
18700
+ o.set("fingeringfont", Font.toJson(obj.fingeringFont));
18701
+ o.set("markerfont", Font.toJson(obj.markerFont));
18702
+ o.set("mainglyphcolor", Color.toJson(obj.mainGlyphColor));
18703
+ o.set("secondaryglyphcolor", Color.toJson(obj.secondaryGlyphColor));
18704
+ o.set("scoreinfocolor", Color.toJson(obj.scoreInfoColor));
18585
18705
  return o;
18586
18706
  }
18587
18707
  static setProperty(obj, property, v) {
@@ -18655,13 +18775,13 @@
18655
18775
  }
18656
18776
  const o = new Map();
18657
18777
  o.set("scale", obj.scale);
18658
- o.set("stretchForce", obj.stretchForce);
18659
- o.set("layoutMode", obj.layoutMode);
18660
- o.set("staveProfile", obj.staveProfile);
18661
- o.set("barsPerRow", obj.barsPerRow);
18662
- o.set("startBar", obj.startBar);
18663
- o.set("barCount", obj.barCount);
18664
- o.set("barCountPerPartial", obj.barCountPerPartial);
18778
+ o.set("stretchforce", obj.stretchForce);
18779
+ o.set("layoutmode", obj.layoutMode);
18780
+ o.set("staveprofile", obj.staveProfile);
18781
+ o.set("barsperrow", obj.barsPerRow);
18782
+ o.set("startbar", obj.startBar);
18783
+ o.set("barcount", obj.barCount);
18784
+ o.set("barcountperpartial", obj.barCountPerPartial);
18665
18785
  o.set("resources", RenderingResourcesSerializer.toJson(obj.resources));
18666
18786
  o.set("padding", obj.padding);
18667
18787
  return o;
@@ -18725,8 +18845,8 @@
18725
18845
  return null;
18726
18846
  }
18727
18847
  const o = new Map();
18728
- o.set("notationMode", obj.notationMode);
18729
- o.set("fingeringMode", obj.fingeringMode);
18848
+ o.set("notationmode", obj.notationMode);
18849
+ o.set("fingeringmode", obj.fingeringMode);
18730
18850
  {
18731
18851
  const m = new Map();
18732
18852
  o.set("elements", m);
@@ -18734,14 +18854,14 @@
18734
18854
  m.set(k.toString(), v);
18735
18855
  }
18736
18856
  }
18737
- o.set("rhythmMode", obj.rhythmMode);
18738
- o.set("rhythmHeight", obj.rhythmHeight);
18739
- o.set("transpositionPitches", obj.transpositionPitches);
18740
- o.set("displayTranspositionPitches", obj.displayTranspositionPitches);
18741
- o.set("smallGraceTabNotes", obj.smallGraceTabNotes);
18742
- o.set("extendBendArrowsOnTiedNotes", obj.extendBendArrowsOnTiedNotes);
18743
- o.set("extendLineEffectsToBeatEnd", obj.extendLineEffectsToBeatEnd);
18744
- o.set("slurHeight", obj.slurHeight);
18857
+ o.set("rhythmmode", obj.rhythmMode);
18858
+ o.set("rhythmheight", obj.rhythmHeight);
18859
+ o.set("transpositionpitches", obj.transpositionPitches);
18860
+ o.set("displaytranspositionpitches", obj.displayTranspositionPitches);
18861
+ o.set("smallgracetabnotes", obj.smallGraceTabNotes);
18862
+ o.set("extendbendarrowsontiednotes", obj.extendBendArrowsOnTiedNotes);
18863
+ o.set("extendlineeffectstobeatend", obj.extendLineEffectsToBeatEnd);
18864
+ o.set("slurheight", obj.slurHeight);
18745
18865
  return o;
18746
18866
  }
18747
18867
  static setProperty(obj, property, v) {
@@ -18800,8 +18920,8 @@
18800
18920
  }
18801
18921
  const o = new Map();
18802
18922
  o.set("encoding", obj.encoding);
18803
- o.set("mergePartGroupsInMusicXml", obj.mergePartGroupsInMusicXml);
18804
- o.set("beatTextAsLyrics", obj.beatTextAsLyrics);
18923
+ o.set("mergepartgroupsinmusicxml", obj.mergePartGroupsInMusicXml);
18924
+ o.set("beattextaslyrics", obj.beatTextAsLyrics);
18805
18925
  return o;
18806
18926
  }
18807
18927
  static setProperty(obj, property, v) {
@@ -18832,14 +18952,14 @@
18832
18952
  return null;
18833
18953
  }
18834
18954
  const o = new Map();
18835
- o.set("noteWideLength", obj.noteWideLength);
18836
- o.set("noteWideAmplitude", obj.noteWideAmplitude);
18837
- o.set("noteSlightLength", obj.noteSlightLength);
18838
- o.set("noteSlightAmplitude", obj.noteSlightAmplitude);
18839
- o.set("beatWideLength", obj.beatWideLength);
18840
- o.set("beatWideAmplitude", obj.beatWideAmplitude);
18841
- o.set("beatSlightLength", obj.beatSlightLength);
18842
- o.set("beatSlightAmplitude", obj.beatSlightAmplitude);
18955
+ o.set("notewidelength", obj.noteWideLength);
18956
+ o.set("notewideamplitude", obj.noteWideAmplitude);
18957
+ o.set("noteslightlength", obj.noteSlightLength);
18958
+ o.set("noteslightamplitude", obj.noteSlightAmplitude);
18959
+ o.set("beatwidelength", obj.beatWideLength);
18960
+ o.set("beatwideamplitude", obj.beatWideAmplitude);
18961
+ o.set("beatslightlength", obj.beatSlightLength);
18962
+ o.set("beatslightamplitude", obj.beatSlightAmplitude);
18843
18963
  return o;
18844
18964
  }
18845
18965
  static setProperty(obj, property, v) {
@@ -18885,9 +19005,9 @@
18885
19005
  return null;
18886
19006
  }
18887
19007
  const o = new Map();
18888
- o.set("simpleSlidePitchOffset", obj.simpleSlidePitchOffset);
18889
- o.set("simpleSlideDurationRatio", obj.simpleSlideDurationRatio);
18890
- o.set("shiftSlideDurationRatio", obj.shiftSlideDurationRatio);
19008
+ o.set("simpleslidepitchoffset", obj.simpleSlidePitchOffset);
19009
+ o.set("simpleslidedurationratio", obj.simpleSlideDurationRatio);
19010
+ o.set("shiftslidedurationratio", obj.shiftSlideDurationRatio);
18891
19011
  return o;
18892
19012
  }
18893
19013
  static setProperty(obj, property, v) {
@@ -18918,24 +19038,24 @@
18918
19038
  return null;
18919
19039
  }
18920
19040
  const o = new Map();
18921
- o.set("soundFont", obj.soundFont);
18922
- o.set("scrollElement", obj.scrollElement);
18923
- o.set("enablePlayer", obj.enablePlayer);
18924
- o.set("enableCursor", obj.enableCursor);
18925
- o.set("enableAnimatedBeatCursor", obj.enableAnimatedBeatCursor);
18926
- o.set("enableElementHighlighting", obj.enableElementHighlighting);
18927
- o.set("enableUserInteraction", obj.enableUserInteraction);
18928
- o.set("scrollOffsetX", obj.scrollOffsetX);
18929
- o.set("scrollOffsetY", obj.scrollOffsetY);
18930
- o.set("scrollMode", obj.scrollMode);
18931
- o.set("scrollSpeed", obj.scrollSpeed);
19041
+ o.set("soundfont", obj.soundFont);
19042
+ o.set("scrollelement", obj.scrollElement);
19043
+ o.set("enableplayer", obj.enablePlayer);
19044
+ o.set("enablecursor", obj.enableCursor);
19045
+ o.set("enableanimatedbeatcursor", obj.enableAnimatedBeatCursor);
19046
+ o.set("enableelementhighlighting", obj.enableElementHighlighting);
19047
+ o.set("enableuserinteraction", obj.enableUserInteraction);
19048
+ o.set("scrolloffsetx", obj.scrollOffsetX);
19049
+ o.set("scrolloffsety", obj.scrollOffsetY);
19050
+ o.set("scrollmode", obj.scrollMode);
19051
+ o.set("scrollspeed", obj.scrollSpeed);
18932
19052
  /*@target web*/
18933
- o.set("nativeBrowserSmoothScroll", obj.nativeBrowserSmoothScroll);
18934
- o.set("songBookBendDuration", obj.songBookBendDuration);
18935
- o.set("songBookDipDuration", obj.songBookDipDuration);
19053
+ o.set("nativebrowsersmoothscroll", obj.nativeBrowserSmoothScroll);
19054
+ o.set("songbookbendduration", obj.songBookBendDuration);
19055
+ o.set("songbookdipduration", obj.songBookDipDuration);
18936
19056
  o.set("vibrato", VibratoPlaybackSettingsSerializer.toJson(obj.vibrato));
18937
19057
  o.set("slide", SlidePlaybackSettingsSerializer.toJson(obj.slide));
18938
- o.set("playTripletFeel", obj.playTripletFeel);
19058
+ o.set("playtripletfeel", obj.playTripletFeel);
18939
19059
  return o;
18940
19060
  }
18941
19061
  static setProperty(obj, property, v) {
@@ -19197,7 +19317,7 @@
19197
19317
  if (!m) {
19198
19318
  return;
19199
19319
  }
19200
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19320
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19201
19321
  }
19202
19322
  static toJson(obj) {
19203
19323
  if (!obj) {
@@ -19226,17 +19346,17 @@
19226
19346
  if (!m) {
19227
19347
  return;
19228
19348
  }
19229
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19349
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19230
19350
  }
19231
19351
  static toJson(obj) {
19232
19352
  if (!obj) {
19233
19353
  return null;
19234
19354
  }
19235
19355
  const o = new Map();
19236
- o.set("isLinear", obj.isLinear);
19356
+ o.set("islinear", obj.isLinear);
19237
19357
  o.set("type", obj.type);
19238
19358
  o.set("value", obj.value);
19239
- o.set("ratioPosition", obj.ratioPosition);
19359
+ o.set("ratioposition", obj.ratioPosition);
19240
19360
  o.set("text", obj.text);
19241
19361
  return o;
19242
19362
  }
@@ -19267,7 +19387,7 @@
19267
19387
  if (!m) {
19268
19388
  return;
19269
19389
  }
19270
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19390
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19271
19391
  }
19272
19392
  static toJson(obj) {
19273
19393
  if (!obj) {
@@ -19296,26 +19416,26 @@
19296
19416
  if (!m) {
19297
19417
  return;
19298
19418
  }
19299
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19419
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19300
19420
  }
19301
19421
  static toJson(obj) {
19302
19422
  if (!obj) {
19303
19423
  return null;
19304
19424
  }
19305
19425
  const o = new Map();
19306
- o.set("alternateEndings", obj.alternateEndings);
19307
- o.set("keySignature", obj.keySignature);
19308
- o.set("keySignatureType", obj.keySignatureType);
19309
- o.set("isDoubleBar", obj.isDoubleBar);
19310
- o.set("isRepeatStart", obj.isRepeatStart);
19311
- o.set("repeatCount", obj.repeatCount);
19312
- o.set("timeSignatureNumerator", obj.timeSignatureNumerator);
19313
- o.set("timeSignatureDenominator", obj.timeSignatureDenominator);
19314
- o.set("timeSignatureCommon", obj.timeSignatureCommon);
19315
- o.set("tripletFeel", obj.tripletFeel);
19426
+ o.set("alternateendings", obj.alternateEndings);
19427
+ o.set("keysignature", obj.keySignature);
19428
+ o.set("keysignaturetype", obj.keySignatureType);
19429
+ o.set("isdoublebar", obj.isDoubleBar);
19430
+ o.set("isrepeatstart", obj.isRepeatStart);
19431
+ o.set("repeatcount", obj.repeatCount);
19432
+ o.set("timesignaturenumerator", obj.timeSignatureNumerator);
19433
+ o.set("timesignaturedenominator", obj.timeSignatureDenominator);
19434
+ o.set("timesignaturecommon", obj.timeSignatureCommon);
19435
+ o.set("tripletfeel", obj.tripletFeel);
19316
19436
  o.set("section", SectionSerializer.toJson(obj.section));
19317
- o.set("tempoAutomation", AutomationSerializer.toJson(obj.tempoAutomation));
19318
- {
19437
+ o.set("tempoautomation", AutomationSerializer.toJson(obj.tempoAutomation));
19438
+ if (obj.fermata !== null) {
19319
19439
  const m = new Map();
19320
19440
  o.set("fermata", m);
19321
19441
  for (const [k, v] of obj.fermata) {
@@ -19323,7 +19443,7 @@
19323
19443
  }
19324
19444
  }
19325
19445
  o.set("start", obj.start);
19326
- o.set("isAnacrusis", obj.isAnacrusis);
19446
+ o.set("isanacrusis", obj.isAnacrusis);
19327
19447
  return o;
19328
19448
  }
19329
19449
  static setProperty(obj, property, v) {
@@ -19363,7 +19483,7 @@
19363
19483
  JsonHelper.forEach(v, (v, k) => {
19364
19484
  const i = new Fermata();
19365
19485
  FermataSerializer.fromJson(i, v);
19366
- obj.fermata.set(parseInt(k), i);
19486
+ obj.addFermata(parseInt(k), i);
19367
19487
  });
19368
19488
  return true;
19369
19489
  case "start":
@@ -19402,7 +19522,7 @@
19402
19522
  if (!m) {
19403
19523
  return;
19404
19524
  }
19405
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19525
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19406
19526
  }
19407
19527
  static toJson(obj) {
19408
19528
  if (!obj) {
@@ -19431,53 +19551,51 @@
19431
19551
  if (!m) {
19432
19552
  return;
19433
19553
  }
19434
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19554
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19435
19555
  }
19436
19556
  static toJson(obj) {
19557
+ var _a;
19437
19558
  if (!obj) {
19438
19559
  return null;
19439
19560
  }
19440
19561
  const o = new Map();
19441
19562
  o.set("id", obj.id);
19442
19563
  o.set("accentuated", obj.accentuated);
19443
- o.set("bendType", obj.bendType);
19444
- o.set("bendStyle", obj.bendStyle);
19445
- o.set("isContinuedBend", obj.isContinuedBend);
19446
- o.set("bendPoints", obj.bendPoints.map(i => BendPointSerializer.toJson(i)));
19564
+ o.set("bendtype", obj.bendType);
19565
+ o.set("bendstyle", obj.bendStyle);
19566
+ o.set("iscontinuedbend", obj.isContinuedBend);
19567
+ if (obj.bendPoints !== null) {
19568
+ o.set("bendpoints", (_a = obj.bendPoints) === null || _a === void 0 ? void 0 : _a.map(i => BendPointSerializer.toJson(i)));
19569
+ }
19447
19570
  o.set("fret", obj.fret);
19448
19571
  o.set("string", obj.string);
19449
19572
  o.set("octave", obj.octave);
19450
19573
  o.set("tone", obj.tone);
19451
- o.set("percussionArticulation", obj.percussionArticulation);
19452
- o.set("isVisible", obj.isVisible);
19453
- o.set("isLeftHandTapped", obj.isLeftHandTapped);
19454
- o.set("isHammerPullOrigin", obj.isHammerPullOrigin);
19455
- o.set("hammerPullOriginNoteId", obj.hammerPullOriginNoteId);
19456
- o.set("hammerPullDestinationNoteId", obj.hammerPullDestinationNoteId);
19457
- o.set("isSlurDestination", obj.isSlurDestination);
19458
- o.set("slurOriginNoteId", obj.slurOriginNoteId);
19459
- o.set("slurDestinationNoteId", obj.slurDestinationNoteId);
19460
- o.set("harmonicType", obj.harmonicType);
19461
- o.set("harmonicValue", obj.harmonicValue);
19462
- o.set("isGhost", obj.isGhost);
19463
- o.set("isLetRing", obj.isLetRing);
19464
- o.set("isPalmMute", obj.isPalmMute);
19465
- o.set("isDead", obj.isDead);
19466
- o.set("isStaccato", obj.isStaccato);
19467
- o.set("slideInType", obj.slideInType);
19468
- o.set("slideOutType", obj.slideOutType);
19574
+ o.set("percussionarticulation", obj.percussionArticulation);
19575
+ o.set("isvisible", obj.isVisible);
19576
+ o.set("islefthandtapped", obj.isLeftHandTapped);
19577
+ o.set("ishammerpullorigin", obj.isHammerPullOrigin);
19578
+ o.set("isslurdestination", obj.isSlurDestination);
19579
+ o.set("harmonictype", obj.harmonicType);
19580
+ o.set("harmonicvalue", obj.harmonicValue);
19581
+ o.set("isghost", obj.isGhost);
19582
+ o.set("isletring", obj.isLetRing);
19583
+ o.set("ispalmmute", obj.isPalmMute);
19584
+ o.set("isdead", obj.isDead);
19585
+ o.set("isstaccato", obj.isStaccato);
19586
+ o.set("slideintype", obj.slideInType);
19587
+ o.set("slideouttype", obj.slideOutType);
19469
19588
  o.set("vibrato", obj.vibrato);
19470
- o.set("tieOriginNoteId", obj.tieOriginNoteId);
19471
- o.set("tieDestinationNoteId", obj.tieDestinationNoteId);
19472
- o.set("isTieDestination", obj.isTieDestination);
19473
- o.set("leftHandFinger", obj.leftHandFinger);
19474
- o.set("rightHandFinger", obj.rightHandFinger);
19475
- o.set("isFingering", obj.isFingering);
19476
- o.set("trillValue", obj.trillValue);
19477
- o.set("trillSpeed", obj.trillSpeed);
19478
- o.set("durationPercent", obj.durationPercent);
19479
- o.set("accidentalMode", obj.accidentalMode);
19589
+ o.set("istiedestination", obj.isTieDestination);
19590
+ o.set("lefthandfinger", obj.leftHandFinger);
19591
+ o.set("righthandfinger", obj.rightHandFinger);
19592
+ o.set("isfingering", obj.isFingering);
19593
+ o.set("trillvalue", obj.trillValue);
19594
+ o.set("trillspeed", obj.trillSpeed);
19595
+ o.set("durationpercent", obj.durationPercent);
19596
+ o.set("accidentalmode", obj.accidentalMode);
19480
19597
  o.set("dynamics", obj.dynamics);
19598
+ obj.toJson(o);
19481
19599
  return o;
19482
19600
  }
19483
19601
  static setProperty(obj, property, v) {
@@ -19498,11 +19616,13 @@
19498
19616
  obj.isContinuedBend = v;
19499
19617
  return true;
19500
19618
  case "bendpoints":
19501
- obj.bendPoints = [];
19502
- for (const o of v) {
19503
- const i = new BendPoint();
19504
- BendPointSerializer.fromJson(i, o);
19505
- obj.addBendPoint(i);
19619
+ if (v) {
19620
+ obj.bendPoints = [];
19621
+ for (const o of v) {
19622
+ const i = new BendPoint();
19623
+ BendPointSerializer.fromJson(i, o);
19624
+ obj.addBendPoint(i);
19625
+ }
19506
19626
  }
19507
19627
  return true;
19508
19628
  case "fret":
@@ -19529,21 +19649,9 @@
19529
19649
  case "ishammerpullorigin":
19530
19650
  obj.isHammerPullOrigin = v;
19531
19651
  return true;
19532
- case "hammerpulloriginnoteid":
19533
- obj.hammerPullOriginNoteId = v;
19534
- return true;
19535
- case "hammerpulldestinationnoteid":
19536
- obj.hammerPullDestinationNoteId = v;
19537
- return true;
19538
19652
  case "isslurdestination":
19539
19653
  obj.isSlurDestination = v;
19540
19654
  return true;
19541
- case "sluroriginnoteid":
19542
- obj.slurOriginNoteId = v;
19543
- return true;
19544
- case "slurdestinationnoteid":
19545
- obj.slurDestinationNoteId = v;
19546
- return true;
19547
19655
  case "harmonictype":
19548
19656
  obj.harmonicType = JsonHelper.parseEnum(v, HarmonicType);
19549
19657
  return true;
@@ -19574,12 +19682,6 @@
19574
19682
  case "vibrato":
19575
19683
  obj.vibrato = JsonHelper.parseEnum(v, VibratoType);
19576
19684
  return true;
19577
- case "tieoriginnoteid":
19578
- obj.tieOriginNoteId = v;
19579
- return true;
19580
- case "tiedestinationnoteid":
19581
- obj.tieDestinationNoteId = v;
19582
- return true;
19583
19685
  case "istiedestination":
19584
19686
  obj.isTieDestination = v;
19585
19687
  return true;
@@ -19608,7 +19710,7 @@
19608
19710
  obj.dynamics = JsonHelper.parseEnum(v, DynamicValue);
19609
19711
  return true;
19610
19712
  }
19611
- return false;
19713
+ return obj.setProperty(property, v);
19612
19714
  }
19613
19715
  }
19614
19716
 
@@ -19617,50 +19719,53 @@
19617
19719
  if (!m) {
19618
19720
  return;
19619
19721
  }
19620
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19722
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19621
19723
  }
19622
19724
  static toJson(obj) {
19725
+ var _a;
19623
19726
  if (!obj) {
19624
19727
  return null;
19625
19728
  }
19626
19729
  const o = new Map();
19627
19730
  o.set("id", obj.id);
19628
19731
  o.set("notes", obj.notes.map(i => NoteSerializer.toJson(i)));
19629
- o.set("isEmpty", obj.isEmpty);
19630
- o.set("whammyStyle", obj.whammyStyle);
19732
+ o.set("isempty", obj.isEmpty);
19733
+ o.set("whammystyle", obj.whammyStyle);
19631
19734
  o.set("ottava", obj.ottava);
19632
- o.set("isLegatoOrigin", obj.isLegatoOrigin);
19735
+ o.set("islegatoorigin", obj.isLegatoOrigin);
19633
19736
  o.set("duration", obj.duration);
19634
19737
  o.set("automations", obj.automations.map(i => AutomationSerializer.toJson(i)));
19635
19738
  o.set("dots", obj.dots);
19636
- o.set("fadeIn", obj.fadeIn);
19739
+ o.set("fadein", obj.fadeIn);
19637
19740
  o.set("lyrics", obj.lyrics);
19638
- o.set("hasRasgueado", obj.hasRasgueado);
19741
+ o.set("hasrasgueado", obj.hasRasgueado);
19639
19742
  o.set("pop", obj.pop);
19640
19743
  o.set("slap", obj.slap);
19641
19744
  o.set("tap", obj.tap);
19642
19745
  o.set("text", obj.text);
19643
- o.set("brushType", obj.brushType);
19644
- o.set("brushDuration", obj.brushDuration);
19645
- o.set("tupletDenominator", obj.tupletDenominator);
19646
- o.set("tupletNumerator", obj.tupletNumerator);
19647
- o.set("isContinuedWhammy", obj.isContinuedWhammy);
19648
- o.set("whammyBarType", obj.whammyBarType);
19649
- o.set("whammyBarPoints", obj.whammyBarPoints.map(i => BendPointSerializer.toJson(i)));
19746
+ o.set("brushtype", obj.brushType);
19747
+ o.set("brushduration", obj.brushDuration);
19748
+ o.set("tupletdenominator", obj.tupletDenominator);
19749
+ o.set("tupletnumerator", obj.tupletNumerator);
19750
+ o.set("iscontinuedwhammy", obj.isContinuedWhammy);
19751
+ o.set("whammybartype", obj.whammyBarType);
19752
+ if (obj.whammyBarPoints !== null) {
19753
+ o.set("whammybarpoints", (_a = obj.whammyBarPoints) === null || _a === void 0 ? void 0 : _a.map(i => BendPointSerializer.toJson(i)));
19754
+ }
19650
19755
  o.set("vibrato", obj.vibrato);
19651
- o.set("chordId", obj.chordId);
19652
- o.set("graceType", obj.graceType);
19653
- o.set("pickStroke", obj.pickStroke);
19654
- o.set("tremoloSpeed", obj.tremoloSpeed);
19756
+ o.set("chordid", obj.chordId);
19757
+ o.set("gracetype", obj.graceType);
19758
+ o.set("pickstroke", obj.pickStroke);
19759
+ o.set("tremolospeed", obj.tremoloSpeed);
19655
19760
  o.set("crescendo", obj.crescendo);
19656
- o.set("displayStart", obj.displayStart);
19657
- o.set("playbackStart", obj.playbackStart);
19658
- o.set("displayDuration", obj.displayDuration);
19659
- o.set("playbackDuration", obj.playbackDuration);
19761
+ o.set("displaystart", obj.displayStart);
19762
+ o.set("playbackstart", obj.playbackStart);
19763
+ o.set("displayduration", obj.displayDuration);
19764
+ o.set("playbackduration", obj.playbackDuration);
19660
19765
  o.set("dynamics", obj.dynamics);
19661
- o.set("invertBeamDirection", obj.invertBeamDirection);
19662
- o.set("preferredBeamDirection", obj.preferredBeamDirection);
19663
- o.set("beamingMode", obj.beamingMode);
19766
+ o.set("invertbeamdirection", obj.invertBeamDirection);
19767
+ o.set("preferredbeamdirection", obj.preferredBeamDirection);
19768
+ o.set("beamingmode", obj.beamingMode);
19664
19769
  return o;
19665
19770
  }
19666
19771
  static setProperty(obj, property, v) {
@@ -19742,11 +19847,13 @@
19742
19847
  obj.whammyBarType = JsonHelper.parseEnum(v, WhammyType);
19743
19848
  return true;
19744
19849
  case "whammybarpoints":
19745
- obj.whammyBarPoints = [];
19746
- for (const o of v) {
19747
- const i = new BendPoint();
19748
- BendPointSerializer.fromJson(i, o);
19749
- obj.addWhammyBarPoint(i);
19850
+ if (v) {
19851
+ obj.whammyBarPoints = [];
19852
+ for (const o of v) {
19853
+ const i = new BendPoint();
19854
+ BendPointSerializer.fromJson(i, o);
19855
+ obj.addWhammyBarPoint(i);
19856
+ }
19750
19857
  }
19751
19858
  return true;
19752
19859
  case "vibrato":
@@ -19801,7 +19908,7 @@
19801
19908
  if (!m) {
19802
19909
  return;
19803
19910
  }
19804
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19911
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19805
19912
  }
19806
19913
  static toJson(obj) {
19807
19914
  if (!obj) {
@@ -19810,7 +19917,7 @@
19810
19917
  const o = new Map();
19811
19918
  o.set("id", obj.id);
19812
19919
  o.set("beats", obj.beats.map(i => BeatSerializer.toJson(i)));
19813
- o.set("isEmpty", obj.isEmpty);
19920
+ o.set("isempty", obj.isEmpty);
19814
19921
  return o;
19815
19922
  }
19816
19923
  static setProperty(obj, property, v) {
@@ -19839,7 +19946,7 @@
19839
19946
  if (!m) {
19840
19947
  return;
19841
19948
  }
19842
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19949
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19843
19950
  }
19844
19951
  static toJson(obj) {
19845
19952
  if (!obj) {
@@ -19848,9 +19955,9 @@
19848
19955
  const o = new Map();
19849
19956
  o.set("id", obj.id);
19850
19957
  o.set("clef", obj.clef);
19851
- o.set("clefOttava", obj.clefOttava);
19958
+ o.set("clefottava", obj.clefOttava);
19852
19959
  o.set("voices", obj.voices.map(i => VoiceSerializer.toJson(i)));
19853
- o.set("simileMark", obj.simileMark);
19960
+ o.set("similemark", obj.simileMark);
19854
19961
  return o;
19855
19962
  }
19856
19963
  static setProperty(obj, property, v) {
@@ -19885,7 +19992,7 @@
19885
19992
  if (!m) {
19886
19993
  return;
19887
19994
  }
19888
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
19995
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19889
19996
  }
19890
19997
  static toJson(obj) {
19891
19998
  if (!obj) {
@@ -19893,12 +20000,12 @@
19893
20000
  }
19894
20001
  const o = new Map();
19895
20002
  o.set("name", obj.name);
19896
- o.set("firstFret", obj.firstFret);
20003
+ o.set("firstfret", obj.firstFret);
19897
20004
  o.set("strings", obj.strings);
19898
- o.set("barreFrets", obj.barreFrets);
19899
- o.set("showName", obj.showName);
19900
- o.set("showDiagram", obj.showDiagram);
19901
- o.set("showFingering", obj.showFingering);
20005
+ o.set("barrefrets", obj.barreFrets);
20006
+ o.set("showname", obj.showName);
20007
+ o.set("showdiagram", obj.showDiagram);
20008
+ o.set("showfingering", obj.showFingering);
19902
20009
  return o;
19903
20010
  }
19904
20011
  static setProperty(obj, property, v) {
@@ -19934,14 +20041,14 @@
19934
20041
  if (!m) {
19935
20042
  return;
19936
20043
  }
19937
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20044
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19938
20045
  }
19939
20046
  static toJson(obj) {
19940
20047
  if (!obj) {
19941
20048
  return null;
19942
20049
  }
19943
20050
  const o = new Map();
19944
- o.set("isStandard", obj.isStandard);
20051
+ o.set("isstandard", obj.isStandard);
19945
20052
  o.set("name", obj.name);
19946
20053
  o.set("tunings", obj.tunings);
19947
20054
  return o;
@@ -19967,7 +20074,7 @@
19967
20074
  if (!m) {
19968
20075
  return;
19969
20076
  }
19970
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20077
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
19971
20078
  }
19972
20079
  static toJson(obj) {
19973
20080
  if (!obj) {
@@ -19975,7 +20082,7 @@
19975
20082
  }
19976
20083
  const o = new Map();
19977
20084
  o.set("bars", obj.bars.map(i => BarSerializer.toJson(i)));
19978
- {
20085
+ if (obj.chords !== null) {
19979
20086
  const m = new Map();
19980
20087
  o.set("chords", m);
19981
20088
  for (const [k, v] of obj.chords) {
@@ -19983,13 +20090,13 @@
19983
20090
  }
19984
20091
  }
19985
20092
  o.set("capo", obj.capo);
19986
- o.set("transpositionPitch", obj.transpositionPitch);
19987
- o.set("displayTranspositionPitch", obj.displayTranspositionPitch);
19988
- o.set("stringTuning", TuningSerializer.toJson(obj.stringTuning));
19989
- o.set("showTablature", obj.showTablature);
19990
- o.set("showStandardNotation", obj.showStandardNotation);
19991
- o.set("isPercussion", obj.isPercussion);
19992
- o.set("standardNotationLineCount", obj.standardNotationLineCount);
20093
+ o.set("transpositionpitch", obj.transpositionPitch);
20094
+ o.set("displaytranspositionpitch", obj.displayTranspositionPitch);
20095
+ o.set("stringtuning", TuningSerializer.toJson(obj.stringTuning));
20096
+ o.set("showtablature", obj.showTablature);
20097
+ o.set("showstandardnotation", obj.showStandardNotation);
20098
+ o.set("ispercussion", obj.isPercussion);
20099
+ o.set("standardnotationlinecount", obj.standardNotationLineCount);
19993
20100
  return o;
19994
20101
  }
19995
20102
  static setProperty(obj, property, v) {
@@ -20045,7 +20152,7 @@
20045
20152
  if (!m) {
20046
20153
  return;
20047
20154
  }
20048
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20155
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
20049
20156
  }
20050
20157
  static toJson(obj) {
20051
20158
  if (!obj) {
@@ -20056,10 +20163,10 @@
20056
20163
  o.set("balance", obj.balance);
20057
20164
  o.set("port", obj.port);
20058
20165
  o.set("program", obj.program);
20059
- o.set("primaryChannel", obj.primaryChannel);
20060
- o.set("secondaryChannel", obj.secondaryChannel);
20061
- o.set("isMute", obj.isMute);
20062
- o.set("isSolo", obj.isSolo);
20166
+ o.set("primarychannel", obj.primaryChannel);
20167
+ o.set("secondarychannel", obj.secondaryChannel);
20168
+ o.set("ismute", obj.isMute);
20169
+ o.set("issolo", obj.isSolo);
20063
20170
  return o;
20064
20171
  }
20065
20172
  static setProperty(obj, property, v) {
@@ -20098,21 +20205,21 @@
20098
20205
  if (!m) {
20099
20206
  return;
20100
20207
  }
20101
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20208
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
20102
20209
  }
20103
20210
  static toJson(obj) {
20104
20211
  if (!obj) {
20105
20212
  return null;
20106
20213
  }
20107
20214
  const o = new Map();
20108
- o.set("elementType", obj.elementType);
20109
- o.set("staffLine", obj.staffLine);
20110
- o.set("noteHeadDefault", obj.noteHeadDefault);
20111
- o.set("noteHeadHalf", obj.noteHeadHalf);
20112
- o.set("noteHeadWhole", obj.noteHeadWhole);
20113
- o.set("techniqueSymbol", obj.techniqueSymbol);
20114
- o.set("techniqueSymbolPlacement", obj.techniqueSymbolPlacement);
20115
- o.set("outputMidiNumber", obj.outputMidiNumber);
20215
+ o.set("elementtype", obj.elementType);
20216
+ o.set("staffline", obj.staffLine);
20217
+ o.set("noteheaddefault", obj.noteHeadDefault);
20218
+ o.set("noteheadhalf", obj.noteHeadHalf);
20219
+ o.set("noteheadwhole", obj.noteHeadWhole);
20220
+ o.set("techniquesymbol", obj.techniqueSymbol);
20221
+ o.set("techniquesymbolplacement", obj.techniqueSymbolPlacement);
20222
+ o.set("outputmidinumber", obj.outputMidiNumber);
20116
20223
  return o;
20117
20224
  }
20118
20225
  static setProperty(obj, property, v) {
@@ -20151,7 +20258,7 @@
20151
20258
  if (!m) {
20152
20259
  return;
20153
20260
  }
20154
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20261
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
20155
20262
  }
20156
20263
  static toJson(obj) {
20157
20264
  if (!obj) {
@@ -20159,11 +20266,11 @@
20159
20266
  }
20160
20267
  const o = new Map();
20161
20268
  o.set("staves", obj.staves.map(i => StaffSerializer.toJson(i)));
20162
- o.set("playbackInfo", PlaybackInformationSerializer.toJson(obj.playbackInfo));
20269
+ o.set("playbackinfo", PlaybackInformationSerializer.toJson(obj.playbackInfo));
20163
20270
  o.set("color", Color.toJson(obj.color));
20164
20271
  o.set("name", obj.name);
20165
- o.set("shortName", obj.shortName);
20166
- o.set("percussionArticulations", obj.percussionArticulations.map(i => InstrumentArticulationSerializer.toJson(i)));
20272
+ o.set("shortname", obj.shortName);
20273
+ o.set("percussionarticulations", obj.percussionArticulations.map(i => InstrumentArticulationSerializer.toJson(i)));
20167
20274
  return o;
20168
20275
  }
20169
20276
  static setProperty(obj, property, v) {
@@ -20207,14 +20314,14 @@
20207
20314
  if (!m) {
20208
20315
  return;
20209
20316
  }
20210
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20317
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
20211
20318
  }
20212
20319
  static toJson(obj) {
20213
20320
  if (!obj) {
20214
20321
  return null;
20215
20322
  }
20216
20323
  const o = new Map();
20217
- o.set("hideDynamics", obj.hideDynamics);
20324
+ o.set("hidedynamics", obj.hideDynamics);
20218
20325
  return o;
20219
20326
  }
20220
20327
  static setProperty(obj, property, v) {
@@ -20232,7 +20339,7 @@
20232
20339
  if (!m) {
20233
20340
  return;
20234
20341
  }
20235
- JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k.toLowerCase(), v));
20342
+ JsonHelper.forEach(m, (v, k) => this.setProperty(obj, k, v));
20236
20343
  }
20237
20344
  static toJson(obj) {
20238
20345
  if (!obj) {
@@ -20245,13 +20352,13 @@
20245
20352
  o.set("instructions", obj.instructions);
20246
20353
  o.set("music", obj.music);
20247
20354
  o.set("notices", obj.notices);
20248
- o.set("subTitle", obj.subTitle);
20355
+ o.set("subtitle", obj.subTitle);
20249
20356
  o.set("title", obj.title);
20250
20357
  o.set("words", obj.words);
20251
20358
  o.set("tab", obj.tab);
20252
20359
  o.set("tempo", obj.tempo);
20253
- o.set("tempoLabel", obj.tempoLabel);
20254
- o.set("masterBars", obj.masterBars.map(i => MasterBarSerializer.toJson(i)));
20360
+ o.set("tempolabel", obj.tempoLabel);
20361
+ o.set("masterbars", obj.masterBars.map(i => MasterBarSerializer.toJson(i)));
20255
20362
  o.set("tracks", obj.tracks.map(i => TrackSerializer.toJson(i)));
20256
20363
  o.set("stylesheet", RenderStylesheetSerializer.toJson(obj.stylesheet));
20257
20364
  return o;
@@ -21445,20 +21552,22 @@
21445
21552
  renderScore(score, trackIndexes) {
21446
21553
  try {
21447
21554
  this.score = score;
21448
- let tracks;
21449
- if (!trackIndexes) {
21450
- tracks = score.tracks.slice(0);
21451
- }
21452
- else {
21453
- tracks = [];
21454
- for (let track of trackIndexes) {
21455
- if (track >= 0 && track < score.tracks.length) {
21456
- tracks.push(score.tracks[track]);
21555
+ let tracks = null;
21556
+ if (score != null && trackIndexes != null) {
21557
+ if (!trackIndexes) {
21558
+ tracks = score.tracks.slice(0);
21559
+ }
21560
+ else {
21561
+ tracks = [];
21562
+ for (let track of trackIndexes) {
21563
+ if (track >= 0 && track < score.tracks.length) {
21564
+ tracks.push(score.tracks[track]);
21565
+ }
21457
21566
  }
21458
21567
  }
21459
- }
21460
- if (tracks.length === 0 && score.tracks.length > 0) {
21461
- tracks.push(score.tracks[0]);
21568
+ if (tracks.length === 0 && score.tracks.length > 0) {
21569
+ tracks.push(score.tracks[0]);
21570
+ }
21462
21571
  }
21463
21572
  this.tracks = tracks;
21464
21573
  this.render();
@@ -21505,21 +21614,28 @@
21505
21614
  return;
21506
21615
  }
21507
21616
  this.boundsLookup = new BoundsLookup();
21508
- if (!this.tracks || this.tracks.length === 0) {
21509
- return;
21510
- }
21511
21617
  this.recreateCanvas();
21512
21618
  this.canvas.lineWidth = this.settings.display.scale;
21513
21619
  this.canvas.settings = this.settings;
21514
- Logger.debug('Rendering', 'Rendering ' + this.tracks.length + ' tracks');
21515
- for (let i = 0; i < this.tracks.length; i++) {
21516
- let track = this.tracks[i];
21517
- Logger.debug('Rendering', 'Track ' + i + ': ' + track.name);
21620
+ if (!this.tracks || this.tracks.length === 0 || !this.score) {
21621
+ Logger.debug('Rendering', 'Clearing rendered tracks because no score or tracks are set');
21622
+ this.preRender.trigger(false);
21623
+ this._renderedTracks = null;
21624
+ this.onRenderFinished();
21625
+ this.postRenderFinished.trigger();
21626
+ Logger.debug('Rendering', 'Clearing finished');
21627
+ }
21628
+ else {
21629
+ Logger.debug('Rendering', 'Rendering ' + this.tracks.length + ' tracks');
21630
+ for (let i = 0; i < this.tracks.length; i++) {
21631
+ let track = this.tracks[i];
21632
+ Logger.debug('Rendering', 'Track ' + i + ': ' + track.name);
21633
+ }
21634
+ this.preRender.trigger(false);
21635
+ this.recreateLayout();
21636
+ this.layoutAndRender();
21637
+ Logger.debug('Rendering', 'Rendering finished');
21518
21638
  }
21519
- this.preRender.trigger(false);
21520
- this.recreateLayout();
21521
- this.layoutAndRender();
21522
- Logger.debug('Rendering', 'Rendering finished');
21523
21639
  }
21524
21640
  resizeRender() {
21525
21641
  if (this.recreateLayout() || this.recreateCanvas() || this._renderedTracks !== this.tracks || !this.tracks) {
@@ -21622,7 +21738,7 @@
21622
21738
  break;
21623
21739
  case 'alphaTab.renderScore':
21624
21740
  this.updateFontSizes(data.fontSizes);
21625
- let score = JsonConverter.jsObjectToScore(data.score, this._renderer.settings);
21741
+ let score = data.score == null ? null : JsonConverter.jsObjectToScore(data.score, this._renderer.settings);
21626
21742
  this.renderMultiple(score, data.trackIndexes);
21627
21743
  break;
21628
21744
  case 'alphaTab.updateSettings':
@@ -26104,7 +26220,7 @@
26104
26220
  }
26105
26221
  }
26106
26222
  renderScore(score, trackIndexes) {
26107
- let jsObject = JsonConverter.scoreToJsObject(score);
26223
+ let jsObject = score == null ? null : JsonConverter.scoreToJsObject(score);
26108
26224
  this._worker.postMessage({
26109
26225
  cmd: 'alphaTab.renderScore',
26110
26226
  score: jsObject,
@@ -28941,7 +29057,7 @@
28941
29057
  this.getVoiceContainer(g.beat.voice).addGlyph(g);
28942
29058
  }
28943
29059
  getVoiceContainer(voice) {
28944
- return this._voiceContainers.get(voice.index);
29060
+ return this._voiceContainers.has(voice.index) ? this._voiceContainers.get(voice.index) : undefined;
28945
29061
  }
28946
29062
  getBeatContainer(beat) {
28947
29063
  var _a, _b;
@@ -32300,11 +32416,14 @@
32300
32416
  let chords = new Map();
32301
32417
  for (let track of this.renderer.tracks) {
32302
32418
  for (let staff of track.staves) {
32303
- for (const [chordId, chord] of staff.chords) {
32304
- if (!chords.has(chordId)) {
32305
- if (chord.showDiagram) {
32306
- chords.set(chordId, chord);
32307
- this.chordDiagrams.addChord(chord);
32419
+ const sc = staff.chords;
32420
+ if (sc) {
32421
+ for (const [chordId, chord] of sc) {
32422
+ if (!chords.has(chordId)) {
32423
+ if (chord.showDiagram) {
32424
+ chords.set(chordId, chord);
32425
+ this.chordDiagrams.addChord(chord);
32426
+ }
32308
32427
  }
32309
32428
  }
32310
32429
  }
@@ -32429,9 +32548,6 @@
32429
32548
  get supportsResize() {
32430
32549
  return false;
32431
32550
  }
32432
- get padding() {
32433
- return this._pagePadding;
32434
- }
32435
32551
  get firstBarX() {
32436
32552
  let x = this._pagePadding[0];
32437
32553
  if (this._group) {
@@ -32616,9 +32732,6 @@
32616
32732
  get supportsResize() {
32617
32733
  return true;
32618
32734
  }
32619
- get padding() {
32620
- return this._pagePadding;
32621
- }
32622
32735
  get firstBarX() {
32623
32736
  let x = this._pagePadding[0];
32624
32737
  if (this._groups.length > 0) {
@@ -39293,7 +39406,7 @@
39293
39406
  }
39294
39407
  else if (c.attributes.has('end') && this._tieStarts.length > 0 && !note.isTieDestination) {
39295
39408
  note.isTieDestination = true;
39296
- note.tieOriginNoteId = this._tieStarts[0].id;
39409
+ note.tieOrigin = this._tieStarts[0];
39297
39410
  this._tieStarts.splice(0, 1);
39298
39411
  this._tieStartIds.delete(note.id);
39299
39412
  }
@@ -40439,8 +40552,8 @@
40439
40552
  // </auto-generated>
40440
40553
  class VersionInfo {
40441
40554
  }
40442
- VersionInfo.version = '1.3.0-alpha.139';
40443
- VersionInfo.date = '2021-12-29T17:37:24.580Z';
40555
+ VersionInfo.version = '1.3.0-alpha.140';
40556
+ VersionInfo.date = '2021-12-29T23:06:43.677Z';
40444
40557
 
40445
40558
  var index$5 = /*#__PURE__*/Object.freeze({
40446
40559
  __proto__: null,
@@ -41332,95 +41445,98 @@
41332
41445
  const diagramCollectionProperty = properties.addElement('Property');
41333
41446
  diagramCollectionProperty.attributes.set('name', name);
41334
41447
  const diagramCollectionItems = diagramCollectionProperty.addElement('Items');
41335
- for (const [id, chord] of staff.chords) {
41336
- const diagramCollectionItem = diagramCollectionItems.addElement('Item');
41337
- diagramCollectionItem.attributes.set('id', id);
41338
- diagramCollectionItem.attributes.set('name', chord.name);
41339
- const diagram = diagramCollectionItem.addElement('Diagram');
41340
- diagram.attributes.set('stringCount', chord.strings.length.toString());
41341
- diagram.attributes.set('fretCount', '5');
41342
- diagram.attributes.set('baseFret', (chord.firstFret - 1).toString());
41343
- diagram.attributes.set('barStates', chord.strings.map(_ => '1').join(' '));
41344
- const frets = [];
41345
- const fretToStrings = new Map();
41346
- for (let i = 0; i < chord.strings.length; i++) {
41347
- let chordFret = chord.strings[i];
41348
- if (chordFret !== -1) {
41349
- const fretNode = diagram.addElement('Fret');
41350
- const chordString = (chord.strings.length - 1 - i);
41351
- fretNode.attributes.set('string', chordString.toString());
41352
- fretNode.attributes.set('fret', (chordFret - chord.firstFret + 1).toString());
41353
- if (!fretToStrings.has(chordFret)) {
41354
- fretToStrings.set(chordFret, []);
41355
- frets.push(chordFret);
41356
- }
41357
- fretToStrings.get(chordFret).push(chordString);
41358
- }
41359
- }
41360
- frets.sort();
41361
- // try to rebuild the barre frets
41362
- const fingering = diagram.addElement('Fingering');
41363
- if (chord.barreFrets.length > 0) {
41364
- const fingers = [
41365
- Fingers.LittleFinger,
41366
- Fingers.AnnularFinger,
41367
- Fingers.MiddleFinger,
41368
- Fingers.IndexFinger,
41369
- ];
41370
- for (const fret of frets) {
41371
- const fretStrings = fretToStrings.get(fret);
41372
- if (fretStrings.length > 1 && chord.barreFrets.indexOf(fret) >= 0) {
41373
- const finger = fingers.length > 0 ? fingers.pop() : Fingers.IndexFinger;
41374
- for (const fretString of fretStrings) {
41375
- const position = fingering.addElement('Position');
41376
- switch (finger) {
41377
- case Fingers.LittleFinger:
41378
- position.attributes.set('finger', 'Pinky');
41379
- break;
41380
- case Fingers.AnnularFinger:
41381
- position.attributes.set('finger', 'Ring');
41382
- break;
41383
- case Fingers.MiddleFinger:
41384
- position.attributes.set('finger', 'Middle');
41385
- break;
41386
- case Fingers.IndexFinger:
41387
- position.attributes.set('finger', 'Index');
41388
- break;
41448
+ const sc = staff.chords;
41449
+ if (sc) {
41450
+ for (const [id, chord] of sc) {
41451
+ const diagramCollectionItem = diagramCollectionItems.addElement('Item');
41452
+ diagramCollectionItem.attributes.set('id', id);
41453
+ diagramCollectionItem.attributes.set('name', chord.name);
41454
+ const diagram = diagramCollectionItem.addElement('Diagram');
41455
+ diagram.attributes.set('stringCount', chord.strings.length.toString());
41456
+ diagram.attributes.set('fretCount', '5');
41457
+ diagram.attributes.set('baseFret', (chord.firstFret - 1).toString());
41458
+ diagram.attributes.set('barStates', chord.strings.map(_ => '1').join(' '));
41459
+ const frets = [];
41460
+ const fretToStrings = new Map();
41461
+ for (let i = 0; i < chord.strings.length; i++) {
41462
+ let chordFret = chord.strings[i];
41463
+ if (chordFret !== -1) {
41464
+ const fretNode = diagram.addElement('Fret');
41465
+ const chordString = (chord.strings.length - 1 - i);
41466
+ fretNode.attributes.set('string', chordString.toString());
41467
+ fretNode.attributes.set('fret', (chordFret - chord.firstFret + 1).toString());
41468
+ if (!fretToStrings.has(chordFret)) {
41469
+ fretToStrings.set(chordFret, []);
41470
+ frets.push(chordFret);
41471
+ }
41472
+ fretToStrings.get(chordFret).push(chordString);
41473
+ }
41474
+ }
41475
+ frets.sort();
41476
+ // try to rebuild the barre frets
41477
+ const fingering = diagram.addElement('Fingering');
41478
+ if (chord.barreFrets.length > 0) {
41479
+ const fingers = [
41480
+ Fingers.LittleFinger,
41481
+ Fingers.AnnularFinger,
41482
+ Fingers.MiddleFinger,
41483
+ Fingers.IndexFinger,
41484
+ ];
41485
+ for (const fret of frets) {
41486
+ const fretStrings = fretToStrings.get(fret);
41487
+ if (fretStrings.length > 1 && chord.barreFrets.indexOf(fret) >= 0) {
41488
+ const finger = fingers.length > 0 ? fingers.pop() : Fingers.IndexFinger;
41489
+ for (const fretString of fretStrings) {
41490
+ const position = fingering.addElement('Position');
41491
+ switch (finger) {
41492
+ case Fingers.LittleFinger:
41493
+ position.attributes.set('finger', 'Pinky');
41494
+ break;
41495
+ case Fingers.AnnularFinger:
41496
+ position.attributes.set('finger', 'Ring');
41497
+ break;
41498
+ case Fingers.MiddleFinger:
41499
+ position.attributes.set('finger', 'Middle');
41500
+ break;
41501
+ case Fingers.IndexFinger:
41502
+ position.attributes.set('finger', 'Index');
41503
+ break;
41504
+ }
41505
+ position.attributes.set('fret', (fret - chord.firstFret + 1).toString());
41506
+ position.attributes.set('string', fretString.toString());
41389
41507
  }
41390
- position.attributes.set('fret', (fret - chord.firstFret + 1).toString());
41391
- position.attributes.set('string', fretString.toString());
41392
41508
  }
41393
41509
  }
41394
41510
  }
41511
+ const showName = diagram.addElement('Property');
41512
+ showName.attributes.set('name', 'ShowName');
41513
+ showName.attributes.set('type', 'bool');
41514
+ showName.attributes.set('value', chord.showName ? "true" : "false");
41515
+ const showDiagram = diagram.addElement('Property');
41516
+ showDiagram.attributes.set('name', 'ShowDiagram');
41517
+ showDiagram.attributes.set('type', 'bool');
41518
+ showDiagram.attributes.set('value', chord.showDiagram ? "true" : "false");
41519
+ const showFingering = diagram.addElement('Property');
41520
+ showFingering.attributes.set('name', 'ShowFingering');
41521
+ showFingering.attributes.set('type', 'bool');
41522
+ showFingering.attributes.set('value', chord.showFingering ? "true" : "false");
41523
+ // TODO Chord details
41524
+ const chordNode = diagram.addElement('Chord');
41525
+ const keyNoteNode = chordNode.addElement('KeyNote');
41526
+ keyNoteNode.attributes.set('step', 'C');
41527
+ keyNoteNode.attributes.set('accidental', 'Natural');
41528
+ const bassNoteNode = chordNode.addElement('BassNote');
41529
+ bassNoteNode.attributes.set('step', 'C');
41530
+ bassNoteNode.attributes.set('accidental', 'Natural');
41531
+ const degree1Node = chordNode.addElement('Degree');
41532
+ degree1Node.attributes.set('interval', 'Third');
41533
+ degree1Node.attributes.set('alteration', 'Major');
41534
+ degree1Node.attributes.set('omitted', 'false');
41535
+ const degree2Node = chordNode.addElement('Degree');
41536
+ degree2Node.attributes.set('interval', 'Fifth');
41537
+ degree2Node.attributes.set('alteration', 'Perfect');
41538
+ degree2Node.attributes.set('omitted', 'false');
41395
41539
  }
41396
- const showName = diagram.addElement('Property');
41397
- showName.attributes.set('name', 'ShowName');
41398
- showName.attributes.set('type', 'bool');
41399
- showName.attributes.set('value', chord.showName ? "true" : "false");
41400
- const showDiagram = diagram.addElement('Property');
41401
- showDiagram.attributes.set('name', 'ShowDiagram');
41402
- showDiagram.attributes.set('type', 'bool');
41403
- showDiagram.attributes.set('value', chord.showDiagram ? "true" : "false");
41404
- const showFingering = diagram.addElement('Property');
41405
- showFingering.attributes.set('name', 'ShowFingering');
41406
- showFingering.attributes.set('type', 'bool');
41407
- showFingering.attributes.set('value', chord.showFingering ? "true" : "false");
41408
- // TODO Chord details
41409
- const chordNode = diagram.addElement('Chord');
41410
- const keyNoteNode = chordNode.addElement('KeyNote');
41411
- keyNoteNode.attributes.set('step', 'C');
41412
- keyNoteNode.attributes.set('accidental', 'Natural');
41413
- const bassNoteNode = chordNode.addElement('BassNote');
41414
- bassNoteNode.attributes.set('step', 'C');
41415
- bassNoteNode.attributes.set('accidental', 'Natural');
41416
- const degree1Node = chordNode.addElement('Degree');
41417
- degree1Node.attributes.set('interval', 'Third');
41418
- degree1Node.attributes.set('alteration', 'Major');
41419
- degree1Node.attributes.set('omitted', 'false');
41420
- const degree2Node = chordNode.addElement('Degree');
41421
- degree2Node.attributes.set('interval', 'Fifth');
41422
- degree2Node.attributes.set('alteration', 'Perfect');
41423
- degree2Node.attributes.set('omitted', 'false');
41424
41540
  }
41425
41541
  }
41426
41542
  writeSimplePropertyNode(parent, propertyName, propertyValueTagName, propertyValue) {
@@ -41623,10 +41739,12 @@
41623
41739
  this.writeFermatas(masterBarNode, masterBar);
41624
41740
  }
41625
41741
  writeFermatas(parent, masterBar) {
41626
- if (masterBar.fermata.size === 0) {
41742
+ var _a, _b;
41743
+ const fermataCount = ((_b = (_a = masterBar.fermata) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0);
41744
+ if (fermataCount === 0) {
41627
41745
  return;
41628
41746
  }
41629
- if (masterBar.fermata.size > 0) {
41747
+ if (fermataCount > 0) {
41630
41748
  const fermatas = parent.addElement('Fermatas');
41631
41749
  for (const [offset, fermata] of masterBar.fermata) {
41632
41750
  this.writeFermata(fermatas, offset, fermata);