@coderline/alphatab 1.3.0-alpha.439 → 1.3.0-alpha.477

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.439 (develop, build 439)
2
+ * alphaTab v1.3.0-alpha.477 (develop, build 477)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -65,7 +65,7 @@ class GeneralMidi {
65
65
  if (!GeneralMidi._values) {
66
66
  GeneralMidi._values = new Map();
67
67
  }
68
- name = name.toLowerCase().split(' ').join('');
68
+ name = name.toLowerCase().replaceAll(' ', '');
69
69
  return GeneralMidi._values.has(name) ? GeneralMidi._values.get(name) : 0;
70
70
  }
71
71
  static isPiano(program) {
@@ -387,7 +387,7 @@ class Bar {
387
387
  voice.index = this.voices.length;
388
388
  this.voices.push(voice);
389
389
  }
390
- finish(settings, sharedDataBag) {
390
+ finish(settings, sharedDataBag = null) {
391
391
  this.isMultiVoice = false;
392
392
  for (let i = 0, j = this.voices.length; i < j; i++) {
393
393
  let voice = this.voices[i];
@@ -1419,7 +1419,6 @@ class ModelUtils {
1419
1419
  /**
1420
1420
  * Checks if the given string is a tuning inticator.
1421
1421
  * @param name
1422
- * @returns
1423
1422
  */
1424
1423
  static isTuning(name) {
1425
1424
  return !!ModelUtils.parseTuning(name);
@@ -1429,14 +1428,14 @@ class ModelUtils {
1429
1428
  let octave = '';
1430
1429
  for (let i = 0; i < name.length; i++) {
1431
1430
  let c = name.charCodeAt(i);
1432
- if (c >= 0x30 && c <= 0x39) {
1431
+ if (c >= 0x30 && c <= 0x39 /* 0-9 */) {
1433
1432
  // number without note?
1434
1433
  if (!note) {
1435
1434
  return null;
1436
1435
  }
1437
1436
  octave += String.fromCharCode(c);
1438
1437
  }
1439
- else if ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) || c === 0x23) {
1438
+ else if ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) || c === 0x23) /* A-Za-Z# */ {
1440
1439
  note += String.fromCharCode(c);
1441
1440
  }
1442
1441
  else {
@@ -1460,53 +1459,39 @@ class ModelUtils {
1460
1459
  return result.realValue;
1461
1460
  }
1462
1461
  static getToneForText(note) {
1463
- let b = 0;
1464
1462
  switch (note.toLowerCase()) {
1465
1463
  case 'c':
1466
- b = 0;
1467
- break;
1464
+ return 0;
1468
1465
  case 'c#':
1469
1466
  case 'db':
1470
- b = 1;
1471
- break;
1467
+ return 1;
1472
1468
  case 'd':
1473
- b = 2;
1474
- break;
1469
+ return 2;
1475
1470
  case 'd#':
1476
1471
  case 'eb':
1477
- b = 3;
1478
- break;
1472
+ return 3;
1479
1473
  case 'e':
1480
- b = 4;
1481
- break;
1474
+ return 4;
1482
1475
  case 'f':
1483
- b = 5;
1484
- break;
1476
+ return 5;
1485
1477
  case 'f#':
1486
1478
  case 'gb':
1487
- b = 6;
1488
- break;
1479
+ return 6;
1489
1480
  case 'g':
1490
- b = 7;
1491
- break;
1481
+ return 7;
1492
1482
  case 'g#':
1493
1483
  case 'ab':
1494
- b = 8;
1495
- break;
1484
+ return 8;
1496
1485
  case 'a':
1497
- b = 9;
1498
- break;
1486
+ return 9;
1499
1487
  case 'a#':
1500
1488
  case 'bb':
1501
- b = 10;
1502
- break;
1489
+ return 10;
1503
1490
  case 'b':
1504
- b = 11;
1505
- break;
1491
+ return 11;
1506
1492
  default:
1507
1493
  return 0;
1508
1494
  }
1509
- return b;
1510
1495
  }
1511
1496
  static newGuid() {
1512
1497
  return (Math.floor((1 + Math.random()) * 0x10000)
@@ -2567,7 +2552,7 @@ class Note {
2567
2552
  this.bendType = BendType.Custom;
2568
2553
  }
2569
2554
  }
2570
- finish(settings, sharedDataBag) {
2555
+ finish(settings, sharedDataBag = null) {
2571
2556
  let nextNoteOnLine = new Lazy(() => Note.nextNoteOnSameLine(this));
2572
2557
  let isSongBook = settings && settings.notation.notationMode === NotationMode.SongBook;
2573
2558
  // connect ties
@@ -2827,10 +2812,14 @@ class Note {
2827
2812
  }
2828
2813
  return null;
2829
2814
  }
2830
- chain(sharedDataBag) {
2831
- // if we have some IDs from a serialization flow,
2815
+ chain(sharedDataBag = null) {
2816
+ // mainly for backwards compat in case we reach this code from somewhere outside.
2817
+ if (sharedDataBag === null) {
2818
+ return;
2819
+ }
2820
+ // if we have some IDs from a serialization flow,
2832
2821
  // we need to lookup/register the notes correctly
2833
- if (this._noteIdBag != null) {
2822
+ if (this._noteIdBag !== null) {
2834
2823
  // get or create lookup
2835
2824
  let noteIdLookup;
2836
2825
  if (sharedDataBag.has(Note.NoteIdLookupKey)) {
@@ -2889,22 +2878,22 @@ class Note {
2889
2878
  toJson(o) {
2890
2879
  // inject linked note ids into JSON
2891
2880
  if (this.tieDestination !== null) {
2892
- o.set("tiedestinationnoteid", this.tieDestination.id);
2881
+ o.set('tiedestinationnoteid', this.tieDestination.id);
2893
2882
  }
2894
2883
  if (this.tieOrigin !== null) {
2895
- o.set("tieoriginnoteid", this.tieOrigin.id);
2884
+ o.set('tieoriginnoteid', this.tieOrigin.id);
2896
2885
  }
2897
2886
  if (this.slurDestination !== null) {
2898
- o.set("slurdestinationnoteid", this.slurDestination.id);
2887
+ o.set('slurdestinationnoteid', this.slurDestination.id);
2899
2888
  }
2900
2889
  if (this.slurOrigin !== null) {
2901
- o.set("sluroriginnoteid", this.slurOrigin.id);
2890
+ o.set('sluroriginnoteid', this.slurOrigin.id);
2902
2891
  }
2903
2892
  if (this.hammerPullOrigin !== null) {
2904
- o.set("hammerpulloriginnoteid", this.hammerPullOrigin.id);
2893
+ o.set('hammerpulloriginnoteid', this.hammerPullOrigin.id);
2905
2894
  }
2906
2895
  if (this.hammerPullDestination !== null) {
2907
- o.set("hammerpulldestinationnoteid", this.hammerPullDestination.id);
2896
+ o.set('hammerpulldestinationnoteid', this.hammerPullDestination.id);
2908
2897
  }
2909
2898
  }
2910
2899
  /**
@@ -2954,7 +2943,7 @@ class Note {
2954
2943
  }
2955
2944
  Note.GlobalNoteId = 0;
2956
2945
  Note.MaxOffsetForSameLineSearch = 3;
2957
- Note.NoteIdLookupKey = "NoteIdLookup";
2946
+ Note.NoteIdLookupKey = 'NoteIdLookup';
2958
2947
 
2959
2948
  /**
2960
2949
  * Represents a list of beats that are grouped within the same tuplet.
@@ -3718,7 +3707,7 @@ class Beat {
3718
3707
  this.tupletGroup = currentTupletGroup;
3719
3708
  }
3720
3709
  }
3721
- finish(settings, sharedDataBag) {
3710
+ finish(settings, sharedDataBag = null) {
3722
3711
  if (this.getAutomation(AutomationType.Instrument) === null &&
3723
3712
  this.index === 0 &&
3724
3713
  this.voice.index === 0 &&
@@ -3983,7 +3972,7 @@ class Beat {
3983
3972
  }
3984
3973
  return null;
3985
3974
  }
3986
- chain(sharedDataBag) {
3975
+ chain(sharedDataBag = null) {
3987
3976
  for (const n of this.notes) {
3988
3977
  this.noteValueLookup.set(n.realValue, n);
3989
3978
  n.chain(sharedDataBag);
@@ -4824,17 +4813,6 @@ class PlaybackInformation {
4824
4813
  * @json_strict
4825
4814
  */
4826
4815
  class Tuning {
4827
- /**
4828
- * Initializes a new instance of the {@link Tuning} class.
4829
- * @param name The name.
4830
- * @param tuning The tuning.
4831
- * @param isStandard if set to`true`[is standard].
4832
- */
4833
- constructor(name = '', tuning = null, isStandard = false) {
4834
- this.isStandard = isStandard;
4835
- this.name = name;
4836
- this.tunings = tuning !== null && tuning !== void 0 ? tuning : [];
4837
- }
4838
4816
  static getTextForTuning(tuning, includeOctave) {
4839
4817
  let parts = Tuning.getTextPartsForTuning(tuning);
4840
4818
  return includeOctave ? parts.join('') : parts[0];
@@ -4951,6 +4929,17 @@ class Tuning {
4951
4929
  }
4952
4930
  return null;
4953
4931
  }
4932
+ /**
4933
+ * Initializes a new instance of the {@link Tuning} class.
4934
+ * @param name The name.
4935
+ * @param tuning The tuning.
4936
+ * @param isStandard if set to`true`[is standard].
4937
+ */
4938
+ constructor(name = '', tuning = null, isStandard = false) {
4939
+ this.isStandard = isStandard;
4940
+ this.name = name;
4941
+ this.tunings = tuning !== null && tuning !== void 0 ? tuning : [];
4942
+ }
4954
4943
  /**
4955
4944
  * Tries to detect the name and standard flag of the tuning from a known tuning list based
4956
4945
  * on the string values.
@@ -5015,7 +5004,7 @@ class Staff {
5015
5004
  * guitar tablature. Unlike the {@link Note.string} property this array directly represents
5016
5005
  * the order of the tracks shown in the tablature. The first item is the most top tablature line.
5017
5006
  */
5018
- this.stringTuning = new Tuning("", [], false);
5007
+ this.stringTuning = new Tuning('', [], false);
5019
5008
  /**
5020
5009
  * Gets or sets whether the tabs are shown.
5021
5010
  */
@@ -5049,7 +5038,7 @@ class Staff {
5049
5038
  get isStringed() {
5050
5039
  return this.stringTuning.tunings.length > 0;
5051
5040
  }
5052
- finish(settings, sharedDataBag) {
5041
+ finish(settings, sharedDataBag = null) {
5053
5042
  this.stringTuning.finish();
5054
5043
  for (let i = 0, j = this.bars.length; i < j; i++) {
5055
5044
  this.bars[i].finish(settings, sharedDataBag);
@@ -5134,7 +5123,7 @@ class Track {
5134
5123
  staff.track = this;
5135
5124
  this.staves.push(staff);
5136
5125
  }
5137
- finish(settings, sharedDataBag) {
5126
+ finish(settings, sharedDataBag = null) {
5138
5127
  if (!this.shortName) {
5139
5128
  this.shortName = this.name;
5140
5129
  if (this.shortName.length > Track.ShortNameMaxLength) {
@@ -5164,6 +5153,7 @@ class Track {
5164
5153
  // initialize lyrics list for beat if required
5165
5154
  if (!beat.lyrics) {
5166
5155
  beat.lyrics = new Array(lyrics.length);
5156
+ beat.lyrics.fill("");
5167
5157
  }
5168
5158
  // assign chunk
5169
5159
  beat.lyrics[li] = lyric.chunks[ci];
@@ -5221,7 +5211,7 @@ class Voice$1 {
5221
5211
  this.isEmpty = false;
5222
5212
  }
5223
5213
  }
5224
- chain(beat, sharedDataBag) {
5214
+ chain(beat, sharedDataBag = null) {
5225
5215
  if (!this.bar) {
5226
5216
  return;
5227
5217
  }
@@ -5261,7 +5251,7 @@ class Voice$1 {
5261
5251
  }
5262
5252
  return null;
5263
5253
  }
5264
- finish(settings, sharedDataBag) {
5254
+ finish(settings, sharedDataBag = null) {
5265
5255
  this._beatLookup = new Map();
5266
5256
  let currentGraceGroup = null;
5267
5257
  for (let index = 0; index < this.beats.length; index++) {
@@ -6186,7 +6176,7 @@ class AlphaTexImporter extends ScoreImporter {
6186
6176
  * @returns true if the given character is a digit, otherwise false.
6187
6177
  */
6188
6178
  isDigit(code) {
6189
- return (code >= 0x30 && code <= 0x39) /*0-9*/ || (code === 0x2d /* - */ && this._allowNegatives); // allow - if negatives
6179
+ return (code >= 0x30 && code <= 0x39) /* 0-9 */ || (code === 0x2d /* - */ && this._allowNegatives); // allow - if negatives
6190
6180
  }
6191
6181
  /**
6192
6182
  * Reads a string from the stream.
@@ -6197,7 +6187,7 @@ class AlphaTexImporter extends ScoreImporter {
6197
6187
  do {
6198
6188
  str += String.fromCharCode(this._ch);
6199
6189
  this._ch = this.nextChar();
6200
- } while (AlphaTexImporter.isLetter(this._ch) || this.isDigit(this._ch) || this._ch === 0x23);
6190
+ } while (AlphaTexImporter.isLetter(this._ch) || this.isDigit(this._ch) || this._ch === 0x23 /* # */);
6201
6191
  return str;
6202
6192
  }
6203
6193
  /**
@@ -6226,81 +6216,44 @@ class AlphaTexImporter extends ScoreImporter {
6226
6216
  let anyMeta = false;
6227
6217
  let continueReading = true;
6228
6218
  while (this._sy === AlphaTexSymbols.MetaCommand && continueReading) {
6229
- let syData = this._syData.toLowerCase();
6230
- switch (syData) {
6219
+ let metadataTag = this._syData.toLowerCase();
6220
+ switch (metadataTag) {
6231
6221
  case 'title':
6232
- this._sy = this.newSy();
6233
- if (this._sy === AlphaTexSymbols.String) {
6234
- this._score.title = this._syData;
6235
- }
6236
- else {
6237
- this.error('title', AlphaTexSymbols.String, true);
6238
- }
6239
- this._sy = this.newSy();
6240
- anyMeta = true;
6241
- break;
6242
6222
  case 'subtitle':
6243
- this._sy = this.newSy();
6244
- if (this._sy === AlphaTexSymbols.String) {
6245
- this._score.subTitle = this._syData;
6246
- }
6247
- else {
6248
- this.error('subtitle', AlphaTexSymbols.String, true);
6249
- }
6250
- this._sy = this.newSy();
6251
- anyMeta = true;
6252
- break;
6253
6223
  case 'artist':
6254
- this._sy = this.newSy();
6255
- if (this._sy === AlphaTexSymbols.String) {
6256
- this._score.artist = this._syData;
6257
- }
6258
- else {
6259
- this.error('artist', AlphaTexSymbols.String, true);
6260
- }
6261
- this._sy = this.newSy();
6262
- anyMeta = true;
6263
- break;
6264
6224
  case 'album':
6265
- this._sy = this.newSy();
6266
- if (this._sy === AlphaTexSymbols.String) {
6267
- this._score.album = this._syData;
6268
- }
6269
- else {
6270
- this.error('album', AlphaTexSymbols.String, true);
6271
- }
6272
- this._sy = this.newSy();
6273
- anyMeta = true;
6274
- break;
6275
6225
  case 'words':
6276
- this._sy = this.newSy();
6277
- if (this._sy === AlphaTexSymbols.String) {
6278
- this._score.words = this._syData;
6279
- }
6280
- else {
6281
- this.error('words', AlphaTexSymbols.String, true);
6282
- }
6283
- this._sy = this.newSy();
6284
- anyMeta = true;
6285
- break;
6286
6226
  case 'music':
6287
- this._sy = this.newSy();
6288
- if (this._sy === AlphaTexSymbols.String) {
6289
- this._score.music = this._syData;
6290
- }
6291
- else {
6292
- this.error('music', AlphaTexSymbols.String, true);
6293
- }
6294
- this._sy = this.newSy();
6295
- anyMeta = true;
6296
- break;
6297
6227
  case 'copyright':
6298
6228
  this._sy = this.newSy();
6299
- if (this._sy === AlphaTexSymbols.String) {
6300
- this._score.copyright = this._syData;
6301
- }
6302
- else {
6303
- this.error('copyright', AlphaTexSymbols.String, true);
6229
+ if (this._sy !== AlphaTexSymbols.String) {
6230
+ // Known issue: Strings that happen to be parsed as valid Tunings or positive Numbers will not pass this.
6231
+ // Need to use quotes in that case, or rewrite parsing logic.
6232
+ this.error(metadataTag, AlphaTexSymbols.String, true);
6233
+ }
6234
+ let metadataValue = this._syData;
6235
+ switch (metadataTag) {
6236
+ case 'title':
6237
+ this._score.title = metadataValue;
6238
+ break;
6239
+ case 'subtitle':
6240
+ this._score.subTitle = metadataValue;
6241
+ break;
6242
+ case 'artist':
6243
+ this._score.artist = metadataValue;
6244
+ break;
6245
+ case 'album':
6246
+ this._score.album = metadataValue;
6247
+ break;
6248
+ case 'words':
6249
+ this._score.words = metadataValue;
6250
+ break;
6251
+ case 'music':
6252
+ this._score.music = metadataValue;
6253
+ break;
6254
+ case 'copyright':
6255
+ this._score.copyright = metadataValue;
6256
+ break;
6304
6257
  }
6305
6258
  this._sy = this.newSy();
6306
6259
  anyMeta = true;
@@ -6344,8 +6297,7 @@ class AlphaTexImporter extends ScoreImporter {
6344
6297
  }
6345
6298
  handleStaffMeta() {
6346
6299
  var _a, _b;
6347
- let syData = this._syData.toLowerCase();
6348
- switch (syData) {
6300
+ switch (this._syData.toLowerCase()) {
6349
6301
  case 'capo':
6350
6302
  this._sy = this.newSy();
6351
6303
  if (this._sy === AlphaTexSymbols.Number) {
@@ -6396,7 +6348,7 @@ class AlphaTexImporter extends ScoreImporter {
6396
6348
  this._staffTuningApplied = false;
6397
6349
  if (this._sy === AlphaTexSymbols.Number) {
6398
6350
  let instrument = this._syData;
6399
- if (instrument >= 0 && instrument <= 128) {
6351
+ if (instrument >= 0 && instrument <= 127) {
6400
6352
  this._currentTrack.playbackInfo.program = this._syData;
6401
6353
  }
6402
6354
  else {
@@ -6848,66 +6800,45 @@ class AlphaTexImporter extends ScoreImporter {
6848
6800
  let syData = this._syData.toLowerCase();
6849
6801
  if (syData === 'f') {
6850
6802
  beat.fadeIn = true;
6851
- this._sy = this.newSy();
6852
- return true;
6853
6803
  }
6854
- if (syData === 'v') {
6804
+ else if (syData === 'v') {
6855
6805
  beat.vibrato = VibratoType.Slight;
6856
- this._sy = this.newSy();
6857
- return true;
6858
6806
  }
6859
- if (syData === 's') {
6807
+ else if (syData === 's') {
6860
6808
  beat.slap = true;
6861
- this._sy = this.newSy();
6862
- return true;
6863
6809
  }
6864
- if (syData === 'p') {
6810
+ else if (syData === 'p') {
6865
6811
  beat.pop = true;
6866
- this._sy = this.newSy();
6867
- return true;
6868
6812
  }
6869
- if (syData === 'tt') {
6813
+ else if (syData === 'tt') {
6870
6814
  beat.tap = true;
6871
- this._sy = this.newSy();
6872
- return true;
6873
6815
  }
6874
- if (syData === 'dd') {
6816
+ else if (syData === 'dd') {
6875
6817
  beat.dots = 2;
6876
- this._sy = this.newSy();
6877
- return true;
6878
6818
  }
6879
- if (syData === 'd') {
6819
+ else if (syData === 'd') {
6880
6820
  beat.dots = 1;
6881
- this._sy = this.newSy();
6882
- return true;
6883
6821
  }
6884
- if (syData === 'su') {
6822
+ else if (syData === 'su') {
6885
6823
  beat.pickStroke = PickStroke.Up;
6886
- this._sy = this.newSy();
6887
- return true;
6888
6824
  }
6889
- if (syData === 'sd') {
6825
+ else if (syData === 'sd') {
6890
6826
  beat.pickStroke = PickStroke.Down;
6891
- this._sy = this.newSy();
6892
- return true;
6893
6827
  }
6894
- if (syData === 'tu') {
6828
+ else if (syData === 'tu') {
6895
6829
  this._sy = this.newSy();
6896
6830
  if (this._sy !== AlphaTexSymbols.Number) {
6897
6831
  this.error('tuplet', AlphaTexSymbols.Number, true);
6898
6832
  return false;
6899
6833
  }
6900
6834
  this.applyTuplet(beat, this._syData);
6901
- this._sy = this.newSy();
6902
- return true;
6903
6835
  }
6904
- if (syData === 'tb' || syData === 'tbe') {
6836
+ else if (syData === 'tb' || syData === 'tbe') {
6905
6837
  let exact = syData === 'tbe';
6906
6838
  // read points
6907
6839
  this._sy = this.newSy();
6908
6840
  if (this._sy !== AlphaTexSymbols.LParensis) {
6909
6841
  this.error('tremolobar-effect', AlphaTexSymbols.LParensis, true);
6910
- return false;
6911
6842
  }
6912
6843
  this._allowNegatives = true;
6913
6844
  this._sy = this.newSy();
@@ -6917,20 +6848,17 @@ class AlphaTexImporter extends ScoreImporter {
6917
6848
  if (exact) {
6918
6849
  if (this._sy !== AlphaTexSymbols.Number) {
6919
6850
  this.error('tremolobar-effect', AlphaTexSymbols.Number, true);
6920
- return false;
6921
6851
  }
6922
6852
  offset = this._syData;
6923
6853
  this._sy = this.newSy();
6924
6854
  if (this._sy !== AlphaTexSymbols.Number) {
6925
6855
  this.error('tremolobar-effect', AlphaTexSymbols.Number, true);
6926
- return false;
6927
6856
  }
6928
6857
  value = this._syData;
6929
6858
  }
6930
6859
  else {
6931
6860
  if (this._sy !== AlphaTexSymbols.Number) {
6932
6861
  this.error('tremolobar-effect', AlphaTexSymbols.Number, true);
6933
- return false;
6934
6862
  }
6935
6863
  offset = 0;
6936
6864
  value = this._syData;
@@ -6953,20 +6881,15 @@ class AlphaTexImporter extends ScoreImporter {
6953
6881
  }
6954
6882
  }
6955
6883
  else {
6956
- beat.whammyBarPoints.sort((a, b) => {
6957
- return a.offset - b.offset;
6958
- });
6884
+ beat.whammyBarPoints.sort((a, b) => a.offset - b.offset);
6959
6885
  }
6960
6886
  }
6961
6887
  this._allowNegatives = false;
6962
6888
  if (this._sy !== AlphaTexSymbols.RParensis) {
6963
6889
  this.error('tremolobar-effect', AlphaTexSymbols.RParensis, true);
6964
- return false;
6965
6890
  }
6966
- this._sy = this.newSy();
6967
- return true;
6968
6891
  }
6969
- if (syData === 'bu' || syData === 'bd' || syData === 'au' || syData === 'ad') {
6892
+ else if (syData === 'bu' || syData === 'bd' || syData === 'au' || syData === 'ad') {
6970
6893
  switch (syData) {
6971
6894
  case 'bu':
6972
6895
  beat.brushType = BrushType.BrushUp;
@@ -6998,7 +6921,7 @@ class AlphaTexImporter extends ScoreImporter {
6998
6921
  }
6999
6922
  return true;
7000
6923
  }
7001
- if (syData === 'ch') {
6924
+ else if (syData === 'ch') {
7002
6925
  this._sy = this.newSy();
7003
6926
  let chordName = this._syData;
7004
6927
  let chordId = this.getChordId(this._currentStaff, chordName);
@@ -7009,10 +6932,8 @@ class AlphaTexImporter extends ScoreImporter {
7009
6932
  this._currentStaff.addChord(chordId, chord);
7010
6933
  }
7011
6934
  beat.chordId = chordId;
7012
- this._sy = this.newSy();
7013
- return true;
7014
6935
  }
7015
- if (syData === 'gr') {
6936
+ else if (syData === 'gr') {
7016
6937
  this._sy = this.newSy();
7017
6938
  if (this._syData.toLowerCase() === 'ob') {
7018
6939
  beat.graceType = GraceType.OnBeat;
@@ -7027,8 +6948,8 @@ class AlphaTexImporter extends ScoreImporter {
7027
6948
  }
7028
6949
  return true;
7029
6950
  }
7030
- if (syData === 'dy') {
7031
- this.newSy();
6951
+ else if (syData === 'dy') {
6952
+ this._sy = this.newSy();
7032
6953
  switch (this._syData.toLowerCase()) {
7033
6954
  case 'ppp':
7034
6955
  beat.dynamics = DynamicValue.PPP;
@@ -7056,43 +6977,43 @@ class AlphaTexImporter extends ScoreImporter {
7056
6977
  break;
7057
6978
  }
7058
6979
  this._currentDynamics = beat.dynamics;
7059
- this.newSy();
7060
- return true;
7061
6980
  }
7062
- if (syData === 'cre') {
6981
+ else if (syData === 'cre') {
7063
6982
  beat.crescendo = CrescendoType.Crescendo;
7064
- this.newSy();
7065
- return true;
7066
6983
  }
7067
- if (syData === 'dec') {
6984
+ else if (syData === 'dec') {
7068
6985
  beat.crescendo = CrescendoType.Decrescendo;
7069
- this.newSy();
7070
- return true;
7071
6986
  }
7072
- if (syData === 'tp') {
6987
+ else if (syData === 'tp') {
7073
6988
  this._sy = this.newSy();
7074
- let duration = Duration.Eighth;
6989
+ beat.tremoloSpeed = Duration.Eighth;
7075
6990
  if (this._sy === AlphaTexSymbols.Number) {
7076
6991
  switch (this._syData) {
7077
6992
  case 8:
7078
- duration = Duration.Eighth;
6993
+ beat.tremoloSpeed = Duration.Eighth;
7079
6994
  break;
7080
6995
  case 16:
7081
- duration = Duration.Sixteenth;
6996
+ beat.tremoloSpeed = Duration.Sixteenth;
7082
6997
  break;
7083
6998
  case 32:
7084
- duration = Duration.ThirtySecond;
6999
+ beat.tremoloSpeed = Duration.ThirtySecond;
7085
7000
  break;
7086
7001
  default:
7087
- duration = Duration.Eighth;
7002
+ beat.tremoloSpeed = Duration.Eighth;
7088
7003
  break;
7089
7004
  }
7090
7005
  this._sy = this.newSy();
7091
7006
  }
7092
- beat.tremoloSpeed = duration;
7093
7007
  return true;
7094
7008
  }
7095
- return false;
7009
+ else {
7010
+ // string didn't match any beat effect syntax
7011
+ return false;
7012
+ }
7013
+ // default behaviour when a beat effect above
7014
+ // does not handle new symbol + return on its own
7015
+ this._sy = this.newSy();
7016
+ return true;
7096
7017
  }
7097
7018
  getChordId(currentStaff, chordName) {
7098
7019
  return chordName.toLowerCase() + currentStaff.index + currentStaff.track.index;
@@ -7638,6 +7559,9 @@ class AlphaTexImporter extends ScoreImporter {
7638
7559
  AlphaTexImporter.Eof = 0;
7639
7560
 
7640
7561
  class Gp3To5Importer extends ScoreImporter {
7562
+ get name() {
7563
+ return 'Guitar Pro 3-5';
7564
+ }
7641
7565
  constructor() {
7642
7566
  super();
7643
7567
  this._versionNumber = 0;
@@ -7649,9 +7573,6 @@ class Gp3To5Importer extends ScoreImporter {
7649
7573
  this._playbackInfos = [];
7650
7574
  this._beatTextChunksByTrack = new Map();
7651
7575
  }
7652
- get name() {
7653
- return 'Guitar Pro 3-5';
7654
- }
7655
7576
  readScore() {
7656
7577
  this.readVersion();
7657
7578
  this._score = new Score();
@@ -7844,39 +7765,34 @@ class Gp3To5Importer extends ScoreImporter {
7844
7765
  if ((flags & 0x08) !== 0) {
7845
7766
  newMasterBar.repeatCount = this.data.readByte() + (this._versionNumber >= 500 ? 0 : 1);
7846
7767
  }
7847
- // alternate endings
7848
- if ((flags & 0x10) !== 0) {
7849
- if (this._versionNumber < 500) {
7850
- let currentMasterBar = previousMasterBar;
7851
- // get the already existing alternatives to ignore them
7852
- let existentAlternatives = 0;
7853
- while (currentMasterBar) {
7854
- // found another repeat ending?
7855
- if (currentMasterBar.isRepeatEnd && currentMasterBar !== previousMasterBar) {
7856
- break;
7857
- }
7858
- // found the opening?
7859
- if (currentMasterBar.isRepeatStart) {
7860
- break;
7861
- }
7862
- existentAlternatives = existentAlternatives | currentMasterBar.alternateEndings;
7863
- currentMasterBar = currentMasterBar.previousMasterBar;
7768
+ // alternate endings (pre GP5)
7769
+ if ((flags & 0x10) !== 0 && this._versionNumber < 500) {
7770
+ let currentMasterBar = previousMasterBar;
7771
+ // get the already existing alternatives to ignore them
7772
+ let existentAlternatives = 0;
7773
+ while (currentMasterBar) {
7774
+ // found another repeat ending?
7775
+ if (currentMasterBar.isRepeatEnd && currentMasterBar !== previousMasterBar) {
7776
+ break;
7864
7777
  }
7865
- // now calculate the alternative for this bar
7866
- let repeatAlternative = 0;
7867
- let repeatMask = this.data.readByte();
7868
- for (let i = 0; i < 8; i++) {
7869
- // only add the repeating if it is not existing
7870
- let repeating = 1 << i;
7871
- if (repeatMask > i && (existentAlternatives & repeating) === 0) {
7872
- repeatAlternative = repeatAlternative | repeating;
7873
- }
7778
+ // found the opening?
7779
+ if (currentMasterBar.isRepeatStart) {
7780
+ break;
7874
7781
  }
7875
- newMasterBar.alternateEndings = repeatAlternative;
7782
+ existentAlternatives = existentAlternatives | currentMasterBar.alternateEndings;
7783
+ currentMasterBar = currentMasterBar.previousMasterBar;
7876
7784
  }
7877
- else {
7878
- newMasterBar.alternateEndings = this.data.readByte();
7785
+ // now calculate the alternative for this bar
7786
+ let repeatAlternative = 0;
7787
+ let repeatMask = this.data.readByte();
7788
+ for (let i = 0; i < 8; i++) {
7789
+ // only add the repeating if it is not existing
7790
+ let repeating = 1 << i;
7791
+ if (repeatMask > i && (existentAlternatives & repeating) === 0) {
7792
+ repeatAlternative = repeatAlternative | repeating;
7793
+ }
7879
7794
  }
7795
+ newMasterBar.alternateEndings = repeatAlternative;
7880
7796
  }
7881
7797
  // marker
7882
7798
  if ((flags & 0x20) !== 0) {
@@ -7899,7 +7815,7 @@ class Gp3To5Importer extends ScoreImporter {
7899
7815
  this.data.skip(4);
7900
7816
  }
7901
7817
  // better alternate ending mask in GP5
7902
- if (this._versionNumber >= 500 && (flags & 0x10) === 0) {
7818
+ if (this._versionNumber >= 500) {
7903
7819
  newMasterBar.alternateEndings = this.data.readByte();
7904
7820
  }
7905
7821
  // tripletfeel
@@ -9571,6 +9487,11 @@ XmlParser.Escapes = new Map([
9571
9487
  ]);
9572
9488
 
9573
9489
  class XmlWriter {
9490
+ static write(xml, indention, xmlHeader) {
9491
+ const writer = new XmlWriter(indention, xmlHeader);
9492
+ writer.writeNode(xml);
9493
+ return writer.toString();
9494
+ }
9574
9495
  constructor(indention, xmlHeader) {
9575
9496
  // NOTE: we use the string.join variant rather than the
9576
9497
  // string concatenation for IE performnace concerns
@@ -9580,11 +9501,6 @@ class XmlWriter {
9580
9501
  this._currentIndention = '';
9581
9502
  this._isStartOfLine = true;
9582
9503
  }
9583
- static write(xml, indention, xmlHeader) {
9584
- const writer = new XmlWriter(indention, xmlHeader);
9585
- writer.writeNode(xml);
9586
- return writer.toString();
9587
- }
9588
9504
  writeNode(xml) {
9589
9505
  switch (xml.nodeType) {
9590
9506
  case XmlNodeType.None:
@@ -11846,31 +11762,6 @@ class Part {
11846
11762
  }
11847
11763
  }
11848
11764
  class PartConfiguration {
11849
- constructor(partConfigurationData) {
11850
- this.parts = [];
11851
- this.zoomLevel = 0;
11852
- this.layout = 0;
11853
- let readable = ByteBuffer.fromBuffer(partConfigurationData);
11854
- let entryCount = IOHelper.readInt32BE(readable);
11855
- for (let i = 0; i < entryCount; i++) {
11856
- let part = new Part();
11857
- this.parts.push(part);
11858
- part.isMultiRest = GpBinaryHelpers.gpReadBool(readable);
11859
- let groupCount = IOHelper.readInt32BE(readable);
11860
- for (let j = 0; j < groupCount; j++) {
11861
- let flags = readable.readByte();
11862
- // enable at least standard notation
11863
- if (flags === 0) {
11864
- flags = 1;
11865
- }
11866
- let trackConfiguration = new TrackConfiguration();
11867
- trackConfiguration.showStandardNotation = (flags & 0x01) !== 0;
11868
- trackConfiguration.showTablature = (flags & 0x02) !== 0;
11869
- trackConfiguration.showSlash = (flags & 0x04) !== 0;
11870
- part.tracks.push(trackConfiguration);
11871
- }
11872
- }
11873
- }
11874
11765
  apply(score) {
11875
11766
  let staffIndex = 0;
11876
11767
  let trackIndex = 0;
@@ -11904,6 +11795,31 @@ class PartConfiguration {
11904
11795
  }
11905
11796
  }
11906
11797
  }
11798
+ constructor(partConfigurationData) {
11799
+ this.parts = [];
11800
+ this.zoomLevel = 0;
11801
+ this.layout = 0;
11802
+ let readable = ByteBuffer.fromBuffer(partConfigurationData);
11803
+ let entryCount = IOHelper.readInt32BE(readable);
11804
+ for (let i = 0; i < entryCount; i++) {
11805
+ let part = new Part();
11806
+ this.parts.push(part);
11807
+ part.isMultiRest = GpBinaryHelpers.gpReadBool(readable);
11808
+ let groupCount = IOHelper.readInt32BE(readable);
11809
+ for (let j = 0; j < groupCount; j++) {
11810
+ let flags = readable.readByte();
11811
+ // enable at least standard notation
11812
+ if (flags === 0) {
11813
+ flags = 1;
11814
+ }
11815
+ let trackConfiguration = new TrackConfiguration();
11816
+ trackConfiguration.showStandardNotation = (flags & 0x01) !== 0;
11817
+ trackConfiguration.showTablature = (flags & 0x02) !== 0;
11818
+ trackConfiguration.showSlash = (flags & 0x04) !== 0;
11819
+ part.tracks.push(trackConfiguration);
11820
+ }
11821
+ }
11822
+ }
11907
11823
  static writeForScore(score) {
11908
11824
  const writer = ByteBuffer.withCapacity(128);
11909
11825
  const parts = [
@@ -12137,6 +12053,13 @@ class InflateWindow {
12137
12053
  InflateWindow.Size = 1 << 15;
12138
12054
  InflateWindow.BufferSize = 1 << 16;
12139
12055
  class Inflate {
12056
+ static buildFixedHuffman() {
12057
+ let a = [];
12058
+ for (let n = 0; n < 288; n++) {
12059
+ a.push(n <= 143 ? 8 : n <= 255 ? 9 : n <= 279 ? 7 : 8);
12060
+ }
12061
+ return HuffTools.make(a, 0, 288, 10);
12062
+ }
12140
12063
  constructor(readable) {
12141
12064
  this._nbits = 0;
12142
12065
  this._bits = 0;
@@ -12156,13 +12079,6 @@ class Inflate {
12156
12079
  this._lengths.push(-1);
12157
12080
  }
12158
12081
  }
12159
- static buildFixedHuffman() {
12160
- let a = [];
12161
- for (let n = 0; n < 288; n++) {
12162
- a.push(n <= 143 ? 8 : n <= 255 ? 9 : n <= 279 ? 7 : 8);
12163
- }
12164
- return HuffTools.make(a, 0, 288, 10);
12165
- }
12166
12082
  readBytes(b, pos, len) {
12167
12083
  this._needed = len;
12168
12084
  this._outpos = pos;
@@ -12951,6 +12867,9 @@ class GpxImporter extends ScoreImporter {
12951
12867
  }
12952
12868
 
12953
12869
  class MusicXmlImporter extends ScoreImporter {
12870
+ get name() {
12871
+ return 'MusicXML';
12872
+ }
12954
12873
  constructor() {
12955
12874
  super();
12956
12875
  this._currentPartGroup = null;
@@ -12964,9 +12883,6 @@ class MusicXmlImporter extends ScoreImporter {
12964
12883
  this._previousBeatWasPulled = false;
12965
12884
  this._previousBeat = null;
12966
12885
  }
12967
- get name() {
12968
- return 'MusicXML';
12969
- }
12970
12886
  readScore() {
12971
12887
  this._trackById = new Map();
12972
12888
  this._partGroups = new Map();
@@ -14332,19 +14248,6 @@ var MidiEventType;
14332
14248
  * Represents a midi event.
14333
14249
  */
14334
14250
  class MidiEvent {
14335
- /**
14336
- * Initializes a new instance of the {@link MidiEvent} class.
14337
- * @param track The track this event belongs to.
14338
- * @param tick The absolute midi ticks of this event.
14339
- * @param status The status information of this event.
14340
- * @param data1 The first data component of this midi event.
14341
- * @param data2 The second data component of this midi event.
14342
- */
14343
- constructor(track, tick, status, data1, data2) {
14344
- this.track = track;
14345
- this.tick = tick;
14346
- this.message = status | (data1 << 8) | (data2 << 16);
14347
- }
14348
14251
  get channel() {
14349
14252
  return this.message & 0x000000f;
14350
14253
  }
@@ -14365,6 +14268,19 @@ class MidiEvent {
14365
14268
  this.message &= ~0x0ff0000;
14366
14269
  this.message |= value << 16;
14367
14270
  }
14271
+ /**
14272
+ * Initializes a new instance of the {@link MidiEvent} class.
14273
+ * @param track The track this event belongs to.
14274
+ * @param tick The absolute midi ticks of this event.
14275
+ * @param status The status information of this event.
14276
+ * @param data1 The first data component of this midi event.
14277
+ * @param data2 The second data component of this midi event.
14278
+ */
14279
+ constructor(track, tick, status, data1, data2) {
14280
+ this.track = track;
14281
+ this.tick = tick;
14282
+ this.message = status | (data1 << 8) | (data2 << 16);
14283
+ }
14368
14284
  /**
14369
14285
  * Writes the midi event as binary into the given stream.
14370
14286
  * @param s The stream to write to.
@@ -14443,10 +14359,6 @@ var AlphaTabSystemExclusiveEvents;
14443
14359
  AlphaTabSystemExclusiveEvents[AlphaTabSystemExclusiveEvents["Rest"] = 1] = "Rest";
14444
14360
  })(AlphaTabSystemExclusiveEvents || (AlphaTabSystemExclusiveEvents = {}));
14445
14361
  class SystemExclusiveEvent extends SystemCommonEvent {
14446
- constructor(track, delta, status, id, data) {
14447
- super(track, delta, status, id & 0x00ff, (id >> 8) & 0xff);
14448
- this.data = data;
14449
- }
14450
14362
  get isMetronome() {
14451
14363
  return this.manufacturerId == SystemExclusiveEvent.AlphaTabManufacturerId &&
14452
14364
  this.data[0] == AlphaTabSystemExclusiveEvents.MetronomeTick;
@@ -14473,6 +14385,10 @@ class SystemExclusiveEvent extends SystemCommonEvent {
14473
14385
  get manufacturerId() {
14474
14386
  return this.message >> 8;
14475
14387
  }
14388
+ constructor(track, delta, status, id, data) {
14389
+ super(track, delta, status, id & 0x00ff, (id >> 8) & 0xff);
14390
+ this.data = data;
14391
+ }
14476
14392
  writeTo(s) {
14477
14393
  s.writeByte(0xf0);
14478
14394
  let l = this.data.length + 2;
@@ -14569,6 +14485,15 @@ class MidiSequencerState {
14569
14485
  * synthesize position. The sequencer does not consider the playback speed.
14570
14486
  */
14571
14487
  class MidiFileSequencer {
14488
+ get isPlayingMain() {
14489
+ return this._currentState == this._mainState;
14490
+ }
14491
+ get isPlayingOneTimeMidi() {
14492
+ return this._currentState == this._oneTimeState;
14493
+ }
14494
+ get isPlayingCountIn() {
14495
+ return this._currentState == this._countInState;
14496
+ }
14572
14497
  constructor(synthesizer) {
14573
14498
  this._oneTimeState = null;
14574
14499
  this._countInState = null;
@@ -14581,15 +14506,6 @@ class MidiFileSequencer {
14581
14506
  this._mainState = new MidiSequencerState();
14582
14507
  this._currentState = this._mainState;
14583
14508
  }
14584
- get isPlayingMain() {
14585
- return this._currentState == this._mainState;
14586
- }
14587
- get isPlayingOneTimeMidi() {
14588
- return this._currentState == this._oneTimeState;
14589
- }
14590
- get isPlayingCountIn() {
14591
- return this._currentState == this._countInState;
14592
- }
14593
14509
  get mainPlaybackRange() {
14594
14510
  return this._mainState.playbackRange;
14595
14511
  }
@@ -15178,9 +15094,6 @@ class HydraShdr {
15178
15094
  }
15179
15095
  HydraShdr.SizeInFile = 46;
15180
15096
  class HydraGenAmount {
15181
- constructor(reader) {
15182
- this.wordAmount = IOHelper.readUInt16LE(reader);
15183
- }
15184
15097
  get shortAmount() {
15185
15098
  return TypeConversions.uint16ToInt16(this.wordAmount);
15186
15099
  }
@@ -15190,6 +15103,9 @@ class HydraGenAmount {
15190
15103
  get highByteAmount() {
15191
15104
  return ((this.wordAmount & 0xff00) >> 8) & 0xff;
15192
15105
  }
15106
+ constructor(reader) {
15107
+ this.wordAmount = IOHelper.readUInt16LE(reader);
15108
+ }
15193
15109
  }
15194
15110
 
15195
15111
  // The SoundFont loading and Audio Synthesis is based on TinySoundFont, licensed under MIT,
@@ -17460,83 +17376,6 @@ class PlaybackRangeChangedEventArgs {
17460
17376
  * play a {@link MidiFile} via a {@link ISynthOutput}.
17461
17377
  */
17462
17378
  class AlphaSynth {
17463
- /**
17464
- * Initializes a new instance of the {@link AlphaSynth} class.
17465
- * @param output The output to use for playing the generated samples.
17466
- */
17467
- constructor(output, bufferTimeInMilliseconds) {
17468
- this._isSoundFontLoaded = false;
17469
- this._isMidiLoaded = false;
17470
- this._tickPosition = 0;
17471
- this._timePosition = 0;
17472
- this._metronomeVolume = 0;
17473
- this._countInVolume = 0;
17474
- this._playedEventsQueue = new Queue();
17475
- this._midiEventsPlayedFilter = new Set();
17476
- this._notPlayedSamples = 0;
17477
- this.isReady = false;
17478
- this.state = PlayerState.Paused;
17479
- this.ready = new EventEmitter();
17480
- this.readyForPlayback = new EventEmitter();
17481
- this.finished = new EventEmitter();
17482
- this.soundFontLoaded = new EventEmitter();
17483
- this.soundFontLoadFailed = new EventEmitterOfT();
17484
- this.midiLoaded = new EventEmitterOfT();
17485
- this.midiLoadFailed = new EventEmitterOfT();
17486
- this.stateChanged = new EventEmitterOfT();
17487
- this.positionChanged = new EventEmitterOfT();
17488
- this.midiEventsPlayed = new EventEmitterOfT();
17489
- this.playbackRangeChanged = new EventEmitterOfT();
17490
- Logger.debug('AlphaSynth', 'Initializing player');
17491
- this.state = PlayerState.Paused;
17492
- Logger.debug('AlphaSynth', 'Creating output');
17493
- this.output = output;
17494
- Logger.debug('AlphaSynth', 'Creating synthesizer');
17495
- this._synthesizer = new TinySoundFont(this.output.sampleRate);
17496
- this._sequencer = new MidiFileSequencer(this._synthesizer);
17497
- Logger.debug('AlphaSynth', 'Opening output');
17498
- this.output.ready.on(() => {
17499
- this.isReady = true;
17500
- this.ready.trigger();
17501
- this.checkReadyForPlayback();
17502
- });
17503
- this.output.sampleRequest.on(() => {
17504
- if (!this._sequencer.isFinished) {
17505
- let samples = new Float32Array(SynthConstants.MicroBufferSize * SynthConstants.MicroBufferCount * SynthConstants.AudioChannels);
17506
- let bufferPos = 0;
17507
- for (let i = 0; i < SynthConstants.MicroBufferCount; i++) {
17508
- // synthesize buffer
17509
- this._sequencer.fillMidiEventQueue();
17510
- const synthesizedEvents = this._synthesizer.synthesize(samples, bufferPos, SynthConstants.MicroBufferSize);
17511
- bufferPos += SynthConstants.MicroBufferSize * SynthConstants.AudioChannels;
17512
- // push all processed events into the queue
17513
- // for informing users about played events
17514
- for (const e of synthesizedEvents) {
17515
- if (this._midiEventsPlayedFilter.has(e.event.command)) {
17516
- this._playedEventsQueue.enqueue(e);
17517
- }
17518
- }
17519
- // tell sequencer to check whether its work is done
17520
- if (this._sequencer.isFinished) {
17521
- break;
17522
- }
17523
- }
17524
- // send it to output
17525
- if (bufferPos < samples.length) {
17526
- samples = samples.subarray(0, bufferPos);
17527
- }
17528
- this._notPlayedSamples += samples.length;
17529
- this.output.addSamples(samples);
17530
- }
17531
- else {
17532
- // Tell output that there is no data left for it.
17533
- let samples = new Float32Array(0);
17534
- this.output.addSamples(samples);
17535
- }
17536
- });
17537
- this.output.samplesPlayed.on(this.onSamplesPlayed.bind(this));
17538
- this.output.open(bufferTimeInMilliseconds);
17539
- }
17540
17379
  get isReadyForPlayback() {
17541
17380
  return this.isReady && this._isSoundFontLoaded && this._isMidiLoaded;
17542
17381
  }
@@ -17625,6 +17464,83 @@ class AlphaSynth {
17625
17464
  this.stop();
17626
17465
  this.output.destroy();
17627
17466
  }
17467
+ /**
17468
+ * Initializes a new instance of the {@link AlphaSynth} class.
17469
+ * @param output The output to use for playing the generated samples.
17470
+ */
17471
+ constructor(output, bufferTimeInMilliseconds) {
17472
+ this._isSoundFontLoaded = false;
17473
+ this._isMidiLoaded = false;
17474
+ this._tickPosition = 0;
17475
+ this._timePosition = 0;
17476
+ this._metronomeVolume = 0;
17477
+ this._countInVolume = 0;
17478
+ this._playedEventsQueue = new Queue();
17479
+ this._midiEventsPlayedFilter = new Set();
17480
+ this._notPlayedSamples = 0;
17481
+ this.isReady = false;
17482
+ this.state = PlayerState.Paused;
17483
+ this.ready = new EventEmitter();
17484
+ this.readyForPlayback = new EventEmitter();
17485
+ this.finished = new EventEmitter();
17486
+ this.soundFontLoaded = new EventEmitter();
17487
+ this.soundFontLoadFailed = new EventEmitterOfT();
17488
+ this.midiLoaded = new EventEmitterOfT();
17489
+ this.midiLoadFailed = new EventEmitterOfT();
17490
+ this.stateChanged = new EventEmitterOfT();
17491
+ this.positionChanged = new EventEmitterOfT();
17492
+ this.midiEventsPlayed = new EventEmitterOfT();
17493
+ this.playbackRangeChanged = new EventEmitterOfT();
17494
+ Logger.debug('AlphaSynth', 'Initializing player');
17495
+ this.state = PlayerState.Paused;
17496
+ Logger.debug('AlphaSynth', 'Creating output');
17497
+ this.output = output;
17498
+ Logger.debug('AlphaSynth', 'Creating synthesizer');
17499
+ this._synthesizer = new TinySoundFont(this.output.sampleRate);
17500
+ this._sequencer = new MidiFileSequencer(this._synthesizer);
17501
+ Logger.debug('AlphaSynth', 'Opening output');
17502
+ this.output.ready.on(() => {
17503
+ this.isReady = true;
17504
+ this.ready.trigger();
17505
+ this.checkReadyForPlayback();
17506
+ });
17507
+ this.output.sampleRequest.on(() => {
17508
+ if (!this._sequencer.isFinished) {
17509
+ let samples = new Float32Array(SynthConstants.MicroBufferSize * SynthConstants.MicroBufferCount * SynthConstants.AudioChannels);
17510
+ let bufferPos = 0;
17511
+ for (let i = 0; i < SynthConstants.MicroBufferCount; i++) {
17512
+ // synthesize buffer
17513
+ this._sequencer.fillMidiEventQueue();
17514
+ const synthesizedEvents = this._synthesizer.synthesize(samples, bufferPos, SynthConstants.MicroBufferSize);
17515
+ bufferPos += SynthConstants.MicroBufferSize * SynthConstants.AudioChannels;
17516
+ // push all processed events into the queue
17517
+ // for informing users about played events
17518
+ for (const e of synthesizedEvents) {
17519
+ if (this._midiEventsPlayedFilter.has(e.event.command)) {
17520
+ this._playedEventsQueue.enqueue(e);
17521
+ }
17522
+ }
17523
+ // tell sequencer to check whether its work is done
17524
+ if (this._sequencer.isFinished) {
17525
+ break;
17526
+ }
17527
+ }
17528
+ // send it to output
17529
+ if (bufferPos < samples.length) {
17530
+ samples = samples.subarray(0, bufferPos);
17531
+ }
17532
+ this._notPlayedSamples += samples.length;
17533
+ this.output.addSamples(samples);
17534
+ }
17535
+ else {
17536
+ // Tell output that there is no data left for it.
17537
+ let samples = new Float32Array(0);
17538
+ this.output.addSamples(samples);
17539
+ }
17540
+ });
17541
+ this.output.samplesPlayed.on(this.onSamplesPlayed.bind(this));
17542
+ this.output.open(bufferTimeInMilliseconds);
17543
+ }
17628
17544
  play() {
17629
17545
  if (this.state !== PlayerState.Paused || !this._isMidiLoaded) {
17630
17546
  return false;
@@ -18312,21 +18228,6 @@ var FontWeight;
18312
18228
  * @json_immutable
18313
18229
  */
18314
18230
  class Font {
18315
- /**
18316
- * Initializes a new instance of the {@link Font} class.
18317
- * @param family The family.
18318
- * @param size The size.
18319
- * @param style The style.
18320
- * @param weight The weight.
18321
- */
18322
- constructor(family, size, style = FontStyle.Plain, weight = FontWeight.Regular) {
18323
- this._cssScale = 0.0;
18324
- this._families = FontParser.parseFamilies(family);
18325
- this._size = size;
18326
- this._style = style;
18327
- this._weight = weight;
18328
- this._css = this.toCssString();
18329
- }
18330
18231
  reset() {
18331
18232
  this._cssScale = 0;
18332
18233
  this._css = this.toCssString();
@@ -18403,6 +18304,21 @@ class Font {
18403
18304
  get isItalic() {
18404
18305
  return this.style === FontStyle.Italic;
18405
18306
  }
18307
+ /**
18308
+ * Initializes a new instance of the {@link Font} class.
18309
+ * @param family The family.
18310
+ * @param size The size.
18311
+ * @param style The style.
18312
+ * @param weight The weight.
18313
+ */
18314
+ constructor(family, size, style = FontStyle.Plain, weight = FontWeight.Regular) {
18315
+ this._cssScale = 0.0;
18316
+ this._families = FontParser.parseFamilies(family);
18317
+ this._size = size;
18318
+ this._style = style;
18319
+ this._weight = weight;
18320
+ this._css = this.toCssString();
18321
+ }
18406
18322
  /**
18407
18323
  * Initializes a new instance of the {@link Font} class.
18408
18324
  * @param families The families.
@@ -22572,6 +22488,9 @@ class Repeat {
22572
22488
  }
22573
22489
  }
22574
22490
  class MidiPlaybackController {
22491
+ get finished() {
22492
+ return this.index >= this._score.masterBars.length;
22493
+ }
22575
22494
  constructor(score) {
22576
22495
  this._repeatStack = [];
22577
22496
  this._groupsOnStack = new Set();
@@ -22581,9 +22500,6 @@ class MidiPlaybackController {
22581
22500
  this.currentTick = 0;
22582
22501
  this._score = score;
22583
22502
  }
22584
- get finished() {
22585
- return this.index >= this._score.masterBars.length;
22586
- }
22587
22503
  processCurrent() {
22588
22504
  const masterBar = this._score.masterBars[this.index];
22589
22505
  let masterBarAlternateEndings = masterBar.alternateEndings;
@@ -22600,6 +22516,7 @@ class MidiPlaybackController {
22600
22516
  this._repeatStack.push(repeat);
22601
22517
  this._groupsOnStack.add(masterBar.repeatGroup);
22602
22518
  this._previousAlternateEndings = 0;
22519
+ masterBarAlternateEndings = masterBar.alternateEndings;
22603
22520
  }
22604
22521
  }
22605
22522
  // if we're not within repeats or not alternative endings set -> simply play
@@ -22943,6 +22860,17 @@ class MidiTickLookup {
22943
22860
  }
22944
22861
  return this.masterBarLookup.get(bar.index).start;
22945
22862
  }
22863
+ /**
22864
+ * Gets the start time in midi ticks for a given beat at which the masterbar is played the first time.
22865
+ * @param beat The beat to find the time period for.
22866
+ * @returns The time in midi ticks at which the beat is played the first time or 0 if the beat is not contained
22867
+ */
22868
+ getBeatStart(beat) {
22869
+ if (!this.masterBarLookup.has(beat.voice.bar.index)) {
22870
+ return 0;
22871
+ }
22872
+ return this.masterBarLookup.get(beat.voice.bar.index).start + beat.playbackStart;
22873
+ }
22946
22874
  /**
22947
22875
  * Adds a new {@link MasterBarTickLookup} to the lookup table.
22948
22876
  * @param masterBar The item to add.
@@ -24136,6 +24064,9 @@ class FlagGlyph extends MusicFontGlyph {
24136
24064
  FlagGlyph.FlagWidth = 11;
24137
24065
 
24138
24066
  class BeatContainerGlyph extends Glyph {
24067
+ get onTimeX() {
24068
+ return this.onNotes.x + this.onNotes.centerX;
24069
+ }
24139
24070
  constructor(beat, voiceContainer) {
24140
24071
  super(0, 0);
24141
24072
  this.ties = [];
@@ -24144,9 +24075,6 @@ class BeatContainerGlyph extends Glyph {
24144
24075
  this.ties = [];
24145
24076
  this.voiceContainer = voiceContainer;
24146
24077
  }
24147
- get onTimeX() {
24148
- return this.onNotes.x + this.onNotes.centerX;
24149
- }
24150
24078
  addTie(tie) {
24151
24079
  tie.renderer = this.renderer;
24152
24080
  this.ties.push(tie);
@@ -25048,9 +24976,7 @@ class AlphaTabApiBase {
25048
24976
  let currentBeat = this._currentBeat;
25049
24977
  let tickCache = this._tickCache;
25050
24978
  if (currentBeat && tickCache) {
25051
- this.player.tickPosition =
25052
- tickCache.getMasterBarStart(currentBeat.currentBeat.voice.bar.masterBar) +
25053
- currentBeat.currentBeat.playbackStart;
24979
+ this.player.tickPosition = tickCache.getBeatStart(currentBeat.currentBeat);
25054
24980
  }
25055
24981
  }
25056
24982
  });
@@ -25293,14 +25219,15 @@ class AlphaTabApiBase {
25293
25219
  this.uiFacade.triggerEvent(this.container, 'noteMouseMove', note, originalEvent);
25294
25220
  }
25295
25221
  onBeatMouseUp(originalEvent, beat) {
25222
+ var _a, _b, _c, _d;
25296
25223
  if (this._isDestroyed) {
25297
25224
  return;
25298
25225
  }
25299
25226
  if (this.settings.player.enableUserInteraction) {
25300
25227
  // for the selection ensure start < end
25301
25228
  if (this._selectionEnd) {
25302
- let startTick = this._selectionStart.beat.absolutePlaybackStart;
25303
- let endTick = this._selectionEnd.beat.absolutePlaybackStart;
25229
+ let startTick = (_b = (_a = this._tickCache) === null || _a === void 0 ? void 0 : _a.getBeatStart(this._selectionStart.beat)) !== null && _b !== void 0 ? _b : this._selectionStart.beat.absolutePlaybackStart;
25230
+ let endTick = (_d = (_c = this._tickCache) === null || _c === void 0 ? void 0 : _c.getBeatStart(this._selectionEnd.beat)) !== null && _d !== void 0 ? _d : this._selectionEnd.beat.absolutePlaybackStart;
25304
25231
  if (endTick < startTick) {
25305
25232
  let t = this._selectionStart;
25306
25233
  this._selectionStart = this._selectionEnd;
@@ -25314,7 +25241,7 @@ class AlphaTabApiBase {
25314
25241
  // move to selection start
25315
25242
  this._currentBeat = null; // reset current beat so it is updating the cursor
25316
25243
  if (this._playerState === PlayerState.Paused) {
25317
- this.cursorUpdateTick(this._selectionStart.beat.absolutePlaybackStart, false);
25244
+ this.cursorUpdateTick(this._tickCache.getBeatStart(this._selectionStart.beat), false);
25318
25245
  }
25319
25246
  this.tickPosition = realMasterBarStart + this._selectionStart.beat.playbackStart;
25320
25247
  // set playback range
@@ -25438,6 +25365,7 @@ class AlphaTabApiBase {
25438
25365
  });
25439
25366
  }
25440
25367
  cursorSelectRange(startBeat, endBeat) {
25368
+ var _a, _b, _c, _d;
25441
25369
  let cache = this.renderer.boundsLookup;
25442
25370
  if (!cache) {
25443
25371
  return;
@@ -25456,8 +25384,8 @@ class AlphaTabApiBase {
25456
25384
  if (!endBeat.bounds) {
25457
25385
  endBeat.bounds = cache.findBeat(endBeat.beat);
25458
25386
  }
25459
- let startTick = startBeat.beat.absolutePlaybackStart;
25460
- let endTick = endBeat.beat.absolutePlaybackStart;
25387
+ let startTick = (_b = (_a = this._tickCache) === null || _a === void 0 ? void 0 : _a.getBeatStart(startBeat.beat)) !== null && _b !== void 0 ? _b : startBeat.beat.absolutePlaybackStart;
25388
+ let endTick = (_d = (_c = this._tickCache) === null || _c === void 0 ? void 0 : _c.getBeatStart(endBeat.beat)) !== null && _d !== void 0 ? _d : endBeat.beat.absolutePlaybackStart;
25461
25389
  if (endTick < startTick) {
25462
25390
  let t = startBeat;
25463
25391
  startBeat = endBeat;
@@ -25727,9 +25655,6 @@ class ScoreLoader {
25727
25655
  * @target web
25728
25656
  */
25729
25657
  class BrowserMouseEventArgs {
25730
- constructor(e) {
25731
- this.mouseEvent = e;
25732
- }
25733
25658
  get isLeftMouseButton() {
25734
25659
  return this.mouseEvent.button === 0;
25735
25660
  }
@@ -25748,12 +25673,47 @@ class BrowserMouseEventArgs {
25748
25673
  preventDefault() {
25749
25674
  this.mouseEvent.preventDefault();
25750
25675
  }
25676
+ constructor(e) {
25677
+ this.mouseEvent = e;
25678
+ }
25751
25679
  }
25752
25680
 
25753
25681
  /**
25754
25682
  * @target web
25755
25683
  */
25756
25684
  class HtmlElementContainer {
25685
+ get width() {
25686
+ return this.element.offsetWidth;
25687
+ }
25688
+ set width(value) {
25689
+ this.element.style.width = value + 'px';
25690
+ }
25691
+ get scrollLeft() {
25692
+ return this.element.scrollLeft;
25693
+ }
25694
+ set scrollLeft(value) {
25695
+ this.element.scrollTop = value;
25696
+ }
25697
+ get scrollTop() {
25698
+ return this.element.scrollLeft;
25699
+ }
25700
+ set scrollTop(value) {
25701
+ this.element.scrollTop = value;
25702
+ }
25703
+ get height() {
25704
+ return this.element.offsetHeight;
25705
+ }
25706
+ set height(value) {
25707
+ if (value >= 0) {
25708
+ this.element.style.height = value + 'px';
25709
+ }
25710
+ else {
25711
+ this.element.style.height = '100%';
25712
+ }
25713
+ }
25714
+ get isVisible() {
25715
+ return !!this.element.offsetWidth || !!this.element.offsetHeight || !!this.element.getClientRects().length;
25716
+ }
25757
25717
  constructor(element) {
25758
25718
  this._resizeListeners = 0;
25759
25719
  this.lastBounds = new Bounds();
@@ -25806,38 +25766,6 @@ class HtmlElementContainer {
25806
25766
  }
25807
25767
  };
25808
25768
  }
25809
- get width() {
25810
- return this.element.offsetWidth;
25811
- }
25812
- set width(value) {
25813
- this.element.style.width = value + 'px';
25814
- }
25815
- get scrollLeft() {
25816
- return this.element.scrollLeft;
25817
- }
25818
- set scrollLeft(value) {
25819
- this.element.scrollTop = value;
25820
- }
25821
- get scrollTop() {
25822
- return this.element.scrollLeft;
25823
- }
25824
- set scrollTop(value) {
25825
- this.element.scrollTop = value;
25826
- }
25827
- get height() {
25828
- return this.element.offsetHeight;
25829
- }
25830
- set height(value) {
25831
- if (value >= 0) {
25832
- this.element.style.height = value + 'px';
25833
- }
25834
- else {
25835
- this.element.style.height = '100%';
25836
- }
25837
- }
25838
- get isVisible() {
25839
- return !!this.element.offsetWidth || !!this.element.offsetHeight || !!this.element.getClientRects().length;
25840
- }
25841
25769
  stopAnimation() {
25842
25770
  this.element.style.transition = 'none';
25843
25771
  }
@@ -26301,64 +26229,6 @@ class ProgressEventArgs {
26301
26229
  * @target web
26302
26230
  */
26303
26231
  class AlphaSynthWebWorkerApi {
26304
- constructor(player, alphaSynthScriptFile, logLevel, bufferTimeInMilliseconds) {
26305
- this._workerIsReadyForPlayback = false;
26306
- this._workerIsReady = false;
26307
- this._outputIsReady = false;
26308
- this._state = PlayerState.Paused;
26309
- this._masterVolume = 0;
26310
- this._metronomeVolume = 0;
26311
- this._countInVolume = 0;
26312
- this._playbackSpeed = 0;
26313
- this._tickPosition = 0;
26314
- this._timePosition = 0;
26315
- this._isLooping = false;
26316
- this._playbackRange = null;
26317
- this._midiEventsPlayedFilter = [];
26318
- this.ready = new EventEmitter();
26319
- this.readyForPlayback = new EventEmitter();
26320
- this.finished = new EventEmitter();
26321
- this.soundFontLoaded = new EventEmitter();
26322
- this.soundFontLoadFailed = new EventEmitterOfT();
26323
- this.midiLoaded = new EventEmitterOfT();
26324
- this.midiLoadFailed = new EventEmitterOfT();
26325
- this.stateChanged = new EventEmitterOfT();
26326
- this.positionChanged = new EventEmitterOfT();
26327
- this.midiEventsPlayed = new EventEmitterOfT();
26328
- this.playbackRangeChanged = new EventEmitterOfT();
26329
- this._workerIsReadyForPlayback = false;
26330
- this._workerIsReady = false;
26331
- this._outputIsReady = false;
26332
- this._state = PlayerState.Paused;
26333
- this._masterVolume = 0.0;
26334
- this._metronomeVolume = 0.0;
26335
- this._playbackSpeed = 0.0;
26336
- this._tickPosition = 0;
26337
- this._timePosition = 0.0;
26338
- this._isLooping = false;
26339
- this._playbackRange = null;
26340
- this._output = player;
26341
- this._output.ready.on(this.onOutputReady.bind(this));
26342
- this._output.samplesPlayed.on(this.onOutputSamplesPlayed.bind(this));
26343
- this._output.sampleRequest.on(this.onOutputSampleRequest.bind(this));
26344
- this._output.open(bufferTimeInMilliseconds);
26345
- try {
26346
- this._synth = Environment.createAlphaTabWorker(alphaSynthScriptFile);
26347
- }
26348
- catch (e) {
26349
- Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e);
26350
- }
26351
- this._synth.addEventListener('message', this.handleWorkerMessage.bind(this), false);
26352
- this._synth.postMessage({
26353
- cmd: 'alphaSynth.initialize',
26354
- sampleRate: this._output.sampleRate,
26355
- logLevel: logLevel,
26356
- bufferTimeInMilliseconds: bufferTimeInMilliseconds
26357
- });
26358
- this.masterVolume = 1;
26359
- this.playbackSpeed = 1;
26360
- this.metronomeVolume = 0;
26361
- }
26362
26232
  get isReady() {
26363
26233
  return this._workerIsReady && this._outputIsReady;
26364
26234
  }
@@ -26486,6 +26356,64 @@ class AlphaSynthWebWorkerApi {
26486
26356
  value: value
26487
26357
  });
26488
26358
  }
26359
+ constructor(player, alphaSynthScriptFile, logLevel, bufferTimeInMilliseconds) {
26360
+ this._workerIsReadyForPlayback = false;
26361
+ this._workerIsReady = false;
26362
+ this._outputIsReady = false;
26363
+ this._state = PlayerState.Paused;
26364
+ this._masterVolume = 0;
26365
+ this._metronomeVolume = 0;
26366
+ this._countInVolume = 0;
26367
+ this._playbackSpeed = 0;
26368
+ this._tickPosition = 0;
26369
+ this._timePosition = 0;
26370
+ this._isLooping = false;
26371
+ this._playbackRange = null;
26372
+ this._midiEventsPlayedFilter = [];
26373
+ this.ready = new EventEmitter();
26374
+ this.readyForPlayback = new EventEmitter();
26375
+ this.finished = new EventEmitter();
26376
+ this.soundFontLoaded = new EventEmitter();
26377
+ this.soundFontLoadFailed = new EventEmitterOfT();
26378
+ this.midiLoaded = new EventEmitterOfT();
26379
+ this.midiLoadFailed = new EventEmitterOfT();
26380
+ this.stateChanged = new EventEmitterOfT();
26381
+ this.positionChanged = new EventEmitterOfT();
26382
+ this.midiEventsPlayed = new EventEmitterOfT();
26383
+ this.playbackRangeChanged = new EventEmitterOfT();
26384
+ this._workerIsReadyForPlayback = false;
26385
+ this._workerIsReady = false;
26386
+ this._outputIsReady = false;
26387
+ this._state = PlayerState.Paused;
26388
+ this._masterVolume = 0.0;
26389
+ this._metronomeVolume = 0.0;
26390
+ this._playbackSpeed = 0.0;
26391
+ this._tickPosition = 0;
26392
+ this._timePosition = 0.0;
26393
+ this._isLooping = false;
26394
+ this._playbackRange = null;
26395
+ this._output = player;
26396
+ this._output.ready.on(this.onOutputReady.bind(this));
26397
+ this._output.samplesPlayed.on(this.onOutputSamplesPlayed.bind(this));
26398
+ this._output.sampleRequest.on(this.onOutputSampleRequest.bind(this));
26399
+ this._output.open(bufferTimeInMilliseconds);
26400
+ try {
26401
+ this._synth = Environment.createAlphaTabWorker(alphaSynthScriptFile);
26402
+ }
26403
+ catch (e) {
26404
+ Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e);
26405
+ }
26406
+ this._synth.addEventListener('message', this.handleWorkerMessage.bind(this), false);
26407
+ this._synth.postMessage({
26408
+ cmd: 'alphaSynth.initialize',
26409
+ sampleRate: this._output.sampleRate,
26410
+ logLevel: logLevel,
26411
+ bufferTimeInMilliseconds: bufferTimeInMilliseconds
26412
+ });
26413
+ this.masterVolume = 1;
26414
+ this.playbackSpeed = 1;
26415
+ this.metronomeVolume = 0;
26416
+ }
26489
26417
  destroy() {
26490
26418
  this._synth.postMessage({
26491
26419
  cmd: 'alphaSynth.destroy'
@@ -27058,30 +26986,6 @@ var ResultState;
27058
26986
  * @target web
27059
26987
  */
27060
26988
  class BrowserUiFacade {
27061
- constructor(rootElement) {
27062
- this._fontCheckers = new Map();
27063
- this._contents = null;
27064
- this._file = null;
27065
- this._totalResultCount = 0;
27066
- this._initialTrackIndexes = null;
27067
- this._barToElementLookup = new Map();
27068
- this._resultIdToElementLookup = new Map();
27069
- this.rootContainerBecameVisible = new EventEmitter();
27070
- this.canRenderChanged = new EventEmitter();
27071
- this._highlightedElements = [];
27072
- this._scrollContainer = null;
27073
- if (Environment.webPlatform !== WebPlatform.Browser && Environment.webPlatform !== WebPlatform.BrowserModule) {
27074
- throw new AlphaTabError(AlphaTabErrorType.General, 'Usage of AlphaTabApi is only possible in browser environments. For usage in node use the Low Level APIs');
27075
- }
27076
- rootElement.classList.add('alphaTab');
27077
- this.rootContainer = new HtmlElementContainer(rootElement);
27078
- this.areWorkersSupported = 'Worker' in window;
27079
- Environment.bravuraFontChecker.fontLoaded.on(this.onFontLoaded.bind(this));
27080
- this._intersectionObserver = new IntersectionObserver(this.onElementVisibilityChanged.bind(this), {
27081
- threshold: [0, 0.01, 1]
27082
- });
27083
- this._intersectionObserver.observe(rootElement);
27084
- }
27085
26989
  get resizeThrottle() {
27086
26990
  return 10;
27087
26991
  }
@@ -27111,6 +27015,30 @@ class BrowserUiFacade {
27111
27015
  this.canRenderChanged.trigger();
27112
27016
  }
27113
27017
  }
27018
+ constructor(rootElement) {
27019
+ this._fontCheckers = new Map();
27020
+ this._contents = null;
27021
+ this._file = null;
27022
+ this._totalResultCount = 0;
27023
+ this._initialTrackIndexes = null;
27024
+ this._barToElementLookup = new Map();
27025
+ this._resultIdToElementLookup = new Map();
27026
+ this.rootContainerBecameVisible = new EventEmitter();
27027
+ this.canRenderChanged = new EventEmitter();
27028
+ this._highlightedElements = [];
27029
+ this._scrollContainer = null;
27030
+ if (Environment.webPlatform !== WebPlatform.Browser && Environment.webPlatform !== WebPlatform.BrowserModule) {
27031
+ throw new AlphaTabError(AlphaTabErrorType.General, 'Usage of AlphaTabApi is only possible in browser environments. For usage in node use the Low Level APIs');
27032
+ }
27033
+ rootElement.classList.add('alphaTab');
27034
+ this.rootContainer = new HtmlElementContainer(rootElement);
27035
+ this.areWorkersSupported = 'Worker' in window;
27036
+ Environment.bravuraFontChecker.fontLoaded.on(this.onFontLoaded.bind(this));
27037
+ this._intersectionObserver = new IntersectionObserver(this.onElementVisibilityChanged.bind(this), {
27038
+ threshold: [0, 0.01, 1]
27039
+ });
27040
+ this._intersectionObserver.observe(rootElement);
27041
+ }
27114
27042
  onElementVisibilityChanged(entries) {
27115
27043
  for (const e of entries) {
27116
27044
  const htmlElement = e.target;
@@ -28284,13 +28212,13 @@ var BeatXPosition;
28284
28212
  * drawn at the same x position
28285
28213
  */
28286
28214
  class GlyphGroup extends Glyph {
28215
+ get isEmpty() {
28216
+ return !this.glyphs || this.glyphs.length === 0;
28217
+ }
28287
28218
  constructor(x, y) {
28288
28219
  super(x, y);
28289
28220
  this.glyphs = null;
28290
28221
  }
28291
- get isEmpty() {
28292
- return !this.glyphs || this.glyphs.length === 0;
28293
- }
28294
28222
  doLayout() {
28295
28223
  if (!this.glyphs || this.glyphs.length === 0) {
28296
28224
  this.width = 0;
@@ -28906,6 +28834,17 @@ class BeamingHelperDrawInfo {
28906
28834
  * This public class helps drawing beams and bars for notes.
28907
28835
  */
28908
28836
  class BeamingHelper {
28837
+ get isRestBeamHelper() {
28838
+ return this.beats.length === 1 && this.beats[0].isRest;
28839
+ }
28840
+ get hasLine() {
28841
+ return this.beats.length === 1 && this.beats[0].duration > Duration.Whole;
28842
+ }
28843
+ get hasFlag() {
28844
+ return (this.beats.length === 1 &&
28845
+ !this.beats[0].isRest &&
28846
+ (this.beats[0].duration > Duration.Quarter || this.beats[0].graceType !== GraceType.None));
28847
+ }
28909
28848
  constructor(staff, renderer) {
28910
28849
  this._beatLineXPositions = new Map();
28911
28850
  this._firstNonRestBeat = null;
@@ -28942,17 +28881,6 @@ class BeamingHelper {
28942
28881
  this._renderer = renderer;
28943
28882
  this.beats = [];
28944
28883
  }
28945
- get isRestBeamHelper() {
28946
- return this.beats.length === 1 && this.beats[0].isRest;
28947
- }
28948
- get hasLine() {
28949
- return this.beats.length === 1 && this.beats[0].duration > Duration.Whole;
28950
- }
28951
- get hasFlag() {
28952
- return (this.beats.length === 1 &&
28953
- !this.beats[0].isRest &&
28954
- (this.beats[0].duration > Duration.Quarter || this.beats[0].graceType !== GraceType.None));
28955
- }
28956
28884
  getBeatLineX(beat) {
28957
28885
  if (this.hasBeatLineX(beat)) {
28958
28886
  if (this.direction === BeamDirection.Up) {
@@ -29540,6 +29468,18 @@ var NoteXPosition;
29540
29468
  * This is the base public class for creating blocks which can render bars.
29541
29469
  */
29542
29470
  class BarRendererBase {
29471
+ get nextRenderer() {
29472
+ if (!this.bar || !this.bar.nextBar) {
29473
+ return null;
29474
+ }
29475
+ return this.scoreRenderer.layout.getRendererForBar(this.staff.staveId, this.bar.nextBar);
29476
+ }
29477
+ get previousRenderer() {
29478
+ if (!this.bar || !this.bar.previousBar) {
29479
+ return null;
29480
+ }
29481
+ return this.scoreRenderer.layout.getRendererForBar(this.staff.staveId, this.bar.previousBar);
29482
+ }
29543
29483
  constructor(renderer, bar) {
29544
29484
  this._preBeatGlyphs = new LeftToRightLayoutingGlyphGroup();
29545
29485
  this._voiceContainers = new Map();
@@ -29583,18 +29523,6 @@ class BarRendererBase {
29583
29523
  this.helpers = new BarHelpers(this);
29584
29524
  }
29585
29525
  }
29586
- get nextRenderer() {
29587
- if (!this.bar || !this.bar.nextBar) {
29588
- return null;
29589
- }
29590
- return this.scoreRenderer.layout.getRendererForBar(this.staff.staveId, this.bar.nextBar);
29591
- }
29592
- get previousRenderer() {
29593
- if (!this.bar || !this.bar.previousBar) {
29594
- return null;
29595
- }
29596
- return this.scoreRenderer.layout.getRendererForBar(this.staff.staveId, this.bar.previousBar);
29597
- }
29598
29526
  registerTies(ties) {
29599
29527
  this._ties.push(...ties);
29600
29528
  }
@@ -30382,6 +30310,9 @@ class EffectBarRenderer extends BarRendererBase {
30382
30310
  }
30383
30311
 
30384
30312
  class EffectBarRendererFactory extends BarRendererFactory {
30313
+ get staffId() {
30314
+ return this._staffId;
30315
+ }
30385
30316
  constructor(staffId, infos) {
30386
30317
  super();
30387
30318
  this._infos = infos;
@@ -30389,9 +30320,6 @@ class EffectBarRendererFactory extends BarRendererFactory {
30389
30320
  this.isInAccolade = false;
30390
30321
  this.isRelevantForBoundsLookup = false;
30391
30322
  }
30392
- get staffId() {
30393
- return this._staffId;
30394
- }
30395
30323
  create(renderer, bar) {
30396
30324
  return new EffectBarRenderer(renderer, bar, this._infos.filter(i => renderer.settings.notation.isNotationElementVisible(i.notationElement)));
30397
30325
  }
@@ -30963,6 +30891,12 @@ LineRangedGlyph.LineTopOffset = 5;
30963
30891
  LineRangedGlyph.LineSize = 8;
30964
30892
 
30965
30893
  class HarmonicsEffectInfo extends NoteEffectInfoBase {
30894
+ get effectId() {
30895
+ return this._effectId;
30896
+ }
30897
+ get notationElement() {
30898
+ return NotationElement.EffectHarmonics;
30899
+ }
30966
30900
  constructor(harmonicType) {
30967
30901
  super();
30968
30902
  this._beat = null;
@@ -30994,12 +30928,6 @@ class HarmonicsEffectInfo extends NoteEffectInfoBase {
30994
30928
  break;
30995
30929
  }
30996
30930
  }
30997
- get effectId() {
30998
- return this._effectId;
30999
- }
31000
- get notationElement() {
31001
- return NotationElement.EffectHarmonics;
31002
- }
31003
30931
  shouldCreateGlyphForNote(note) {
31004
30932
  if (!note.isHarmonic || note.harmonicType !== this._harmonicType) {
31005
30933
  return false;
@@ -31202,10 +31130,6 @@ class OttavaGlyph extends GroupedEffectGlyph {
31202
31130
  }
31203
31131
 
31204
31132
  class OttaviaEffectInfo extends EffectBarRendererInfo {
31205
- constructor(aboveStaff) {
31206
- super();
31207
- this._aboveStaff = aboveStaff;
31208
- }
31209
31133
  get effectId() {
31210
31134
  return 'ottavia-' + (this._aboveStaff ? 'above' : 'below');
31211
31135
  }
@@ -31221,6 +31145,10 @@ class OttaviaEffectInfo extends EffectBarRendererInfo {
31221
31145
  get sizingMode() {
31222
31146
  return EffectBarGlyphSizing.GroupedOnBeat;
31223
31147
  }
31148
+ constructor(aboveStaff) {
31149
+ super();
31150
+ this._aboveStaff = aboveStaff;
31151
+ }
31224
31152
  shouldCreateGlyph(settings, beat) {
31225
31153
  switch (beat.ottava) {
31226
31154
  case Ottavia._15ma:
@@ -32038,6 +31966,9 @@ class ChordDiagramContainerGlyph extends RowContainerGlyph {
32038
31966
  * It stores BarRenderer instances created from a given factory.
32039
31967
  */
32040
31968
  class RenderStaff {
31969
+ get staveId() {
31970
+ return this._factory.staffId;
31971
+ }
32041
31972
  constructor(trackIndex, staff, factory) {
32042
31973
  this._sharedLayoutData = new Map();
32043
31974
  this.barRenderers = [];
@@ -32073,9 +32004,6 @@ class RenderStaff {
32073
32004
  this.trackIndex = trackIndex;
32074
32005
  this.modelStaff = staff;
32075
32006
  }
32076
- get staveId() {
32077
- return this._factory.staffId;
32078
- }
32079
32007
  getSharedLayoutData(key, def) {
32080
32008
  if (this._sharedLayoutData.has(key)) {
32081
32009
  return this._sharedLayoutData.get(key);
@@ -33272,14 +33200,14 @@ class HorizontalScreenLayoutPartialInfo {
33272
33200
  * This layout arranges the bars all horizontally
33273
33201
  */
33274
33202
  class HorizontalScreenLayout extends ScoreLayout {
33203
+ get name() {
33204
+ return 'HorizontalScreen';
33205
+ }
33275
33206
  constructor(renderer) {
33276
33207
  super(renderer);
33277
33208
  this._group = null;
33278
33209
  this._pagePadding = null;
33279
33210
  }
33280
- get name() {
33281
- return 'HorizontalScreen';
33282
- }
33283
33211
  get supportsResize() {
33284
33212
  return false;
33285
33213
  }
@@ -33428,6 +33356,9 @@ HorizontalScreenLayout.GroupSpacing = 20;
33428
33356
  * This layout arranges the bars into a fixed width and dynamic height region.
33429
33357
  */
33430
33358
  class PageViewLayout extends ScoreLayout {
33359
+ get name() {
33360
+ return 'PageView';
33361
+ }
33431
33362
  constructor(renderer) {
33432
33363
  super(renderer);
33433
33364
  this._groups = [];
@@ -33435,9 +33366,6 @@ class PageViewLayout extends ScoreLayout {
33435
33366
  this._barsFromPreviousGroup = [];
33436
33367
  this._pagePadding = null;
33437
33368
  }
33438
- get name() {
33439
- return 'PageView';
33440
- }
33441
33369
  doLayoutAndRender() {
33442
33370
  this._pagePadding = this.renderer.settings.display.padding;
33443
33371
  if (!this._pagePadding) {
@@ -34914,6 +34842,9 @@ class AccidentalGroupGlyph extends GlyphGroup {
34914
34842
  }
34915
34843
 
34916
34844
  class BendNoteHeadGroupGlyph extends ScoreNoteChordGlyphBase {
34845
+ get direction() {
34846
+ return BeamDirection.Up;
34847
+ }
34917
34848
  constructor(beat, showParenthesis = false) {
34918
34849
  super();
34919
34850
  this._showParenthesis = false;
@@ -34930,9 +34861,6 @@ class BendNoteHeadGroupGlyph extends ScoreNoteChordGlyphBase {
34930
34861
  this._postNoteParenthesis = new GhostNoteContainerGlyph(false);
34931
34862
  }
34932
34863
  }
34933
- get direction() {
34934
- return BeamDirection.Up;
34935
- }
34936
34864
  containsNoteValue(noteValue) {
34937
34865
  return this._noteValueLookup.has(noteValue);
34938
34866
  }
@@ -36330,11 +36258,6 @@ class ScoreBrushGlyph extends Glyph {
36330
36258
  }
36331
36259
 
36332
36260
  class ScoreBeatPreNotesGlyph extends BeatGlyphBase {
36333
- constructor() {
36334
- super();
36335
- this._prebends = null;
36336
- this.accidentals = null;
36337
- }
36338
36261
  get prebendNoteHeadOffset() {
36339
36262
  return this._prebends ? this._prebends.x + this._prebends.noteHeadOffset : 0;
36340
36263
  }
@@ -36410,6 +36333,11 @@ class ScoreBeatPreNotesGlyph extends BeatGlyphBase {
36410
36333
  accidentals.addGlyph(g);
36411
36334
  }
36412
36335
  }
36336
+ constructor() {
36337
+ super();
36338
+ this._prebends = null;
36339
+ this.accidentals = null;
36340
+ }
36413
36341
  }
36414
36342
 
36415
36343
  class DigitGlyph extends MusicFontGlyph {
@@ -36890,7 +36818,6 @@ class ScoreSlideLineGlyph extends Glyph {
36890
36818
  drawSlideOut(cx, cy, canvas) {
36891
36819
  let startNoteRenderer = this.renderer;
36892
36820
  let sizeX = 12 * this.scale;
36893
- let startOffsetX = 3 * this.scale;
36894
36821
  let endOffsetX = 1 * this.scale;
36895
36822
  let offsetY = 2 * this.scale;
36896
36823
  let startX = 0;
@@ -36904,13 +36831,12 @@ class ScoreSlideLineGlyph extends Glyph {
36904
36831
  startX =
36905
36832
  cx +
36906
36833
  startNoteRenderer.x +
36907
- startNoteRenderer.getBeatX(this._startNote.beat, BeatXPosition.PostNotes) +
36908
- startOffsetX;
36834
+ startNoteRenderer.getBeatX(this._startNote.beat, BeatXPosition.PostNotes);
36909
36835
  startY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Center);
36910
36836
  if (this._startNote.slideTarget) {
36911
36837
  let endNoteRenderer = this.renderer.scoreRenderer.layout.getRendererForBar(this.renderer.staff.staveId, this._startNote.slideTarget.beat.voice.bar);
36912
36838
  if (!endNoteRenderer || endNoteRenderer.staff !== startNoteRenderer.staff) {
36913
- endX = cx + startNoteRenderer.x + this._parent.x;
36839
+ endX = cx + startNoteRenderer.x + startNoteRenderer.width;
36914
36840
  endY = startY;
36915
36841
  }
36916
36842
  else {
@@ -36948,7 +36874,7 @@ class ScoreSlideLineGlyph extends Glyph {
36948
36874
  endY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Bottom);
36949
36875
  break;
36950
36876
  case SlideOutType.PickSlideUp:
36951
- startX = cx + startNoteRenderer.x + startNoteRenderer.getNoteX(this._startNote, NoteXPosition.Right) + startOffsetX;
36877
+ startX = cx + startNoteRenderer.x + startNoteRenderer.getNoteX(this._startNote, NoteXPosition.Right);
36952
36878
  startY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Center);
36953
36879
  endY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Top);
36954
36880
  endX = cx + startNoteRenderer.x + startNoteRenderer.width;
@@ -36962,7 +36888,7 @@ class ScoreSlideLineGlyph extends Glyph {
36962
36888
  waves = true;
36963
36889
  break;
36964
36890
  case SlideOutType.PickSlideDown:
36965
- startX = cx + startNoteRenderer.x + startNoteRenderer.getNoteX(this._startNote, NoteXPosition.Right) + startOffsetX;
36891
+ startX = cx + startNoteRenderer.x + startNoteRenderer.getNoteX(this._startNote, NoteXPosition.Right);
36966
36892
  startY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Center);
36967
36893
  endY = cy + startNoteRenderer.y + startNoteRenderer.getNoteY(this._startNote, NoteYPosition.Bottom);
36968
36894
  endX = cx + startNoteRenderer.x + startNoteRenderer.width;
@@ -38157,7 +38083,7 @@ class TabSlideLineGlyph extends Glyph {
38157
38083
  if (this._startNote.slideTarget) {
38158
38084
  let endNoteRenderer = this.renderer.scoreRenderer.layout.getRendererForBar(this.renderer.staff.staveId, this._startNote.slideTarget.beat.voice.bar);
38159
38085
  if (!endNoteRenderer || endNoteRenderer.staff !== startNoteRenderer.staff) {
38160
- endX = cx + startNoteRenderer.x + this._parent.x;
38086
+ endX = cx + startNoteRenderer.x + startNoteRenderer.width;
38161
38087
  endY = startY;
38162
38088
  }
38163
38089
  else {
@@ -39383,6 +39309,9 @@ TabBarRenderer.TabLineSpacing = 10;
39383
39309
  * This Factory produces TabBarRenderer instances
39384
39310
  */
39385
39311
  class TabBarRendererFactory extends BarRendererFactory {
39312
+ get staffId() {
39313
+ return TabBarRenderer.StaffId;
39314
+ }
39386
39315
  constructor(showTimeSignature, showRests, showTiedNotes) {
39387
39316
  super();
39388
39317
  this._showTimeSignature = showTimeSignature;
@@ -39390,9 +39319,6 @@ class TabBarRendererFactory extends BarRendererFactory {
39390
39319
  this._showTiedNotes = showTiedNotes;
39391
39320
  this.hideOnPercussionTrack = true;
39392
39321
  }
39393
- get staffId() {
39394
- return TabBarRenderer.StaffId;
39395
- }
39396
39322
  canCreate(track, staff) {
39397
39323
  return staff.tuning.length > 0 && super.canCreate(track, staff);
39398
39324
  }
@@ -41418,8 +41344,8 @@ class CoreSettings {
41418
41344
  // </auto-generated>
41419
41345
  class VersionInfo {
41420
41346
  }
41421
- VersionInfo.version = '1.3.0-alpha.439';
41422
- VersionInfo.date = '2022-11-01T01:06:04.212Z';
41347
+ VersionInfo.version = '1.3.0-alpha.477';
41348
+ VersionInfo.date = '2022-12-04T01:13:35.524Z';
41423
41349
 
41424
41350
  var index$5 = /*#__PURE__*/Object.freeze({
41425
41351
  __proto__: null,
@@ -41513,7 +41439,7 @@ class GpifWriter {
41513
41439
  }
41514
41440
  writeDom(parent, score) {
41515
41441
  const gpif = parent.addElement('GPIF');
41516
- // just some values at the time this was implemented,
41442
+ // just some values at the time this was implemented,
41517
41443
  gpif.addElement('GPVersion').innerText = '7';
41518
41444
  const gpRevision = gpif.addElement('GPRevision');
41519
41445
  gpRevision.innerText = '7';
@@ -41727,18 +41653,18 @@ class GpifWriter {
41727
41653
  }
41728
41654
  writeTransposedPitch(properties, note) {
41729
41655
  if (note.isPercussion) {
41730
- this.writePitch(properties, "ConcertPitch", "C", "-1", '');
41656
+ this.writePitch(properties, 'ConcertPitch', 'C', '-1', '');
41731
41657
  }
41732
41658
  else {
41733
- this.writePitchForValue(properties, "TransposedPitch", note.displayValueWithoutBend, note.accidentalMode);
41659
+ this.writePitchForValue(properties, 'TransposedPitch', note.displayValueWithoutBend, note.accidentalMode);
41734
41660
  }
41735
41661
  }
41736
41662
  writeConcertPitch(properties, note) {
41737
41663
  if (note.isPercussion) {
41738
- this.writePitch(properties, "ConcertPitch", "C", "-1", '');
41664
+ this.writePitch(properties, 'ConcertPitch', 'C', '-1', '');
41739
41665
  }
41740
41666
  else {
41741
- this.writePitchForValue(properties, "ConcertPitch", note.realValueWithoutHarmonic, note.accidentalMode);
41667
+ this.writePitchForValue(properties, 'ConcertPitch', note.realValueWithoutHarmonic, note.accidentalMode);
41742
41668
  }
41743
41669
  }
41744
41670
  writePitchForValue(properties, propertyName, value, accidentalMode) {
@@ -42087,8 +42013,8 @@ class GpifWriter {
42087
42013
  const initialTempoAutomation = automations.addElement('Automation');
42088
42014
  initialTempoAutomation.addElement('Type').innerText = 'Tempo';
42089
42015
  initialTempoAutomation.addElement('Linear').innerText = 'false';
42090
- initialTempoAutomation.addElement('Bar').innerText = "0";
42091
- initialTempoAutomation.addElement('Position').innerText = "0";
42016
+ initialTempoAutomation.addElement('Bar').innerText = '0';
42017
+ initialTempoAutomation.addElement('Position').innerText = '0';
42092
42018
  initialTempoAutomation.addElement('Visible').innerText = 'true';
42093
42019
  initialTempoAutomation.addElement('Value').innerText = `${score.tempo} 2`;
42094
42020
  if (score.tempoLabel) {
@@ -42125,8 +42051,8 @@ class GpifWriter {
42125
42051
  trackNode.addElement('ShortName').setCData(track.shortName);
42126
42052
  trackNode.addElement('Color').innerText = `${track.color.r} ${track.color.g} ${track.color.b}`;
42127
42053
  // Note: unclear what these values mean, various combinations in GP7 lead to these values
42128
- trackNode.addElement('SystemsDefautLayout').innerText = "3";
42129
- trackNode.addElement('SystemsLayout').innerText = "1";
42054
+ trackNode.addElement('SystemsDefautLayout').innerText = '3';
42055
+ trackNode.addElement('SystemsLayout').innerText = '1';
42130
42056
  trackNode.addElement('AutoBrush');
42131
42057
  trackNode.addElement('PalmMute').innerText = '0';
42132
42058
  trackNode.addElement('PlayingStyle').innerText = GeneralMidi.isGuitar(track.playbackInfo.program)
@@ -42177,7 +42103,7 @@ class GpifWriter {
42177
42103
  automationNode.addElement('Linear').innerText = 'false';
42178
42104
  automationNode.addElement('Bar').innerText = barIndex.toString();
42179
42105
  automationNode.addElement('Position').innerText = ratioPosition.toString();
42180
- automationNode.addElement('Visible').innerText = "true";
42106
+ automationNode.addElement('Visible').innerText = 'true';
42181
42107
  automationNode.addElement('Value').setCData(`${path};${name};${role}`);
42182
42108
  }
42183
42109
  writeSoundsAndAutomations(trackNode, track) {
@@ -42237,13 +42163,13 @@ class GpifWriter {
42237
42163
  const staffNode = parent.addElement('Staff');
42238
42164
  const properties = staffNode.addElement('Properties');
42239
42165
  this.writeSimplePropertyNode(properties, 'CapoFret', 'Fret', staff.capo.toString());
42240
- this.writeSimplePropertyNode(properties, 'FretCount', 'Fret', "24");
42166
+ this.writeSimplePropertyNode(properties, 'FretCount', 'Fret', '24');
42241
42167
  if (staff.tuning.length > 0) {
42242
42168
  const tuningProperty = properties.addElement('Property');
42243
42169
  tuningProperty.attributes.set('name', 'Tuning');
42244
42170
  tuningProperty.addElement('Pitches').innerText = staff.tuning.slice().reverse().join(' ');
42245
42171
  tuningProperty.addElement('Label').setCData(staff.tuningName);
42246
- tuningProperty.addElement('LabelVisible').innerText = staff.tuningName ? "true" : "false";
42172
+ tuningProperty.addElement('LabelVisible').innerText = staff.tuningName ? 'true' : 'false';
42247
42173
  tuningProperty.addElement('Flat');
42248
42174
  switch (staff.tuning.length) {
42249
42175
  case 3:
@@ -42301,7 +42227,7 @@ class GpifWriter {
42301
42227
  break;
42302
42228
  }
42303
42229
  }
42304
- this.writeSimplePropertyNode(properties, 'PartialCapoFret', 'Fret', "0");
42230
+ this.writeSimplePropertyNode(properties, 'PartialCapoFret', 'Fret', '0');
42305
42231
  this.writeSimplePropertyNode(properties, 'PartialCapoStringFlags', 'Bitset', staff.tuning.map(_ => '0').join(''));
42306
42232
  this.writeSimplePropertyNode(properties, 'TuningFlat', 'Enable', null);
42307
42233
  this.writeDiagramCollection(properties, staff, 'DiagramCollection');
@@ -42441,9 +42367,10 @@ class GpifWriter {
42441
42367
  lines.push(newLyrics);
42442
42368
  }
42443
42369
  const line = lines[l];
42444
- line.text = line.text == '[Empty]'
42445
- ? beat.lyrics[l]
42446
- : line.text + ' ' + beat.lyrics[l].split(' ').join('+');
42370
+ line.text =
42371
+ line.text == '[Empty]'
42372
+ ? beat.lyrics[l]
42373
+ : line.text + ' ' + beat.lyrics[l].split(' ').join('+');
42447
42374
  }
42448
42375
  }
42449
42376
  }
@@ -42459,7 +42386,7 @@ class GpifWriter {
42459
42386
  writeTransposeNode(trackNode, track) {
42460
42387
  const transpose = trackNode.addElement('Transpose');
42461
42388
  const octaveTranspose = Math.floor(track.staves[0].displayTranspositionPitch / 12);
42462
- const chromaticTranspose = track.staves[0].displayTranspositionPitch - (octaveTranspose * 12);
42389
+ const chromaticTranspose = track.staves[0].displayTranspositionPitch - octaveTranspose * 12;
42463
42390
  transpose.addElement('Chromatic').innerText = chromaticTranspose.toString();
42464
42391
  transpose.addElement('Octave').innerText = octaveTranspose.toString();
42465
42392
  }
@@ -42495,7 +42422,8 @@ class GpifWriter {
42495
42422
  currentArticulations = currentElement.addElement('Articulations');
42496
42423
  }
42497
42424
  const articulationNode = currentArticulations.addElement('Articulation');
42498
- articulationNode.addElement('Name').innerText = currentElementName + ' ' + currentArticulations.childNodes.length;
42425
+ articulationNode.addElement('Name').innerText =
42426
+ currentElementName + ' ' + currentArticulations.childNodes.length;
42499
42427
  articulationNode.addElement('StaffLine').innerText = articulation.staffLine.toString();
42500
42428
  articulationNode.addElement('Noteheads').innerText = [
42501
42429
  this.mapMusicSymbol(articulation.noteHeadDefault),
@@ -42504,13 +42432,13 @@ class GpifWriter {
42504
42432
  ].join(' ');
42505
42433
  switch (articulation.techniqueSymbolPlacement) {
42506
42434
  case TextBaseline.Top:
42507
- articulationNode.addElement('TechniquePlacement').innerText = "below";
42435
+ articulationNode.addElement('TechniquePlacement').innerText = 'below';
42508
42436
  break;
42509
42437
  case TextBaseline.Middle:
42510
- articulationNode.addElement('TechniquePlacement').innerText = "inside";
42438
+ articulationNode.addElement('TechniquePlacement').innerText = 'inside';
42511
42439
  break;
42512
42440
  case TextBaseline.Bottom:
42513
- articulationNode.addElement('TechniquePlacement').innerText = "above";
42441
+ articulationNode.addElement('TechniquePlacement').innerText = 'above';
42514
42442
  break;
42515
42443
  }
42516
42444
  articulationNode.addElement('TechniqueSymbol').innerText = this.mapMusicSymbol(articulation.techniqueSymbol);
@@ -42579,8 +42507,8 @@ class GpifWriter {
42579
42507
  }
42580
42508
  if (masterBar.isRepeatStart || masterBar.isRepeatEnd) {
42581
42509
  const repeat = masterBarNode.addElement('Repeat');
42582
- repeat.attributes.set('start', masterBar.isRepeatStart ? "true" : "false");
42583
- repeat.attributes.set('end', masterBar.isRepeatEnd ? "true" : "false");
42510
+ repeat.attributes.set('start', masterBar.isRepeatStart ? 'true' : 'false');
42511
+ repeat.attributes.set('end', masterBar.isRepeatEnd ? 'true' : 'false');
42584
42512
  if (masterBar.isRepeatEnd) {
42585
42513
  repeat.attributes.set('count', masterBar.repeatCount.toString());
42586
42514
  }
@@ -42649,7 +42577,7 @@ class GpifWriter {
42649
42577
  writeBarNode(parent, bar) {
42650
42578
  const barNode = parent.addElement('Bar');
42651
42579
  barNode.attributes.set('id', bar.id.toString());
42652
- barNode.addElement('Voices').innerText = bar.voices.map(v => v.isEmpty ? '-1' : v.id.toString()).join(' ');
42580
+ barNode.addElement('Voices').innerText = bar.voices.map(v => (v.isEmpty ? '-1' : v.id.toString())).join(' ');
42653
42581
  barNode.addElement('Clef').innerText = Clef[bar.clef];
42654
42582
  if (bar.clefOttava !== Ottavia.Regular) {
42655
42583
  barNode.addElement('Ottavia').innerText = Ottavia[bar.clefOttava].substr(1);
@@ -42668,151 +42596,141 @@ class GpifWriter {
42668
42596
  }
42669
42597
  }
42670
42598
  GpifWriter.MidiProgramInfoLookup = new Map([
42671
- [0, new GpifMidiProgramInfo(GpifIconIds.Piano, "Acoustic Piano")],
42672
- [1, new GpifMidiProgramInfo(GpifIconIds.Piano, "Acoustic Piano")],
42673
- [2, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Piano")],
42674
- [3, new GpifMidiProgramInfo(GpifIconIds.Piano, "Acoustic Piano")],
42675
- [4, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Piano")],
42676
- [5, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Piano")],
42677
- [6, new GpifMidiProgramInfo(GpifIconIds.Piano, "Harpsichord")],
42678
- [7, new GpifMidiProgramInfo(GpifIconIds.Piano, "Harpsichord")],
42679
- [8, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Celesta")],
42680
- [9, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Vibraphone")],
42681
- [10, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Vibraphone")],
42682
- [11, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Vibraphone")],
42683
- [12, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Xylophone")],
42684
- [13, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Xylophone")],
42685
- [14, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Vibraphone")],
42686
- [15, new GpifMidiProgramInfo(GpifIconIds.Banjo, "Banjo")],
42687
- [16, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42688
- [17, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42689
- [18, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42690
- [19, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42691
- [20, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42692
- [21, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42693
- [22, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Recorder")],
42694
- [23, new GpifMidiProgramInfo(GpifIconIds.Piano, "Electric Organ")],
42695
- [24, new GpifMidiProgramInfo(GpifIconIds.ClassicalGuitar, "Nylon Guitar")],
42696
- [25, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, "Steel Guitar")],
42697
- [26, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, "Electric Guitar")],
42698
- [27, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, "Electric Guitar")],
42699
- [28, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, "Electric Guitar")],
42700
- [29, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, "Electric Guitar")],
42701
- [30, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, "Electric Guitar")],
42702
- [31, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, "Electric Guitar")],
42703
- [32, new GpifMidiProgramInfo(GpifIconIds.Bass, "Acoustic Bass")],
42704
- [33, new GpifMidiProgramInfo(GpifIconIds.Bass, "Electric Bass")],
42705
- [34, new GpifMidiProgramInfo(GpifIconIds.Bass, "Electric Bass")],
42706
- [35, new GpifMidiProgramInfo(GpifIconIds.Bass, "Acoustic Bass")],
42707
- [36, new GpifMidiProgramInfo(GpifIconIds.Bass, "Electric Bass")],
42708
- [37, new GpifMidiProgramInfo(GpifIconIds.Bass, "Electric Bass")],
42709
- [38, new GpifMidiProgramInfo(GpifIconIds.Synth, "Synth Bass")],
42710
- [39, new GpifMidiProgramInfo(GpifIconIds.Synth, "Synth Bass")],
42711
- [40, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42712
- [41, new GpifMidiProgramInfo(GpifIconIds.Strings, "Viola")],
42713
- [42, new GpifMidiProgramInfo(GpifIconIds.Strings, "Cello")],
42714
- [43, new GpifMidiProgramInfo(GpifIconIds.Strings, "Contrabass")],
42715
- [44, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42716
- [45, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42717
- [46, new GpifMidiProgramInfo(GpifIconIds.Piano, "Harp")],
42718
- [47, new GpifMidiProgramInfo(GpifIconIds.Membraphone, "Timpani")],
42719
- [48, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42720
- [49, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42721
- [50, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42722
- [51, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42723
- [52, new GpifMidiProgramInfo(GpifIconIds.Vocal, "Voice")],
42724
- [53, new GpifMidiProgramInfo(GpifIconIds.Vocal, "Voice")],
42725
- [54, new GpifMidiProgramInfo(GpifIconIds.Vocal, "Voice")],
42726
- [55, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42727
- [56, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trumpet")],
42728
- [57, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trombone")],
42729
- [58, new GpifMidiProgramInfo(GpifIconIds.Brass, "Tuba")],
42730
- [59, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trumpet")],
42731
- [60, new GpifMidiProgramInfo(GpifIconIds.Brass, "French Horn")],
42732
- [61, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trumpet")],
42733
- [62, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trumpet")],
42734
- [63, new GpifMidiProgramInfo(GpifIconIds.Brass, "Trumpet")],
42735
- [64, new GpifMidiProgramInfo(GpifIconIds.Reed, "Saxophone")],
42736
- [65, new GpifMidiProgramInfo(GpifIconIds.Reed, "Saxophone")],
42737
- [66, new GpifMidiProgramInfo(GpifIconIds.Reed, "Saxophone")],
42738
- [67, new GpifMidiProgramInfo(GpifIconIds.Reed, "Saxophone")],
42739
- [68, new GpifMidiProgramInfo(GpifIconIds.Reed, "Oboe")],
42740
- [69, new GpifMidiProgramInfo(GpifIconIds.Reed, "English Horn")],
42741
- [70, new GpifMidiProgramInfo(GpifIconIds.Reed, "Bassoon")],
42742
- [71, new GpifMidiProgramInfo(GpifIconIds.Reed, "Clarinet")],
42743
- [72, new GpifMidiProgramInfo(GpifIconIds.Reed, "Piccolo")],
42744
- [73, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Flute")],
42745
- [74, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Recorder")],
42746
- [75, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Flute")],
42747
- [76, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Recorder")],
42748
- [77, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Flute")],
42749
- [78, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Recorder")],
42750
- [79, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Flute")],
42751
- [80, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42752
- [81, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42753
- [82, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42754
- [83, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42755
- [84, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42756
- [85, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42757
- [86, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42758
- [87, new GpifMidiProgramInfo(GpifIconIds.Synth, "Lead Synthesizer")],
42759
- [88, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42760
- [89, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42761
- [90, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42762
- [91, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42763
- [92, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42764
- [93, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42765
- [94, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42766
- [95, new GpifMidiProgramInfo(GpifIconIds.Synth, "Pad Synthesizer")],
42767
- [96, new GpifMidiProgramInfo(GpifIconIds.Fx, "Pad Synthesizer")],
42768
- [97, new GpifMidiProgramInfo(GpifIconIds.Fx, "Pad Synthesizer")],
42769
- [98, new GpifMidiProgramInfo(GpifIconIds.Fx, "Pad Synthesizer")],
42770
- [99, new GpifMidiProgramInfo(GpifIconIds.Fx, "Pad Synthesizer")],
42771
- [100, new GpifMidiProgramInfo(GpifIconIds.Fx, "Lead Synthesizer")],
42772
- [101, new GpifMidiProgramInfo(GpifIconIds.Fx, "Lead Synthesizer")],
42773
- [102, new GpifMidiProgramInfo(GpifIconIds.Fx, "Lead Synthesizer")],
42774
- [103, new GpifMidiProgramInfo(GpifIconIds.Fx, "Trumpet")],
42775
- [104, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, "Banjo")],
42776
- [105, new GpifMidiProgramInfo(GpifIconIds.Banjo, "Banjo")],
42777
- [106, new GpifMidiProgramInfo(GpifIconIds.Ukulele, "Ukulele")],
42778
- [107, new GpifMidiProgramInfo(GpifIconIds.Banjo, "Banjo")],
42779
- [108, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Xylophone")],
42780
- [109, new GpifMidiProgramInfo(GpifIconIds.Reed, "Bassoon")],
42781
- [110, new GpifMidiProgramInfo(GpifIconIds.Strings, "Violin")],
42782
- [111, new GpifMidiProgramInfo(GpifIconIds.Woodwind, "Flute")],
42783
- [112, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Xylophone")],
42784
- [113, new GpifMidiProgramInfo(GpifIconIds.Idiophone, "Celesta")],
42785
- [114, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, "Vibraphone")],
42786
- [115, new GpifMidiProgramInfo(GpifIconIds.Idiophone, "Xylophone")],
42787
- [116, new GpifMidiProgramInfo(GpifIconIds.Membraphone, "Xylophone")],
42788
- [117, new GpifMidiProgramInfo(GpifIconIds.Membraphone, "Xylophone")],
42789
- [118, new GpifMidiProgramInfo(GpifIconIds.Membraphone, "Xylophone")],
42790
- [119, new GpifMidiProgramInfo(GpifIconIds.Idiophone, "Celesta")],
42791
- [120, new GpifMidiProgramInfo(GpifIconIds.Fx, "Steel Guitar")],
42792
- [121, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42793
- [122, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42794
- [123, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42795
- [124, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42796
- [125, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42797
- [126, new GpifMidiProgramInfo(GpifIconIds.Fx, "Recorder")],
42798
- [127, new GpifMidiProgramInfo(GpifIconIds.Fx, "Timpani")]
42599
+ [0, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Acoustic Piano')],
42600
+ [1, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Acoustic Piano')],
42601
+ [2, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Piano')],
42602
+ [3, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Acoustic Piano')],
42603
+ [4, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Piano')],
42604
+ [5, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Piano')],
42605
+ [6, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Harpsichord')],
42606
+ [7, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Harpsichord')],
42607
+ [8, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Celesta')],
42608
+ [9, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Vibraphone')],
42609
+ [10, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Vibraphone')],
42610
+ [11, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Vibraphone')],
42611
+ [12, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Xylophone')],
42612
+ [13, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Xylophone')],
42613
+ [14, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Vibraphone')],
42614
+ [15, new GpifMidiProgramInfo(GpifIconIds.Banjo, 'Banjo')],
42615
+ [16, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42616
+ [17, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42617
+ [18, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42618
+ [19, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42619
+ [20, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42620
+ [21, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42621
+ [22, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Recorder')],
42622
+ [23, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Electric Organ')],
42623
+ [24, new GpifMidiProgramInfo(GpifIconIds.ClassicalGuitar, 'Nylon Guitar')],
42624
+ [25, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, 'Steel Guitar')],
42625
+ [26, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, 'Electric Guitar')],
42626
+ [27, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, 'Electric Guitar')],
42627
+ [28, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, 'Electric Guitar')],
42628
+ [29, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, 'Electric Guitar')],
42629
+ [30, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, 'Electric Guitar')],
42630
+ [31, new GpifMidiProgramInfo(GpifIconIds.SteelGuitar, 'Electric Guitar')],
42631
+ [32, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Acoustic Bass')],
42632
+ [33, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Electric Bass')],
42633
+ [34, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Electric Bass')],
42634
+ [35, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Acoustic Bass')],
42635
+ [36, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Electric Bass')],
42636
+ [37, new GpifMidiProgramInfo(GpifIconIds.Bass, 'Electric Bass')],
42637
+ [38, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Synth Bass')],
42638
+ [39, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Synth Bass')],
42639
+ [40, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42640
+ [41, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Viola')],
42641
+ [42, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Cello')],
42642
+ [43, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Contrabass')],
42643
+ [44, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42644
+ [45, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42645
+ [46, new GpifMidiProgramInfo(GpifIconIds.Piano, 'Harp')],
42646
+ [47, new GpifMidiProgramInfo(GpifIconIds.Membraphone, 'Timpani')],
42647
+ [48, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42648
+ [49, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42649
+ [50, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42650
+ [51, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42651
+ [52, new GpifMidiProgramInfo(GpifIconIds.Vocal, 'Voice')],
42652
+ [53, new GpifMidiProgramInfo(GpifIconIds.Vocal, 'Voice')],
42653
+ [54, new GpifMidiProgramInfo(GpifIconIds.Vocal, 'Voice')],
42654
+ [55, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42655
+ [56, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trumpet')],
42656
+ [57, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trombone')],
42657
+ [58, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Tuba')],
42658
+ [59, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trumpet')],
42659
+ [60, new GpifMidiProgramInfo(GpifIconIds.Brass, 'French Horn')],
42660
+ [61, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trumpet')],
42661
+ [62, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trumpet')],
42662
+ [63, new GpifMidiProgramInfo(GpifIconIds.Brass, 'Trumpet')],
42663
+ [64, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Saxophone')],
42664
+ [65, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Saxophone')],
42665
+ [66, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Saxophone')],
42666
+ [67, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Saxophone')],
42667
+ [68, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Oboe')],
42668
+ [69, new GpifMidiProgramInfo(GpifIconIds.Reed, 'English Horn')],
42669
+ [70, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Bassoon')],
42670
+ [71, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Clarinet')],
42671
+ [72, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Piccolo')],
42672
+ [73, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Flute')],
42673
+ [74, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Recorder')],
42674
+ [75, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Flute')],
42675
+ [76, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Recorder')],
42676
+ [77, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Flute')],
42677
+ [78, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Recorder')],
42678
+ [79, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Flute')],
42679
+ [80, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42680
+ [81, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42681
+ [82, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42682
+ [83, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42683
+ [84, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42684
+ [85, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42685
+ [86, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42686
+ [87, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Lead Synthesizer')],
42687
+ [88, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42688
+ [89, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42689
+ [90, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42690
+ [91, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42691
+ [92, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42692
+ [93, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42693
+ [94, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42694
+ [95, new GpifMidiProgramInfo(GpifIconIds.Synth, 'Pad Synthesizer')],
42695
+ [96, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Pad Synthesizer')],
42696
+ [97, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Pad Synthesizer')],
42697
+ [98, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Pad Synthesizer')],
42698
+ [99, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Pad Synthesizer')],
42699
+ [100, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Lead Synthesizer')],
42700
+ [101, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Lead Synthesizer')],
42701
+ [102, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Lead Synthesizer')],
42702
+ [103, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Trumpet')],
42703
+ [104, new GpifMidiProgramInfo(GpifIconIds.ElectricGuitar, 'Banjo')],
42704
+ [105, new GpifMidiProgramInfo(GpifIconIds.Banjo, 'Banjo')],
42705
+ [106, new GpifMidiProgramInfo(GpifIconIds.Ukulele, 'Ukulele')],
42706
+ [107, new GpifMidiProgramInfo(GpifIconIds.Banjo, 'Banjo')],
42707
+ [108, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Xylophone')],
42708
+ [109, new GpifMidiProgramInfo(GpifIconIds.Reed, 'Bassoon')],
42709
+ [110, new GpifMidiProgramInfo(GpifIconIds.Strings, 'Violin')],
42710
+ [111, new GpifMidiProgramInfo(GpifIconIds.Woodwind, 'Flute')],
42711
+ [112, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Xylophone')],
42712
+ [113, new GpifMidiProgramInfo(GpifIconIds.Idiophone, 'Celesta')],
42713
+ [114, new GpifMidiProgramInfo(GpifIconIds.PitchedIdiophone, 'Vibraphone')],
42714
+ [115, new GpifMidiProgramInfo(GpifIconIds.Idiophone, 'Xylophone')],
42715
+ [116, new GpifMidiProgramInfo(GpifIconIds.Membraphone, 'Xylophone')],
42716
+ [117, new GpifMidiProgramInfo(GpifIconIds.Membraphone, 'Xylophone')],
42717
+ [118, new GpifMidiProgramInfo(GpifIconIds.Membraphone, 'Xylophone')],
42718
+ [119, new GpifMidiProgramInfo(GpifIconIds.Idiophone, 'Celesta')],
42719
+ [120, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Steel Guitar')],
42720
+ [121, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42721
+ [122, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42722
+ [123, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42723
+ [124, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42724
+ [125, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42725
+ [126, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Recorder')],
42726
+ [127, new GpifMidiProgramInfo(GpifIconIds.Fx, 'Timpani')]
42799
42727
  ]);
42800
- GpifWriter.DrumKitProgramInfo = new GpifMidiProgramInfo(GpifIconIds.PercussionKit, "Drums", "drumKit");
42728
+ GpifWriter.DrumKitProgramInfo = new GpifMidiProgramInfo(GpifIconIds.PercussionKit, 'Drums', 'drumKit');
42801
42729
 
42802
42730
  /**
42803
42731
  * CRC-32 with reversed data and unreversed output
42804
42732
  */
42805
42733
  class Crc32 {
42806
- /**
42807
- * Initialise a default instance of Crc32.
42808
- */
42809
- constructor() {
42810
- /**
42811
- * The CRC data checksum so far.
42812
- */
42813
- this._checkValue = Crc32.CrcInit;
42814
- this.reset();
42815
- }
42816
42734
  static buildCrc32Lookup() {
42817
42735
  const poly = 0xedb88320;
42818
42736
  const lookup = new Uint32Array(256);
@@ -42831,6 +42749,16 @@ class Crc32 {
42831
42749
  get value() {
42832
42750
  return ~this._checkValue;
42833
42751
  }
42752
+ /**
42753
+ * Initialise a default instance of Crc32.
42754
+ */
42755
+ constructor() {
42756
+ /**
42757
+ * The CRC data checksum so far.
42758
+ */
42759
+ this._checkValue = Crc32.CrcInit;
42760
+ this.reset();
42761
+ }
42834
42762
  /**
42835
42763
  * Update CRC data checksum based on a portion of a block of data
42836
42764
  * @param data The array containing the data to add
@@ -43266,16 +43194,6 @@ Tree.Repeat3To10 = 17;
43266
43194
  // repeat a zero length 11-138 times (7 bits of repeat count)
43267
43195
  Tree.Repeat11To138 = 18;
43268
43196
  class DeflaterHuffman {
43269
- constructor(pending) {
43270
- this.last_lit = 0;
43271
- this.extra_bits = 0;
43272
- this.pending = pending;
43273
- this.literalTree = new Tree(this, DeflaterHuffman.LITERAL_NUM, 257, 15);
43274
- this.distTree = new Tree(this, DeflaterHuffman.DIST_NUM, 1, 15);
43275
- this.blTree = new Tree(this, DeflaterHuffman.BITLEN_NUM, 4, 7);
43276
- this.d_buf = new Int16Array(DeflaterHuffman.BUFSIZE);
43277
- this.l_buf = new Uint8Array(DeflaterHuffman.BUFSIZE);
43278
- }
43279
43197
  static staticInit() {
43280
43198
  // See RFC 1951 3.2.6
43281
43199
  // Literal codes
@@ -43313,6 +43231,16 @@ class DeflaterHuffman {
43313
43231
  (DeflaterHuffman.bit4Reverse[(toReverse >> 8) & 0xf] << 4) |
43314
43232
  DeflaterHuffman.bit4Reverse[toReverse >> 12]);
43315
43233
  }
43234
+ constructor(pending) {
43235
+ this.last_lit = 0;
43236
+ this.extra_bits = 0;
43237
+ this.pending = pending;
43238
+ this.literalTree = new Tree(this, DeflaterHuffman.LITERAL_NUM, 257, 15);
43239
+ this.distTree = new Tree(this, DeflaterHuffman.DIST_NUM, 1, 15);
43240
+ this.blTree = new Tree(this, DeflaterHuffman.BITLEN_NUM, 4, 7);
43241
+ this.d_buf = new Int16Array(DeflaterHuffman.BUFSIZE);
43242
+ this.l_buf = new Uint8Array(DeflaterHuffman.BUFSIZE);
43243
+ }
43316
43244
  isFull() {
43317
43245
  return this.last_lit >= DeflaterHuffman.BUFSIZE;
43318
43246
  }
@@ -43924,6 +43852,12 @@ DeflaterEngine.TooFar = 4096;
43924
43852
  * Based on DeflaterPending.java
43925
43853
  */
43926
43854
  class PendingBuffer {
43855
+ /**
43856
+ * Indicates if buffer has been flushed
43857
+ */
43858
+ get isFlushed() {
43859
+ return this._end === 0;
43860
+ }
43927
43861
  /**
43928
43862
  * construct instance using specified buffer size
43929
43863
  * @param bufferSize size to use for internal buffer
@@ -43938,12 +43872,6 @@ class PendingBuffer {
43938
43872
  this.bitCount = 0;
43939
43873
  this._buffer = new Uint8Array(bufferSize);
43940
43874
  }
43941
- /**
43942
- * Indicates if buffer has been flushed
43943
- */
43944
- get isFlushed() {
43945
- return this._end === 0;
43946
- }
43947
43875
  /**
43948
43876
  * Clear internal state/buffers
43949
43877
  */
@@ -44046,6 +43974,9 @@ class PendingBuffer {
44046
43974
  * author of the original java version : Jochen Hoenicke
44047
43975
  */
44048
43976
  class Deflater {
43977
+ get inputCrc() {
43978
+ return this._engine.inputCrc.value;
43979
+ }
44049
43980
  /**
44050
43981
  * Creates a new deflater with given compression level
44051
43982
  * @param level the compression level, a value between NO_COMPRESSION and BEST_COMPRESSION.
@@ -44058,9 +43989,6 @@ class Deflater {
44058
43989
  this._engine = new DeflaterEngine(this._pending);
44059
43990
  this.reset();
44060
43991
  }
44061
- get inputCrc() {
44062
- return this._engine.inputCrc.value;
44063
- }
44064
43992
  /**
44065
43993
  * Returns true, if the input buffer is empty.
44066
43994
  * You should then call setInput().