@coderline/alphatab 1.3.0-alpha.355 → 1.3.0-alpha.374
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/README.md +1 -1
- package/dist/alphaTab.d.ts +148 -4
- package/dist/alphaTab.js +288 -156
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +2 -2
- package/dist/alphaTab.mjs +288 -156
- package/package.json +1 -1
package/dist/alphaTab.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* alphaTab v1.3.0-alpha.
|
|
2
|
+
* alphaTab v1.3.0-alpha.374 (develop, build 374)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -4031,6 +4031,73 @@ class Chord {
|
|
|
4031
4031
|
}
|
|
4032
4032
|
}
|
|
4033
4033
|
|
|
4034
|
+
/**
|
|
4035
|
+
* This public enumeration lists all available key signatures
|
|
4036
|
+
*/
|
|
4037
|
+
var KeySignature;
|
|
4038
|
+
(function (KeySignature) {
|
|
4039
|
+
/**
|
|
4040
|
+
* Cb (7 flats)
|
|
4041
|
+
*/
|
|
4042
|
+
KeySignature[KeySignature["Cb"] = -7] = "Cb";
|
|
4043
|
+
/**
|
|
4044
|
+
* Gb (6 flats)
|
|
4045
|
+
*/
|
|
4046
|
+
KeySignature[KeySignature["Gb"] = -6] = "Gb";
|
|
4047
|
+
/**
|
|
4048
|
+
* Db (5 flats)
|
|
4049
|
+
*/
|
|
4050
|
+
KeySignature[KeySignature["Db"] = -5] = "Db";
|
|
4051
|
+
/**
|
|
4052
|
+
* Ab (4 flats)
|
|
4053
|
+
*/
|
|
4054
|
+
KeySignature[KeySignature["Ab"] = -4] = "Ab";
|
|
4055
|
+
/**
|
|
4056
|
+
* Eb (3 flats)
|
|
4057
|
+
*/
|
|
4058
|
+
KeySignature[KeySignature["Eb"] = -3] = "Eb";
|
|
4059
|
+
/**
|
|
4060
|
+
* Bb (2 flats)
|
|
4061
|
+
*/
|
|
4062
|
+
KeySignature[KeySignature["Bb"] = -2] = "Bb";
|
|
4063
|
+
/**
|
|
4064
|
+
* F (1 flat)
|
|
4065
|
+
*/
|
|
4066
|
+
KeySignature[KeySignature["F"] = -1] = "F";
|
|
4067
|
+
/**
|
|
4068
|
+
* C (no signs)
|
|
4069
|
+
*/
|
|
4070
|
+
KeySignature[KeySignature["C"] = 0] = "C";
|
|
4071
|
+
/**
|
|
4072
|
+
* G (1 sharp)
|
|
4073
|
+
*/
|
|
4074
|
+
KeySignature[KeySignature["G"] = 1] = "G";
|
|
4075
|
+
/**
|
|
4076
|
+
* D (2 sharp)
|
|
4077
|
+
*/
|
|
4078
|
+
KeySignature[KeySignature["D"] = 2] = "D";
|
|
4079
|
+
/**
|
|
4080
|
+
* A (3 sharp)
|
|
4081
|
+
*/
|
|
4082
|
+
KeySignature[KeySignature["A"] = 3] = "A";
|
|
4083
|
+
/**
|
|
4084
|
+
* E (4 sharp)
|
|
4085
|
+
*/
|
|
4086
|
+
KeySignature[KeySignature["E"] = 4] = "E";
|
|
4087
|
+
/**
|
|
4088
|
+
* B (5 sharp)
|
|
4089
|
+
*/
|
|
4090
|
+
KeySignature[KeySignature["B"] = 5] = "B";
|
|
4091
|
+
/**
|
|
4092
|
+
* F# (6 sharp)
|
|
4093
|
+
*/
|
|
4094
|
+
KeySignature[KeySignature["FSharp"] = 6] = "FSharp";
|
|
4095
|
+
/**
|
|
4096
|
+
* C# (7 sharp)
|
|
4097
|
+
*/
|
|
4098
|
+
KeySignature[KeySignature["CSharp"] = 7] = "CSharp";
|
|
4099
|
+
})(KeySignature || (KeySignature = {}));
|
|
4100
|
+
|
|
4034
4101
|
var LyricsState;
|
|
4035
4102
|
(function (LyricsState) {
|
|
4036
4103
|
LyricsState[LyricsState["IgnoreSpaces"] = 0] = "IgnoreSpaces";
|
|
@@ -4166,73 +4233,6 @@ Lyrics.CharCodeBrackedClose = 93;
|
|
|
4166
4233
|
Lyrics.CharCodeBrackedOpen = 91;
|
|
4167
4234
|
Lyrics.CharCodeDash = 45;
|
|
4168
4235
|
|
|
4169
|
-
/**
|
|
4170
|
-
* This public enumeration lists all available key signatures
|
|
4171
|
-
*/
|
|
4172
|
-
var KeySignature;
|
|
4173
|
-
(function (KeySignature) {
|
|
4174
|
-
/**
|
|
4175
|
-
* Cb (7 flats)
|
|
4176
|
-
*/
|
|
4177
|
-
KeySignature[KeySignature["Cb"] = -7] = "Cb";
|
|
4178
|
-
/**
|
|
4179
|
-
* Gb (6 flats)
|
|
4180
|
-
*/
|
|
4181
|
-
KeySignature[KeySignature["Gb"] = -6] = "Gb";
|
|
4182
|
-
/**
|
|
4183
|
-
* Db (5 flats)
|
|
4184
|
-
*/
|
|
4185
|
-
KeySignature[KeySignature["Db"] = -5] = "Db";
|
|
4186
|
-
/**
|
|
4187
|
-
* Ab (4 flats)
|
|
4188
|
-
*/
|
|
4189
|
-
KeySignature[KeySignature["Ab"] = -4] = "Ab";
|
|
4190
|
-
/**
|
|
4191
|
-
* Eb (3 flats)
|
|
4192
|
-
*/
|
|
4193
|
-
KeySignature[KeySignature["Eb"] = -3] = "Eb";
|
|
4194
|
-
/**
|
|
4195
|
-
* Bb (2 flats)
|
|
4196
|
-
*/
|
|
4197
|
-
KeySignature[KeySignature["Bb"] = -2] = "Bb";
|
|
4198
|
-
/**
|
|
4199
|
-
* F (1 flat)
|
|
4200
|
-
*/
|
|
4201
|
-
KeySignature[KeySignature["F"] = -1] = "F";
|
|
4202
|
-
/**
|
|
4203
|
-
* C (no signs)
|
|
4204
|
-
*/
|
|
4205
|
-
KeySignature[KeySignature["C"] = 0] = "C";
|
|
4206
|
-
/**
|
|
4207
|
-
* G (1 sharp)
|
|
4208
|
-
*/
|
|
4209
|
-
KeySignature[KeySignature["G"] = 1] = "G";
|
|
4210
|
-
/**
|
|
4211
|
-
* D (2 sharp)
|
|
4212
|
-
*/
|
|
4213
|
-
KeySignature[KeySignature["D"] = 2] = "D";
|
|
4214
|
-
/**
|
|
4215
|
-
* A (3 sharp)
|
|
4216
|
-
*/
|
|
4217
|
-
KeySignature[KeySignature["A"] = 3] = "A";
|
|
4218
|
-
/**
|
|
4219
|
-
* E (4 sharp)
|
|
4220
|
-
*/
|
|
4221
|
-
KeySignature[KeySignature["E"] = 4] = "E";
|
|
4222
|
-
/**
|
|
4223
|
-
* B (5 sharp)
|
|
4224
|
-
*/
|
|
4225
|
-
KeySignature[KeySignature["B"] = 5] = "B";
|
|
4226
|
-
/**
|
|
4227
|
-
* F# (6 sharp)
|
|
4228
|
-
*/
|
|
4229
|
-
KeySignature[KeySignature["FSharp"] = 6] = "FSharp";
|
|
4230
|
-
/**
|
|
4231
|
-
* C# (8 sharp)
|
|
4232
|
-
*/
|
|
4233
|
-
KeySignature[KeySignature["CSharp"] = 7] = "CSharp";
|
|
4234
|
-
})(KeySignature || (KeySignature = {}));
|
|
4235
|
-
|
|
4236
4236
|
/**
|
|
4237
4237
|
* This public enumeration lists all available types of KeySignatures
|
|
4238
4238
|
*/
|
|
@@ -5701,11 +5701,11 @@ class AlphaTexError extends AlphaTabError {
|
|
|
5701
5701
|
}
|
|
5702
5702
|
static symbolError(position, nonTerm, expected, symbol, symbolData = null) {
|
|
5703
5703
|
let message;
|
|
5704
|
-
if (
|
|
5704
|
+
if (expected !== symbol) {
|
|
5705
5705
|
message = `MalFormed AlphaTex: @${position}: Error on block ${nonTerm}, expected a ${AlphaTexSymbols[expected]} found a ${AlphaTexSymbols[symbol]}: '${symbolData}'`;
|
|
5706
5706
|
}
|
|
5707
5707
|
else {
|
|
5708
|
-
message = `MalFormed AlphaTex: @${position}: Error on block ${nonTerm}, invalid value: ${symbolData}`;
|
|
5708
|
+
message = `MalFormed AlphaTex: @${position}: Error on block ${nonTerm}, invalid value: '${symbolData}'`;
|
|
5709
5709
|
}
|
|
5710
5710
|
let exception = new AlphaTexError(message);
|
|
5711
5711
|
exception.position = position;
|
|
@@ -5716,7 +5716,7 @@ class AlphaTexError extends AlphaTabError {
|
|
|
5716
5716
|
return exception;
|
|
5717
5717
|
}
|
|
5718
5718
|
static errorMessage(position, message) {
|
|
5719
|
-
message =
|
|
5719
|
+
message = `MalFormed AlphaTex: @${position}: ${message}`;
|
|
5720
5720
|
let exception = new AlphaTexError(message);
|
|
5721
5721
|
exception.position = position;
|
|
5722
5722
|
return exception;
|
|
@@ -5804,7 +5804,7 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
5804
5804
|
error(nonterm, expected, symbolError = true) {
|
|
5805
5805
|
let e;
|
|
5806
5806
|
if (symbolError) {
|
|
5807
|
-
e = AlphaTexError.symbolError(this._curChPos, nonterm, expected, this._sy,
|
|
5807
|
+
e = AlphaTexError.symbolError(this._curChPos, nonterm, expected, this._sy, this._syData);
|
|
5808
5808
|
}
|
|
5809
5809
|
else {
|
|
5810
5810
|
e = AlphaTexError.symbolError(this._curChPos, nonterm, expected, expected, this._syData);
|
|
@@ -5945,37 +5945,65 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
5945
5945
|
parseKeySignature(str) {
|
|
5946
5946
|
switch (str.toLowerCase()) {
|
|
5947
5947
|
case 'cb':
|
|
5948
|
-
|
|
5948
|
+
case 'cbmajor':
|
|
5949
|
+
return KeySignature.Cb;
|
|
5949
5950
|
case 'gb':
|
|
5950
|
-
|
|
5951
|
+
case 'gbmajor':
|
|
5952
|
+
case 'd#minor':
|
|
5953
|
+
return KeySignature.Gb;
|
|
5951
5954
|
case 'db':
|
|
5952
|
-
|
|
5955
|
+
case 'dbmajor':
|
|
5956
|
+
case 'bbminor':
|
|
5957
|
+
return KeySignature.Db;
|
|
5953
5958
|
case 'ab':
|
|
5954
|
-
|
|
5959
|
+
case 'abmajor':
|
|
5960
|
+
case 'fminor':
|
|
5961
|
+
return KeySignature.Ab;
|
|
5955
5962
|
case 'eb':
|
|
5956
|
-
|
|
5963
|
+
case 'ebmajor':
|
|
5964
|
+
case 'cminor':
|
|
5965
|
+
return KeySignature.Eb;
|
|
5957
5966
|
case 'bb':
|
|
5958
|
-
|
|
5967
|
+
case 'bbmajor':
|
|
5968
|
+
case 'gminor':
|
|
5969
|
+
return KeySignature.Bb;
|
|
5959
5970
|
case 'f':
|
|
5960
|
-
|
|
5971
|
+
case 'fmajor':
|
|
5972
|
+
case 'dminor':
|
|
5973
|
+
return KeySignature.F;
|
|
5961
5974
|
case 'c':
|
|
5962
|
-
|
|
5975
|
+
case 'cmajor':
|
|
5976
|
+
case 'aminor':
|
|
5977
|
+
return KeySignature.C;
|
|
5963
5978
|
case 'g':
|
|
5964
|
-
|
|
5979
|
+
case 'gmajor':
|
|
5980
|
+
case 'eminor':
|
|
5981
|
+
return KeySignature.G;
|
|
5965
5982
|
case 'd':
|
|
5966
|
-
|
|
5983
|
+
case 'dmajor':
|
|
5984
|
+
case 'bminor':
|
|
5985
|
+
return KeySignature.D;
|
|
5967
5986
|
case 'a':
|
|
5968
|
-
|
|
5987
|
+
case 'amajor':
|
|
5988
|
+
case 'f#minor':
|
|
5989
|
+
return KeySignature.A;
|
|
5969
5990
|
case 'e':
|
|
5970
|
-
|
|
5991
|
+
case 'emajor':
|
|
5992
|
+
case 'c#minor':
|
|
5993
|
+
return KeySignature.E;
|
|
5971
5994
|
case 'b':
|
|
5972
|
-
|
|
5995
|
+
case 'bmajor':
|
|
5996
|
+
case 'g#minor':
|
|
5997
|
+
return KeySignature.B;
|
|
5973
5998
|
case 'f#':
|
|
5974
|
-
|
|
5999
|
+
case 'f#major':
|
|
6000
|
+
case 'ebminor':
|
|
6001
|
+
return KeySignature.FSharp;
|
|
5975
6002
|
case 'c#':
|
|
5976
|
-
|
|
6003
|
+
case 'c#major':
|
|
6004
|
+
return KeySignature.CSharp;
|
|
5977
6005
|
default:
|
|
5978
|
-
return
|
|
6006
|
+
return KeySignature.C;
|
|
5979
6007
|
// error("keysignature-value", AlphaTexSymbols.String, false); return 0
|
|
5980
6008
|
}
|
|
5981
6009
|
}
|
|
@@ -6016,7 +6044,7 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
6016
6044
|
}
|
|
6017
6045
|
else if (this._ch === 0x2a /* * */) {
|
|
6018
6046
|
// multiline comment
|
|
6019
|
-
while (this._ch !==
|
|
6047
|
+
while (this._ch !== AlphaTexImporter.Eof) {
|
|
6020
6048
|
if (this._ch === 0x2a /* * */) {
|
|
6021
6049
|
this._ch = this.nextChar();
|
|
6022
6050
|
if (this._ch === 0x2f /* / */) {
|
|
@@ -6049,9 +6077,8 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
6049
6077
|
// negative number
|
|
6050
6078
|
// is number?
|
|
6051
6079
|
if (this._allowNegatives && this.isDigit(this._ch)) {
|
|
6052
|
-
let num = this.readNumber();
|
|
6053
6080
|
this._sy = AlphaTexSymbols.Number;
|
|
6054
|
-
this._syData =
|
|
6081
|
+
this._syData = this.readNumber();
|
|
6055
6082
|
}
|
|
6056
6083
|
else {
|
|
6057
6084
|
this._sy = AlphaTexSymbols.String;
|
|
@@ -6072,9 +6099,8 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
6072
6099
|
}
|
|
6073
6100
|
else if (this._ch === 0x5c /* \ */) {
|
|
6074
6101
|
this._ch = this.nextChar();
|
|
6075
|
-
let name = this.readName();
|
|
6076
6102
|
this._sy = AlphaTexSymbols.MetaCommand;
|
|
6077
|
-
this._syData =
|
|
6103
|
+
this._syData = this.readName();
|
|
6078
6104
|
}
|
|
6079
6105
|
else if (this._ch === 0x29 /* ) */) {
|
|
6080
6106
|
this._sy = AlphaTexSymbols.RParensis;
|
|
@@ -6101,9 +6127,8 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
6101
6127
|
this._ch = this.nextChar();
|
|
6102
6128
|
}
|
|
6103
6129
|
else if (this.isDigit(this._ch)) {
|
|
6104
|
-
let num = this.readNumber();
|
|
6105
6130
|
this._sy = AlphaTexSymbols.Number;
|
|
6106
|
-
this._syData =
|
|
6131
|
+
this._syData = this.readNumber();
|
|
6107
6132
|
}
|
|
6108
6133
|
else if (AlphaTexImporter.isLetter(this._ch)) {
|
|
6109
6134
|
let name = this.readName();
|
|
@@ -7366,8 +7391,8 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
7366
7391
|
}
|
|
7367
7392
|
this._sy = this.newSy();
|
|
7368
7393
|
}
|
|
7369
|
-
toFinger(
|
|
7370
|
-
switch (
|
|
7394
|
+
toFinger(num) {
|
|
7395
|
+
switch (num) {
|
|
7371
7396
|
case 1:
|
|
7372
7397
|
return Fingers.Thumb;
|
|
7373
7398
|
case 2:
|
|
@@ -7403,6 +7428,8 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
7403
7428
|
return Duration.SixtyFourth;
|
|
7404
7429
|
case 128:
|
|
7405
7430
|
return Duration.OneHundredTwentyEighth;
|
|
7431
|
+
case 256:
|
|
7432
|
+
return Duration.TwoHundredFiftySixth;
|
|
7406
7433
|
default:
|
|
7407
7434
|
return Duration.Quarter;
|
|
7408
7435
|
}
|
|
@@ -7435,6 +7462,9 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
7435
7462
|
if (this._sy !== AlphaTexSymbols.Number) {
|
|
7436
7463
|
this.error('repeatclose', AlphaTexSymbols.Number, true);
|
|
7437
7464
|
}
|
|
7465
|
+
if (this._syData > 2048) {
|
|
7466
|
+
this.error('repeatclose', AlphaTexSymbols.Number, false);
|
|
7467
|
+
}
|
|
7438
7468
|
master.repeatCount = this._syData;
|
|
7439
7469
|
this._sy = this.newSy();
|
|
7440
7470
|
}
|
|
@@ -7466,14 +7496,14 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
7466
7496
|
if (this._sy !== AlphaTexSymbols.String) {
|
|
7467
7497
|
this.error('keysignature', AlphaTexSymbols.String, true);
|
|
7468
7498
|
}
|
|
7469
|
-
master.keySignature = this.parseKeySignature(this._syData
|
|
7499
|
+
master.keySignature = this.parseKeySignature(this._syData);
|
|
7470
7500
|
this._sy = this.newSy();
|
|
7471
7501
|
}
|
|
7472
7502
|
else if (syData === 'clef') {
|
|
7473
7503
|
this._sy = this.newSy();
|
|
7474
7504
|
switch (this._sy) {
|
|
7475
7505
|
case AlphaTexSymbols.String:
|
|
7476
|
-
bar.clef = this.parseClefFromString(this._syData
|
|
7506
|
+
bar.clef = this.parseClefFromString(this._syData);
|
|
7477
7507
|
break;
|
|
7478
7508
|
case AlphaTexSymbols.Number:
|
|
7479
7509
|
bar.clef = this.parseClefFromInt(this._syData);
|
|
@@ -7524,7 +7554,7 @@ class AlphaTexImporter extends ScoreImporter {
|
|
|
7524
7554
|
this._allowTuning = true;
|
|
7525
7555
|
switch (this._sy) {
|
|
7526
7556
|
case AlphaTexSymbols.String:
|
|
7527
|
-
master.tripletFeel = this.parseTripletFeelFromString(this._syData
|
|
7557
|
+
master.tripletFeel = this.parseTripletFeelFromString(this._syData);
|
|
7528
7558
|
break;
|
|
7529
7559
|
case AlphaTexSymbols.Number:
|
|
7530
7560
|
master.tripletFeel = this.parseTripletFeelFromInt(this._syData);
|
|
@@ -14530,7 +14560,7 @@ class MidiFileSequencer {
|
|
|
14530
14560
|
}
|
|
14531
14561
|
}
|
|
14532
14562
|
get currentTime() {
|
|
14533
|
-
return this._currentState.currentTime;
|
|
14563
|
+
return this._currentState.currentTime / this.playbackSpeed;
|
|
14534
14564
|
}
|
|
14535
14565
|
/**
|
|
14536
14566
|
* Gets the duration of the song in ticks.
|
|
@@ -17457,6 +17487,11 @@ class AlphaSynth {
|
|
|
17457
17487
|
this._notPlayedSamples += samples.length;
|
|
17458
17488
|
this.output.addSamples(samples);
|
|
17459
17489
|
}
|
|
17490
|
+
else {
|
|
17491
|
+
// Tell output that there is no data left for it.
|
|
17492
|
+
let samples = new Float32Array(0);
|
|
17493
|
+
this.output.addSamples(samples);
|
|
17494
|
+
}
|
|
17460
17495
|
});
|
|
17461
17496
|
this.output.samplesPlayed.on(this.onSamplesPlayed.bind(this));
|
|
17462
17497
|
this.output.open(bufferTimeInMilliseconds);
|
|
@@ -17559,7 +17594,7 @@ class AlphaSynth {
|
|
|
17559
17594
|
Logger.debug('AlphaSynth', 'Starting countin');
|
|
17560
17595
|
this._sequencer.startCountIn();
|
|
17561
17596
|
this._synthesizer.setupMetronomeChannel(this._countInVolume);
|
|
17562
|
-
this.
|
|
17597
|
+
this.updateTimePosition(0, true);
|
|
17563
17598
|
}
|
|
17564
17599
|
this.output.play();
|
|
17565
17600
|
return true;
|
|
@@ -17711,6 +17746,7 @@ class AlphaSynth {
|
|
|
17711
17746
|
this._sequencer.resetCountIn();
|
|
17712
17747
|
this.timePosition = this._sequencer.currentTime;
|
|
17713
17748
|
this.playInternal();
|
|
17749
|
+
this.output.resetSamples();
|
|
17714
17750
|
}
|
|
17715
17751
|
else if (this._sequencer.isPlayingOneTimeMidi) {
|
|
17716
17752
|
Logger.debug('AlphaSynth', 'Finished playback (one time)');
|
|
@@ -17962,6 +17998,7 @@ class FontParser {
|
|
|
17962
17998
|
this.lineHeight = 'normal';
|
|
17963
17999
|
this.size = '1rem';
|
|
17964
18000
|
this.families = [];
|
|
18001
|
+
this.parseOnlyFamilies = false;
|
|
17965
18002
|
this._currentTokenIndex = -1;
|
|
17966
18003
|
this._input = '';
|
|
17967
18004
|
this._currentToken = null;
|
|
@@ -17999,13 +18036,26 @@ class FontParser {
|
|
|
17999
18036
|
return;
|
|
18000
18037
|
}
|
|
18001
18038
|
}
|
|
18002
|
-
this.
|
|
18003
|
-
|
|
18039
|
+
if (!this.parseOnlyFamilies) {
|
|
18040
|
+
this.fontStyleVariantWeight();
|
|
18041
|
+
this.fontSizeLineHeight();
|
|
18042
|
+
}
|
|
18004
18043
|
this.fontFamily();
|
|
18005
18044
|
}
|
|
18045
|
+
static parseFamilies(value) {
|
|
18046
|
+
const parser = new FontParser(value);
|
|
18047
|
+
parser.parseOnlyFamilies = true;
|
|
18048
|
+
parser.parse();
|
|
18049
|
+
return parser.families;
|
|
18050
|
+
}
|
|
18006
18051
|
fontFamily() {
|
|
18007
18052
|
if (!this._currentToken) {
|
|
18008
|
-
|
|
18053
|
+
if (this.parseOnlyFamilies) {
|
|
18054
|
+
return;
|
|
18055
|
+
}
|
|
18056
|
+
else {
|
|
18057
|
+
throw new Error(`Missing font list`);
|
|
18058
|
+
}
|
|
18009
18059
|
}
|
|
18010
18060
|
const familyListInput = this._input.substr(this._currentToken.startPos).trim();
|
|
18011
18061
|
let pos = 0;
|
|
@@ -18181,6 +18231,13 @@ class FontParser {
|
|
|
18181
18231
|
this._currentTokenIndex = -1;
|
|
18182
18232
|
this.nextToken();
|
|
18183
18233
|
}
|
|
18234
|
+
static quoteFont(f) {
|
|
18235
|
+
if (f.indexOf(' ') === -1) {
|
|
18236
|
+
return f;
|
|
18237
|
+
}
|
|
18238
|
+
const escapedQuotes = f.replaceAll('"', '\\"');
|
|
18239
|
+
return `"${escapedQuotes}"`;
|
|
18240
|
+
}
|
|
18184
18241
|
}
|
|
18185
18242
|
/**
|
|
18186
18243
|
* Lists all flags for font styles.
|
|
@@ -18223,7 +18280,7 @@ class Font {
|
|
|
18223
18280
|
*/
|
|
18224
18281
|
constructor(family, size, style = FontStyle.Plain, weight = FontWeight.Regular) {
|
|
18225
18282
|
this._cssScale = 0.0;
|
|
18226
|
-
this.
|
|
18283
|
+
this._families = FontParser.parseFamilies(family);
|
|
18227
18284
|
this._size = size;
|
|
18228
18285
|
this._style = style;
|
|
18229
18286
|
this._weight = weight;
|
|
@@ -18234,16 +18291,30 @@ class Font {
|
|
|
18234
18291
|
this._css = this.toCssString();
|
|
18235
18292
|
}
|
|
18236
18293
|
/**
|
|
18237
|
-
* Gets the font family name.
|
|
18294
|
+
* Gets the first font family name.
|
|
18295
|
+
* @deprecated Consider using {@link families} for multi font family support.
|
|
18238
18296
|
*/
|
|
18239
18297
|
get family() {
|
|
18240
|
-
return this.
|
|
18298
|
+
return this._families[0];
|
|
18241
18299
|
}
|
|
18242
18300
|
/**
|
|
18243
|
-
* Sets the font family
|
|
18301
|
+
* Sets the font family list.
|
|
18302
|
+
* @deprecated Consider using {@link families} for multi font family support.
|
|
18244
18303
|
*/
|
|
18245
18304
|
set family(value) {
|
|
18246
|
-
this.
|
|
18305
|
+
this.families = FontParser.parseFamilies(value);
|
|
18306
|
+
}
|
|
18307
|
+
/**
|
|
18308
|
+
* Gets the font family name.
|
|
18309
|
+
*/
|
|
18310
|
+
get families() {
|
|
18311
|
+
return this._families;
|
|
18312
|
+
}
|
|
18313
|
+
/**
|
|
18314
|
+
* Sets the font family name.
|
|
18315
|
+
*/
|
|
18316
|
+
set families(value) {
|
|
18317
|
+
this._families = value;
|
|
18247
18318
|
this.reset();
|
|
18248
18319
|
}
|
|
18249
18320
|
/**
|
|
@@ -18291,6 +18362,18 @@ class Font {
|
|
|
18291
18362
|
get isItalic() {
|
|
18292
18363
|
return this.style === FontStyle.Italic;
|
|
18293
18364
|
}
|
|
18365
|
+
/**
|
|
18366
|
+
* Initializes a new instance of the {@link Font} class.
|
|
18367
|
+
* @param families The families.
|
|
18368
|
+
* @param size The size.
|
|
18369
|
+
* @param style The style.
|
|
18370
|
+
* @param weight The weight.
|
|
18371
|
+
*/
|
|
18372
|
+
static withFamilyList(families, size, style = FontStyle.Plain, weight = FontWeight.Regular) {
|
|
18373
|
+
const f = new Font("", size, style, weight);
|
|
18374
|
+
f.families = families;
|
|
18375
|
+
return f;
|
|
18376
|
+
}
|
|
18294
18377
|
toCssString(scale = 1) {
|
|
18295
18378
|
if (!this._css || !(Math.abs(scale - this._cssScale) < 0.01)) {
|
|
18296
18379
|
let buf = '';
|
|
@@ -18302,9 +18385,7 @@ class Font {
|
|
|
18302
18385
|
}
|
|
18303
18386
|
buf += this.size * scale;
|
|
18304
18387
|
buf += 'px ';
|
|
18305
|
-
buf +=
|
|
18306
|
-
buf += this.family;
|
|
18307
|
-
buf += "'";
|
|
18388
|
+
buf += this.families.map(f => FontParser.quoteFont(f)).join(', ');
|
|
18308
18389
|
this._css = buf;
|
|
18309
18390
|
this._cssScale = scale;
|
|
18310
18391
|
}
|
|
@@ -18316,21 +18397,17 @@ class Font {
|
|
|
18316
18397
|
return null;
|
|
18317
18398
|
case 'object': {
|
|
18318
18399
|
const m = v;
|
|
18319
|
-
let
|
|
18400
|
+
let families = m.get('families');
|
|
18320
18401
|
// tslint:disable-next-line: no-unnecessary-type-assertion
|
|
18321
18402
|
let size = m.get('size');
|
|
18322
18403
|
let style = JsonHelper.parseEnum(m.get('style'), FontStyle);
|
|
18323
18404
|
let weight = JsonHelper.parseEnum(m.get('weight'), FontWeight);
|
|
18324
|
-
return
|
|
18405
|
+
return Font.withFamilyList(families, size, style, weight);
|
|
18325
18406
|
}
|
|
18326
18407
|
case 'string': {
|
|
18327
18408
|
const parser = new FontParser(v);
|
|
18328
18409
|
parser.parse();
|
|
18329
|
-
let
|
|
18330
|
-
if ((family.startsWith("'") && family.endsWith("'")) ||
|
|
18331
|
-
(family.startsWith('"') && family.endsWith('"'))) {
|
|
18332
|
-
family = family.substr(1, family.length - 2);
|
|
18333
|
-
}
|
|
18410
|
+
let families = parser.families;
|
|
18334
18411
|
let fontSizeString = parser.size.toLowerCase();
|
|
18335
18412
|
let fontSize = 0;
|
|
18336
18413
|
// as per https://websemantics.uk/articles/font-size-conversion/
|
|
@@ -18393,7 +18470,7 @@ class Font {
|
|
|
18393
18470
|
fontWeight = FontWeight.Bold;
|
|
18394
18471
|
break;
|
|
18395
18472
|
}
|
|
18396
|
-
return
|
|
18473
|
+
return Font.withFamilyList(families, fontSize, fontStyle, fontWeight);
|
|
18397
18474
|
}
|
|
18398
18475
|
default:
|
|
18399
18476
|
return null;
|
|
@@ -18401,7 +18478,7 @@ class Font {
|
|
|
18401
18478
|
}
|
|
18402
18479
|
static toJson(font) {
|
|
18403
18480
|
const o = new Map();
|
|
18404
|
-
o.set('
|
|
18481
|
+
o.set('families', font.families);
|
|
18405
18482
|
o.set('size', font.size);
|
|
18406
18483
|
o.set('style', font.style);
|
|
18407
18484
|
o.set('weight', font.weight);
|
|
@@ -18485,8 +18562,8 @@ class RenderingResources {
|
|
|
18485
18562
|
this.scoreInfoColor = new Color(0, 0, 0, 0xff);
|
|
18486
18563
|
}
|
|
18487
18564
|
}
|
|
18488
|
-
RenderingResources.sansFont = 'Arial';
|
|
18489
|
-
RenderingResources.serifFont = 'Georgia';
|
|
18565
|
+
RenderingResources.sansFont = 'Arial, sans-serif';
|
|
18566
|
+
RenderingResources.serifFont = 'Georgia, serif';
|
|
18490
18567
|
|
|
18491
18568
|
/**
|
|
18492
18569
|
* The display settings control how the general layout and display of alphaTab is done.
|
|
@@ -21052,9 +21129,17 @@ class FontSizes {
|
|
|
21052
21129
|
FontSizes.FontSizeLookupTables.set(family, new Uint8Array([8]));
|
|
21053
21130
|
}
|
|
21054
21131
|
}
|
|
21055
|
-
static measureString(s,
|
|
21132
|
+
static measureString(s, families, size, style, weight) {
|
|
21056
21133
|
let data;
|
|
21057
21134
|
let dataSize = 11;
|
|
21135
|
+
let family = families[0]; // default to first font
|
|
21136
|
+
// find a font which is maybe registered already
|
|
21137
|
+
for (let i = 0; i < families.length; i++) {
|
|
21138
|
+
if (FontSizes.FontSizeLookupTables.has(families[i])) {
|
|
21139
|
+
family = families[i];
|
|
21140
|
+
break;
|
|
21141
|
+
}
|
|
21142
|
+
}
|
|
21058
21143
|
if (!FontSizes.FontSizeLookupTables.has(family)) {
|
|
21059
21144
|
FontSizes.generateFontLookup(family);
|
|
21060
21145
|
}
|
|
@@ -24353,6 +24438,10 @@ class AlphaTabApiBase {
|
|
|
24353
24438
|
* Applies any changes that were done to the settings object and informs the {@link renderer} about any new values to consider.
|
|
24354
24439
|
*/
|
|
24355
24440
|
updateSettings() {
|
|
24441
|
+
const score = this.score;
|
|
24442
|
+
if (score) {
|
|
24443
|
+
ModelUtils.applyPitchOffsets(this.settings, score);
|
|
24444
|
+
}
|
|
24356
24445
|
this.renderer.updateSettings(this.settings);
|
|
24357
24446
|
// enable/disable player if needed
|
|
24358
24447
|
if (this.settings.player.enablePlayer) {
|
|
@@ -24434,8 +24523,8 @@ class AlphaTabApiBase {
|
|
|
24434
24523
|
}
|
|
24435
24524
|
}
|
|
24436
24525
|
internalRenderTracks(score, tracks) {
|
|
24526
|
+
ModelUtils.applyPitchOffsets(this.settings, score);
|
|
24437
24527
|
if (score !== this.score) {
|
|
24438
|
-
ModelUtils.applyPitchOffsets(this.settings, score);
|
|
24439
24528
|
this.score = score;
|
|
24440
24529
|
this.tracks = tracks;
|
|
24441
24530
|
this._trackIndexes = [];
|
|
@@ -25727,11 +25816,12 @@ HtmlElementContainer.resizeObserver = new Lazy(() => new ResizeObserver((entries
|
|
|
25727
25816
|
* @target web
|
|
25728
25817
|
*/
|
|
25729
25818
|
class FontLoadingChecker {
|
|
25730
|
-
constructor(
|
|
25819
|
+
constructor(families) {
|
|
25731
25820
|
this._isStarted = false;
|
|
25732
25821
|
this.isFontLoaded = false;
|
|
25733
25822
|
this.fontLoaded = new EventEmitterOfT();
|
|
25734
|
-
this.
|
|
25823
|
+
this._originalFamilies = families;
|
|
25824
|
+
this._families = families;
|
|
25735
25825
|
}
|
|
25736
25826
|
checkForFontAvailability() {
|
|
25737
25827
|
if (Environment.isRunningInWorker) {
|
|
@@ -25745,30 +25835,62 @@ class FontLoadingChecker {
|
|
|
25745
25835
|
this._isStarted = true;
|
|
25746
25836
|
let failCounter = 0;
|
|
25747
25837
|
let failCounterId = window.setInterval(() => {
|
|
25748
|
-
failCounter
|
|
25749
|
-
|
|
25838
|
+
Logger.warning('Rendering', `Could not load font '${this._families[0]}' within ${(failCounter + 1) * 5} seconds`, null);
|
|
25839
|
+
// try loading next font if there are more than 1 left
|
|
25840
|
+
if (this._families.length > 1) {
|
|
25841
|
+
this._families.shift();
|
|
25842
|
+
failCounter = 0;
|
|
25843
|
+
}
|
|
25844
|
+
else {
|
|
25845
|
+
failCounter++;
|
|
25846
|
+
}
|
|
25750
25847
|
}, 5000);
|
|
25751
|
-
Logger.debug('Font', `Start checking for font availablility: ${this.
|
|
25752
|
-
|
|
25848
|
+
Logger.debug('Font', `Start checking for font availablility: ${this._families.join(', ')}`);
|
|
25849
|
+
let errorHandler = () => {
|
|
25850
|
+
if (this._families.length > 1) {
|
|
25851
|
+
Logger.debug('Font', `[${this._families[0]}] Loading Failed, switching to ${this._families[1]}`);
|
|
25852
|
+
this._families.shift();
|
|
25853
|
+
window.setTimeout(() => {
|
|
25854
|
+
checkFont();
|
|
25855
|
+
}, 0);
|
|
25856
|
+
}
|
|
25857
|
+
else {
|
|
25858
|
+
Logger.error('Font', `[${this._originalFamilies.join(',')}] Loading Failed, rendering cannot start`);
|
|
25859
|
+
window.clearInterval(failCounterId);
|
|
25860
|
+
}
|
|
25861
|
+
};
|
|
25862
|
+
let successHandler = (font) => {
|
|
25863
|
+
Logger.debug('Rendering', `[${font}] Font API signaled available`);
|
|
25864
|
+
this.isFontLoaded = true;
|
|
25865
|
+
window.clearInterval(failCounterId);
|
|
25866
|
+
this.fontLoaded.trigger(this._families[0]);
|
|
25867
|
+
};
|
|
25753
25868
|
let checkFont = () => {
|
|
25754
|
-
|
|
25755
|
-
|
|
25756
|
-
if (document.fonts.check('1em ' +
|
|
25757
|
-
|
|
25758
|
-
|
|
25759
|
-
|
|
25760
|
-
|
|
25869
|
+
// Fast Path: check if one of the specified fonts is already available.
|
|
25870
|
+
for (const font of this._families) {
|
|
25871
|
+
if (document.fonts.check('1em ' + font)) {
|
|
25872
|
+
successHandler(font);
|
|
25873
|
+
return;
|
|
25874
|
+
}
|
|
25875
|
+
}
|
|
25876
|
+
// Slow path: Wait for fonts to be loaded sequentially
|
|
25877
|
+
const promise = document.fonts.load(`1em ${this._families[0]}`);
|
|
25878
|
+
promise.then(() => {
|
|
25879
|
+
Logger.debug('Font', `[${this._families[0]}] Font API signaled loaded`);
|
|
25880
|
+
if (document.fonts.check('1em ' + this._families[0])) {
|
|
25881
|
+
successHandler(this._families[0]);
|
|
25761
25882
|
}
|
|
25762
25883
|
else {
|
|
25763
|
-
|
|
25764
|
-
window.setTimeout(() => {
|
|
25765
|
-
checkFont();
|
|
25766
|
-
}, 250);
|
|
25884
|
+
errorHandler();
|
|
25767
25885
|
}
|
|
25768
25886
|
return true;
|
|
25887
|
+
}, reason => {
|
|
25888
|
+
errorHandler();
|
|
25769
25889
|
});
|
|
25770
25890
|
};
|
|
25771
|
-
|
|
25891
|
+
document.fonts.ready.then(() => {
|
|
25892
|
+
checkFont();
|
|
25893
|
+
});
|
|
25772
25894
|
}
|
|
25773
25895
|
}
|
|
25774
25896
|
|
|
@@ -26893,9 +27015,9 @@ class BrowserUiFacade {
|
|
|
26893
27015
|
this.registerFontChecker(settings.display.resources.subTitleFont);
|
|
26894
27016
|
}
|
|
26895
27017
|
registerFontChecker(font) {
|
|
26896
|
-
if (!this._fontCheckers.has(font.
|
|
26897
|
-
let checker = new FontLoadingChecker(font.
|
|
26898
|
-
this._fontCheckers.set(font.
|
|
27018
|
+
if (!this._fontCheckers.has(font.families.join(', '))) {
|
|
27019
|
+
let checker = new FontLoadingChecker(font.families);
|
|
27020
|
+
this._fontCheckers.set(font.families.join(', '), checker);
|
|
26899
27021
|
checker.fontLoaded.on(this.onFontLoaded.bind(this));
|
|
26900
27022
|
checker.checkForFontAvailability();
|
|
26901
27023
|
}
|
|
@@ -27870,7 +27992,7 @@ class SvgCanvas {
|
|
|
27870
27992
|
if (!text) {
|
|
27871
27993
|
return 0;
|
|
27872
27994
|
}
|
|
27873
|
-
return FontSizes.measureString(text, this.font.
|
|
27995
|
+
return FontSizes.measureString(text, this.font.families, this.font.size, this.font.style, this.font.weight);
|
|
27874
27996
|
}
|
|
27875
27997
|
onRenderFinished() {
|
|
27876
27998
|
// nothing to do
|
|
@@ -31362,7 +31484,7 @@ class TripletFeelGlyph extends EffectGlyph {
|
|
|
31362
31484
|
renderTriplet(cx, cy, canvas) {
|
|
31363
31485
|
cy += 2 * this.scale;
|
|
31364
31486
|
let font = this.renderer.resources.effectFont;
|
|
31365
|
-
canvas.font =
|
|
31487
|
+
canvas.font = Font.withFamilyList(font.families, font.size * 0.8, font.style);
|
|
31366
31488
|
let rightX = cx + TripletFeelGlyph.NoteSeparation * this.scale + 3 * this.scale;
|
|
31367
31489
|
canvas.beginPath();
|
|
31368
31490
|
canvas.moveTo(cx, cy + 3 * this.scale);
|
|
@@ -32875,7 +32997,7 @@ class ScoreLayout {
|
|
|
32875
32997
|
let size = 12 * this.renderer.settings.display.scale;
|
|
32876
32998
|
let height = Math.floor(size * 2);
|
|
32877
32999
|
const e = new RenderFinishedEventArgs();
|
|
32878
|
-
const font =
|
|
33000
|
+
const font = Font.withFamilyList(resources.copyrightFont.families, size, FontStyle.Plain, FontWeight.Bold);
|
|
32879
33001
|
this.renderer.canvas.font = font;
|
|
32880
33002
|
const centered = Environment.getLayoutEngineFactory(this.renderer.settings.display.layoutMode).vertical;
|
|
32881
33003
|
e.width = this.renderer.canvas.measureText(msg);
|
|
@@ -38386,8 +38508,8 @@ class TabBrushGlyph extends Glyph {
|
|
|
38386
38508
|
}
|
|
38387
38509
|
paint(cx, cy, canvas) {
|
|
38388
38510
|
let tabBarRenderer = this.renderer;
|
|
38389
|
-
let startY = cy + this.x + (tabBarRenderer.getNoteY(this._beat.
|
|
38390
|
-
let endY = cy + this.y + tabBarRenderer.getNoteY(this._beat.
|
|
38511
|
+
let startY = cy + this.x + (tabBarRenderer.getNoteY(this._beat.maxStringNote, NoteYPosition.Top));
|
|
38512
|
+
let endY = cy + this.y + tabBarRenderer.getNoteY(this._beat.minStringNote, NoteYPosition.Bottom);
|
|
38391
38513
|
let arrowX = (cx + this.x + this.width / 2) | 0;
|
|
38392
38514
|
let arrowSize = 8 * this.scale;
|
|
38393
38515
|
if (this._beat.brushType !== BrushType.None) {
|
|
@@ -40759,6 +40881,11 @@ class Environment {
|
|
|
40759
40881
|
Document.prototype.replaceChildren = Element.prototype.replaceChildren;
|
|
40760
40882
|
DocumentFragment.prototype.replaceChildren = Element.prototype.replaceChildren;
|
|
40761
40883
|
}
|
|
40884
|
+
if (!('replaceAll' in String.prototype)) {
|
|
40885
|
+
String.prototype.replaceAll = function (str, newStr) {
|
|
40886
|
+
return this.replace(new RegExp(str, 'g'), newStr);
|
|
40887
|
+
};
|
|
40888
|
+
}
|
|
40762
40889
|
}
|
|
40763
40890
|
}
|
|
40764
40891
|
/**
|
|
@@ -40833,7 +40960,7 @@ Environment.scriptFile = Environment.detectScriptFile();
|
|
|
40833
40960
|
/**
|
|
40834
40961
|
* @target web
|
|
40835
40962
|
*/
|
|
40836
|
-
Environment.bravuraFontChecker = new FontLoadingChecker('alphaTab');
|
|
40963
|
+
Environment.bravuraFontChecker = new FontLoadingChecker(['alphaTab']);
|
|
40837
40964
|
Environment.renderEngines = Environment.createDefaultRenderEngines();
|
|
40838
40965
|
Environment.layoutEngines = Environment.createDefaultLayoutEngines();
|
|
40839
40966
|
Environment.staveProfiles = Environment.createDefaultStaveProfiles();
|
|
@@ -40978,8 +41105,8 @@ class CoreSettings {
|
|
|
40978
41105
|
// </auto-generated>
|
|
40979
41106
|
class VersionInfo {
|
|
40980
41107
|
}
|
|
40981
|
-
VersionInfo.version = '1.3.0-alpha.
|
|
40982
|
-
VersionInfo.date = '2022-08-
|
|
41108
|
+
VersionInfo.version = '1.3.0-alpha.374';
|
|
41109
|
+
VersionInfo.date = '2022-08-28T00:56:29.356Z';
|
|
40983
41110
|
|
|
40984
41111
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
40985
41112
|
__proto__: null,
|
|
@@ -44043,13 +44170,18 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
44043
44170
|
var index = /*#__PURE__*/Object.freeze({
|
|
44044
44171
|
__proto__: null,
|
|
44045
44172
|
AlphaSynth: AlphaSynth,
|
|
44173
|
+
CircularSampleBuffer: CircularSampleBuffer,
|
|
44046
44174
|
PlaybackRange: PlaybackRange,
|
|
44047
44175
|
get PlayerState () { return PlayerState; },
|
|
44048
44176
|
PlayerStateChangedEventArgs: PlayerStateChangedEventArgs,
|
|
44049
44177
|
PlaybackRangeChangedEventArgs: PlaybackRangeChangedEventArgs,
|
|
44050
44178
|
PositionChangedEventArgs: PositionChangedEventArgs,
|
|
44179
|
+
MidiEventsPlayedEventArgs: MidiEventsPlayedEventArgs,
|
|
44051
44180
|
ActiveBeatsChangedEventArgs: ActiveBeatsChangedEventArgs,
|
|
44052
|
-
AlphaSynthWebWorkerApi: AlphaSynthWebWorkerApi
|
|
44181
|
+
AlphaSynthWebWorkerApi: AlphaSynthWebWorkerApi,
|
|
44182
|
+
AlphaSynthWebAudioOutputBase: AlphaSynthWebAudioOutputBase,
|
|
44183
|
+
AlphaSynthScriptProcessorOutput: AlphaSynthScriptProcessorOutput,
|
|
44184
|
+
AlphaSynthAudioWorkletOutput: AlphaSynthAudioWorkletOutput
|
|
44053
44185
|
});
|
|
44054
44186
|
|
|
44055
44187
|
export { AlphaTabApi, AlphaTabError, AlphaTabErrorType, CoreSettings, DisplaySettings, FileLoadError, FingeringMode, FormatError, ImporterSettings, LayoutMode, LogLevel, Logger, NotationMode, NotationSettings, PlayerSettings, ProgressEventArgs, RenderingResources, ResizeEventArgs, ScrollMode, Settings, StaveProfile, TabRhythmMode, VibratoPlaybackSettings, index$4 as exporter, index$5 as importer, VersionInfo as meta, index$3 as midi, index$2 as model, index$1 as rendering, index as synth };
|