@tspro/web-music-score 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/audio/index.d.mts +40 -1
- package/dist/audio/index.d.ts +40 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +2 -2
- package/dist/audio-cg/index.d.mts +3 -0
- package/dist/audio-cg/index.d.ts +3 -0
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +2 -2
- package/dist/{chunk-D643HZHM.mjs → chunk-YFPLOHP2.mjs} +2 -2
- package/dist/core/index.d.mts +12 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +3 -2
- package/dist/core/index.mjs +4 -3
- package/dist/guitar-CaZJDA05.d.ts +35 -0
- package/dist/guitar-DdexKdN6.d.mts +35 -0
- package/dist/iife/index.global.js +11 -11
- package/dist/{interface-XoKiryoV.d.mts → music-objects-DJQ4d2OA.d.mts} +549 -53
- package/dist/{interface-7k8qGG44.d.ts → music-objects-Dc3kR-XF.d.ts} +549 -53
- package/dist/note-eA2xPPiG.d.mts +294 -0
- package/dist/note-eA2xPPiG.d.ts +294 -0
- package/dist/pieces/index.d.mts +22 -3
- package/dist/pieces/index.d.ts +22 -3
- package/dist/pieces/index.js +5 -2
- package/dist/pieces/index.mjs +6 -3
- package/dist/react-ui/index.d.mts +166 -17
- package/dist/react-ui/index.d.ts +166 -17
- package/dist/react-ui/index.js +78 -1
- package/dist/react-ui/index.mjs +79 -2
- package/dist/scale-B2Icbetz.d.ts +230 -0
- package/dist/scale-BbDJTbrG.d.mts +230 -0
- package/dist/score/index.d.mts +299 -46
- package/dist/score/index.d.ts +299 -46
- package/dist/score/index.js +553 -76
- package/dist/score/index.mjs +550 -75
- package/dist/{tempo-BAYoZ_Li.d.mts → tempo-CtUhvJbr.d.mts} +187 -5
- package/dist/{tempo-r2sb6Ku2.d.ts → tempo-Dt8aHpol.d.ts} +187 -5
- package/dist/theory/index.d.mts +29 -13
- package/dist/theory/index.d.ts +29 -13
- package/dist/theory/index.js +369 -25
- package/dist/theory/index.mjs +370 -26
- package/package.json +1 -1
- package/dist/guitar-DggbM2UL.d.mts +0 -17
- package/dist/guitar-cNmE-EvH.d.ts +0 -17
- package/dist/note-BFa43I86.d.mts +0 -85
- package/dist/note-CcVdUFqS.d.ts +0 -85
- package/dist/scale-C2pCNxdE.d.mts +0 -75
- package/dist/scale-CvPbJvfN.d.ts +0 -75
package/dist/score/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore v4.0.
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YFPLOHP2.mjs";
|
|
5
5
|
|
|
6
6
|
// src/score/pub/div-rect.ts
|
|
7
7
|
import { Utils } from "@tspro/ts-utils-lib";
|
|
@@ -361,6 +361,27 @@ var Annotation = /* @__PURE__ */ ((Annotation2) => {
|
|
|
361
361
|
Annotation2["Tempo"] = "tempo";
|
|
362
362
|
return Annotation2;
|
|
363
363
|
})(Annotation || {});
|
|
364
|
+
var DynamicsAnnotation = /* @__PURE__ */ ((DynamicsAnnotation2) => {
|
|
365
|
+
DynamicsAnnotation2["cresc"] = "cresc.";
|
|
366
|
+
DynamicsAnnotation2["decresc"] = "decresc.";
|
|
367
|
+
DynamicsAnnotation2["dim"] = "dim.";
|
|
368
|
+
DynamicsAnnotation2["ppp"] = "ppp";
|
|
369
|
+
DynamicsAnnotation2["pp"] = "pp";
|
|
370
|
+
DynamicsAnnotation2["p"] = "p";
|
|
371
|
+
DynamicsAnnotation2["mp"] = "mp";
|
|
372
|
+
DynamicsAnnotation2["m"] = "m";
|
|
373
|
+
DynamicsAnnotation2["mf"] = "mf";
|
|
374
|
+
DynamicsAnnotation2["f"] = "f";
|
|
375
|
+
DynamicsAnnotation2["ff"] = "ff";
|
|
376
|
+
DynamicsAnnotation2["fff"] = "fff";
|
|
377
|
+
return DynamicsAnnotation2;
|
|
378
|
+
})(DynamicsAnnotation || {});
|
|
379
|
+
var TempoAnnotation = /* @__PURE__ */ ((TempoAnnotation2) => {
|
|
380
|
+
TempoAnnotation2["accel"] = "accel.";
|
|
381
|
+
TempoAnnotation2["rit"] = "rit.";
|
|
382
|
+
TempoAnnotation2["a_tempo"] = "a tempo";
|
|
383
|
+
return TempoAnnotation2;
|
|
384
|
+
})(TempoAnnotation || {});
|
|
364
385
|
var Label = /* @__PURE__ */ ((Label2) => {
|
|
365
386
|
Label2["Note"] = "note";
|
|
366
387
|
Label2["Chord"] = "chord";
|
|
@@ -3324,6 +3345,9 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
3324
3345
|
}
|
|
3325
3346
|
};
|
|
3326
3347
|
|
|
3348
|
+
// src/score/engine/extension.ts
|
|
3349
|
+
import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
|
|
3350
|
+
|
|
3327
3351
|
// src/score/engine/element-data.ts
|
|
3328
3352
|
import { Utils as Utils5 } from "@tspro/ts-utils-lib";
|
|
3329
3353
|
|
|
@@ -3446,29 +3470,8 @@ function getNavigationString(navigation) {
|
|
|
3446
3470
|
return navigation[0].toUpperCase() + navigation.substring(1);
|
|
3447
3471
|
}
|
|
3448
3472
|
}
|
|
3449
|
-
var DynamicsAnnotations = /* @__PURE__ */ ((DynamicsAnnotations2) => {
|
|
3450
|
-
DynamicsAnnotations2["cresc"] = "cresc.";
|
|
3451
|
-
DynamicsAnnotations2["decresc"] = "decresc.";
|
|
3452
|
-
DynamicsAnnotations2["dim"] = "dim.";
|
|
3453
|
-
DynamicsAnnotations2["ppp"] = "ppp";
|
|
3454
|
-
DynamicsAnnotations2["pp"] = "pp";
|
|
3455
|
-
DynamicsAnnotations2["p"] = "p";
|
|
3456
|
-
DynamicsAnnotations2["mp"] = "mp";
|
|
3457
|
-
DynamicsAnnotations2["m"] = "m";
|
|
3458
|
-
DynamicsAnnotations2["mf"] = "mf";
|
|
3459
|
-
DynamicsAnnotations2["f"] = "f";
|
|
3460
|
-
DynamicsAnnotations2["ff"] = "ff";
|
|
3461
|
-
DynamicsAnnotations2["fff"] = "fff";
|
|
3462
|
-
return DynamicsAnnotations2;
|
|
3463
|
-
})(DynamicsAnnotations || {});
|
|
3464
|
-
var TempoAnnotations = /* @__PURE__ */ ((TempoAnnotations2) => {
|
|
3465
|
-
TempoAnnotations2["accel"] = "accel.";
|
|
3466
|
-
TempoAnnotations2["rit"] = "rit.";
|
|
3467
|
-
TempoAnnotations2["a_tempo"] = "a tempo";
|
|
3468
|
-
return TempoAnnotations2;
|
|
3469
|
-
})(TempoAnnotations || {});
|
|
3470
3473
|
function isDynamicsText(text) {
|
|
3471
|
-
return Utils5.Is.isEnumValue(text,
|
|
3474
|
+
return Utils5.Is.isEnumValue(text, DynamicsAnnotation);
|
|
3472
3475
|
}
|
|
3473
3476
|
function getDynamicsVolume(text) {
|
|
3474
3477
|
if (/^(p+|f+|m|mp|mf)$/.test(text)) {
|
|
@@ -3479,12 +3482,12 @@ function getDynamicsVolume(text) {
|
|
|
3479
3482
|
}
|
|
3480
3483
|
}
|
|
3481
3484
|
function isTempoText(text) {
|
|
3482
|
-
return Utils5.Is.isEnumValue(text,
|
|
3485
|
+
return Utils5.Is.isEnumValue(text, TempoAnnotation);
|
|
3483
3486
|
}
|
|
3484
3487
|
function getAnnotation(text) {
|
|
3485
|
-
if (Utils5.Is.isEnumValue(text,
|
|
3488
|
+
if (Utils5.Is.isEnumValue(text, DynamicsAnnotation)) {
|
|
3486
3489
|
return "dynamics" /* Dynamics */;
|
|
3487
|
-
} else if (Utils5.Is.isEnumValue(text,
|
|
3490
|
+
} else if (Utils5.Is.isEnumValue(text, TempoAnnotation)) {
|
|
3488
3491
|
return "tempo" /* Tempo */;
|
|
3489
3492
|
} else {
|
|
3490
3493
|
return void 0;
|
|
@@ -3492,7 +3495,6 @@ function getAnnotation(text) {
|
|
|
3492
3495
|
}
|
|
3493
3496
|
|
|
3494
3497
|
// src/score/engine/extension.ts
|
|
3495
|
-
import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
|
|
3496
3498
|
function getTextAnchorY(linePos) {
|
|
3497
3499
|
switch (linePos) {
|
|
3498
3500
|
case "bottom":
|
|
@@ -7035,6 +7037,9 @@ function isTupletRatio(tupletRatio) {
|
|
|
7035
7037
|
}
|
|
7036
7038
|
}
|
|
7037
7039
|
var DocumentBuilder = class {
|
|
7040
|
+
/**
|
|
7041
|
+
* Create new document builder instance.
|
|
7042
|
+
*/
|
|
7038
7043
|
constructor() {
|
|
7039
7044
|
__publicField(this, "doc");
|
|
7040
7045
|
this.doc = new ObjDocument();
|
|
@@ -7068,9 +7073,20 @@ var DocumentBuilder = class {
|
|
|
7068
7073
|
var _a;
|
|
7069
7074
|
return (_a = this.doc.getLastMeasure()) != null ? _a : this.doc.addMeasure();
|
|
7070
7075
|
}
|
|
7076
|
+
/**
|
|
7077
|
+
* Get music document after finished building.
|
|
7078
|
+
* @returns - Music document.
|
|
7079
|
+
*/
|
|
7071
7080
|
getDocument() {
|
|
7072
7081
|
return this.doc.getMusicInterface();
|
|
7073
7082
|
}
|
|
7083
|
+
/**
|
|
7084
|
+
* Set header texts.
|
|
7085
|
+
* @param title - Title of this docmument/musical piece.
|
|
7086
|
+
* @param composer - Composer of this document/musical piece.
|
|
7087
|
+
* @param arranger - Arranger of this document/musical piece.
|
|
7088
|
+
* @returns - This document builder instance.
|
|
7089
|
+
*/
|
|
7074
7090
|
setHeader(title, composer, arranger) {
|
|
7075
7091
|
assertArg(Utils13.Is.isStringOrUndefined(title), "title", title);
|
|
7076
7092
|
assertArg(Utils13.Is.isStringOrUndefined(composer), "composer", composer);
|
|
@@ -7078,11 +7094,20 @@ var DocumentBuilder = class {
|
|
|
7078
7094
|
this.doc.setHeader(title, composer, arranger);
|
|
7079
7095
|
return this;
|
|
7080
7096
|
}
|
|
7097
|
+
/**
|
|
7098
|
+
* Automatically limit number of measures per score row.
|
|
7099
|
+
* @param measuresPerRow - Number of measures per row. Must be integer >=1 or Infinity.
|
|
7100
|
+
* @returns - This document builder instance.
|
|
7101
|
+
*/
|
|
7081
7102
|
setMeasuresPerRow(measuresPerRow) {
|
|
7082
7103
|
assertArg(Utils13.Is.isIntegerGte(measuresPerRow, 1) || Utils13.Is.isPosInfinity(measuresPerRow), "measuresPerRow", measuresPerRow);
|
|
7083
7104
|
this.doc.setMeasuresPerRow(measuresPerRow);
|
|
7084
7105
|
return this;
|
|
7085
7106
|
}
|
|
7107
|
+
/**
|
|
7108
|
+
* Add new measure.
|
|
7109
|
+
* @returns - This document builder instance.
|
|
7110
|
+
*/
|
|
7086
7111
|
addMeasure() {
|
|
7087
7112
|
this.doc.addMeasure();
|
|
7088
7113
|
return this;
|
|
@@ -7092,6 +7117,11 @@ var DocumentBuilder = class {
|
|
|
7092
7117
|
this.getMeasure().setKeySignature(...args);
|
|
7093
7118
|
return this;
|
|
7094
7119
|
}
|
|
7120
|
+
/**
|
|
7121
|
+
* Set time signature for current measure and forward.
|
|
7122
|
+
* @param timeSignature - TimeSignature object instance or string (e.g. "3/4").
|
|
7123
|
+
* @returns - This document builder instance.
|
|
7124
|
+
*/
|
|
7095
7125
|
setTimeSignature(timeSignature) {
|
|
7096
7126
|
assertArg(timeSignature instanceof TimeSignature2 || Utils13.Is.isNonEmptyString(timeSignature), "timeSignature", timeSignature);
|
|
7097
7127
|
this.getMeasure().setTimeSignature(timeSignature);
|
|
@@ -7108,6 +7138,14 @@ var DocumentBuilder = class {
|
|
|
7108
7138
|
this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
|
|
7109
7139
|
return this;
|
|
7110
7140
|
}
|
|
7141
|
+
/**
|
|
7142
|
+
* Add note o current measure.
|
|
7143
|
+
* @param voiceId - Voice id to add note to.
|
|
7144
|
+
* @param note - Note instance of Note or string (e.g. "D4").
|
|
7145
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
7146
|
+
* @param options - Note options.
|
|
7147
|
+
* @returns - This document builder instance.
|
|
7148
|
+
*/
|
|
7111
7149
|
addNote(voiceId, note, noteLength, options) {
|
|
7112
7150
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7113
7151
|
assertArg(note instanceof Note10 || Utils13.Is.isNonEmptyString(note), "note", note);
|
|
@@ -7118,6 +7156,13 @@ var DocumentBuilder = class {
|
|
|
7118
7156
|
this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options);
|
|
7119
7157
|
return this;
|
|
7120
7158
|
}
|
|
7159
|
+
/**
|
|
7160
|
+
* @param voiceId - Voice id to add chord to.
|
|
7161
|
+
* @param notes - Array of notes, each instance of Note or string (e.g. "D4").
|
|
7162
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
7163
|
+
* @param options - Note options.
|
|
7164
|
+
* @returns - This document builder instance.
|
|
7165
|
+
*/
|
|
7121
7166
|
addChord(voiceId, notes, noteLength, options) {
|
|
7122
7167
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7123
7168
|
assertArg(Utils13.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils13.Is.isNonEmptyString(note)), "notes", notes);
|
|
@@ -7128,6 +7173,13 @@ var DocumentBuilder = class {
|
|
|
7128
7173
|
this.getMeasure().addNoteGroup(voiceId, notes, noteLength, options);
|
|
7129
7174
|
return this;
|
|
7130
7175
|
}
|
|
7176
|
+
/**
|
|
7177
|
+
*
|
|
7178
|
+
* @param voiceId - Voice id to add rest to.
|
|
7179
|
+
* @param restLength - Rest length (e.g. "4n").
|
|
7180
|
+
* @param options - Rest options.
|
|
7181
|
+
* @returns - This document builder instance.
|
|
7182
|
+
*/
|
|
7131
7183
|
addRest(voiceId, restLength, options) {
|
|
7132
7184
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7133
7185
|
assertArg(Utils13.Is.isEnumValue(restLength, NoteLength7) || isNoteLength(restLength), "restLength", restLength);
|
|
@@ -7147,10 +7199,10 @@ var DocumentBuilder = class {
|
|
|
7147
7199
|
* });
|
|
7148
7200
|
* </pre>
|
|
7149
7201
|
*
|
|
7150
|
-
* @param voiceId
|
|
7202
|
+
* @param voiceId - Voice id to add tuplet to.
|
|
7151
7203
|
* @param tupletRatio - You can also use Theory.Tuplet presets (e.g. Theory.Tuplet.Triplet).
|
|
7152
|
-
* @param tupletBuilder
|
|
7153
|
-
* @returns
|
|
7204
|
+
* @param tupletBuilder - Tuplet builder function to build tuplet.
|
|
7205
|
+
* @returns - This document builder instance.
|
|
7154
7206
|
*/
|
|
7155
7207
|
addTuplet(voiceId, tupletRatio, tupletBuilder) {
|
|
7156
7208
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
@@ -7201,10 +7253,20 @@ var DocumentBuilder = class {
|
|
|
7201
7253
|
this.getMeasure().addFermata(staffTabOrGroups, fermata);
|
|
7202
7254
|
return this;
|
|
7203
7255
|
}
|
|
7256
|
+
/**
|
|
7257
|
+
* Add fermata to current measure.
|
|
7258
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
7259
|
+
* @returns - This document builder instance.
|
|
7260
|
+
*/
|
|
7204
7261
|
addFermata(fermata = "atNote" /* AtNote */) {
|
|
7205
7262
|
return this.addFermataInternal(void 0, fermata);
|
|
7206
7263
|
}
|
|
7207
|
-
/**
|
|
7264
|
+
/**
|
|
7265
|
+
* Add Fermata to current measure to given staff/tab/group.
|
|
7266
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
7267
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
7268
|
+
* @returns - This document builder instance.
|
|
7269
|
+
*/
|
|
7208
7270
|
addFermataTo(staffTabOrGroups, fermata = "atNote" /* AtNote */) {
|
|
7209
7271
|
return this.addFermataInternal(staffTabOrGroups, fermata);
|
|
7210
7272
|
}
|
|
@@ -7257,10 +7319,22 @@ var DocumentBuilder = class {
|
|
|
7257
7319
|
this.getMeasure().addLabel(staffTabOrGroups, label, text);
|
|
7258
7320
|
return this;
|
|
7259
7321
|
}
|
|
7322
|
+
/**
|
|
7323
|
+
* Add label text to column of last added note/chord/rest in current measure.
|
|
7324
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
7325
|
+
* @param text - label text (e.g. "Am").
|
|
7326
|
+
* @returns - This document builder instance.
|
|
7327
|
+
*/
|
|
7260
7328
|
addLabel(label, text) {
|
|
7261
7329
|
return this.addLabelInternal(void 0, label, text);
|
|
7262
7330
|
}
|
|
7263
|
-
/**
|
|
7331
|
+
/**
|
|
7332
|
+
* Add label text to column of last added note/chord/rest in current measure to given staff/tab/group.
|
|
7333
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
7334
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
7335
|
+
* @param text - label text (e.g. "Am").
|
|
7336
|
+
* @returns - This document builder instance.
|
|
7337
|
+
*/
|
|
7264
7338
|
addLabelTo(staffTabOrGroups, label, text) {
|
|
7265
7339
|
return this.addLabelInternal(staffTabOrGroups, label, text);
|
|
7266
7340
|
}
|
|
@@ -7286,16 +7360,16 @@ var DocumentBuilder = class {
|
|
|
7286
7360
|
return this;
|
|
7287
7361
|
}
|
|
7288
7362
|
/**
|
|
7289
|
-
*
|
|
7363
|
+
* Add extension line to previously added annotation or label element.
|
|
7290
7364
|
* <pre>
|
|
7365
|
+
* // Example
|
|
7291
7366
|
* addExtension(ext => ext.notes("1n", 2)) // length is 2 whole notes
|
|
7292
7367
|
* addExtension(ext => ext.measures(3).hide()) // length is 3 measures, hidden
|
|
7293
7368
|
* addExtension(ext => ext.measures(1).notes("8n")) // length is 1 measure + 1 eigth note
|
|
7294
7369
|
* addExtension(ext => ext.infinity()) // length is as long as possible
|
|
7295
7370
|
* </pre>
|
|
7296
|
-
* @param
|
|
7297
|
-
* @
|
|
7298
|
-
* @returns
|
|
7371
|
+
* @param extensionBuilder - Extension builder function used to build exstension.
|
|
7372
|
+
* @returns - This document builder instance.
|
|
7299
7373
|
*/
|
|
7300
7374
|
addExtension(extensionBuilder) {
|
|
7301
7375
|
assertArg(Utils13.Is.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, for e.g. addExtension(ext => ext.measures(2)). Please refer to README or API Reference.", extensionBuilder);
|
|
@@ -7331,11 +7405,11 @@ var DocumentBuilder = class {
|
|
|
7331
7405
|
return this;
|
|
7332
7406
|
}
|
|
7333
7407
|
/**
|
|
7334
|
-
*
|
|
7408
|
+
* Add staff group.
|
|
7335
7409
|
* @param groupName - Name of staff group.
|
|
7336
7410
|
* @param staffsTabsAndGroups - staff/tab index (0=top), staff/tab name, or staff group name. Single value or array.
|
|
7337
7411
|
* @param verticalPosition - Vertical position, are elements added above, below or both.
|
|
7338
|
-
* @returns
|
|
7412
|
+
* @returns - This document builder instance.
|
|
7339
7413
|
*/
|
|
7340
7414
|
addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
|
|
7341
7415
|
assertArg(Utils13.Is.isNonEmptyString(groupName), "groupName", groupName);
|
|
@@ -7348,24 +7422,48 @@ var DocumentBuilder = class {
|
|
|
7348
7422
|
this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
|
|
7349
7423
|
return this;
|
|
7350
7424
|
}
|
|
7425
|
+
/**
|
|
7426
|
+
* Add song end. Adds certain bar line at the end of measure.
|
|
7427
|
+
* @returns - This document builder instance.
|
|
7428
|
+
*/
|
|
7351
7429
|
endSong() {
|
|
7352
7430
|
this.getMeasure().endSong();
|
|
7353
7431
|
return this;
|
|
7354
7432
|
}
|
|
7433
|
+
/**
|
|
7434
|
+
* Add section end. Adds certain bar line at the end of measure.
|
|
7435
|
+
* @returns - This document builder instance.
|
|
7436
|
+
*/
|
|
7355
7437
|
endSection() {
|
|
7356
7438
|
this.getMeasure().endSection();
|
|
7357
7439
|
return this;
|
|
7358
7440
|
}
|
|
7441
|
+
/**
|
|
7442
|
+
* End current score row. Next measure will start new row.
|
|
7443
|
+
* @returns - This document builder instance.
|
|
7444
|
+
*/
|
|
7359
7445
|
endRow() {
|
|
7360
7446
|
var _a;
|
|
7361
7447
|
(_a = this.doc.getLastMeasure()) == null ? void 0 : _a.endRow();
|
|
7362
7448
|
return this;
|
|
7363
7449
|
}
|
|
7450
|
+
/**
|
|
7451
|
+
* Add rests to fill current measure.
|
|
7452
|
+
* @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
|
|
7453
|
+
* @returns - This document builder instance.
|
|
7454
|
+
*/
|
|
7364
7455
|
completeRests(voiceId) {
|
|
7365
7456
|
assertArg(Utils13.Is.isUndefined(voiceId) || isVoiceId(voiceId) || Utils13.Is.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)), "voiceId", voiceId);
|
|
7366
7457
|
this.getMeasure().completeRests(voiceId);
|
|
7367
7458
|
return this;
|
|
7368
7459
|
}
|
|
7460
|
+
/**
|
|
7461
|
+
* Add notes of given scale in ascending order.
|
|
7462
|
+
* @param scale - Scale.
|
|
7463
|
+
* @param bottomNote - Scale starts from note >= bottom note.
|
|
7464
|
+
* @param numOctaves - Number of octaves to add.
|
|
7465
|
+
* @returns - This document builder instance.
|
|
7466
|
+
*/
|
|
7369
7467
|
addScaleArpeggio(scale, bottomNote, numOctaves) {
|
|
7370
7468
|
assertArg(Utils13.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
|
|
7371
7469
|
assertArg(Utils13.Is.isIntegerGte(numOctaves, 1), "numOctaves", numOctaves);
|
|
@@ -7386,11 +7484,22 @@ var DocumentBuilder = class {
|
|
|
7386
7484
|
// src/score/pub/event.ts
|
|
7387
7485
|
import { MusicError as MusicError18, MusicErrorType as MusicErrorType18 } from "@tspro/web-music-score/core";
|
|
7388
7486
|
var ScoreEvent = class {
|
|
7487
|
+
/**
|
|
7488
|
+
* Create new score event instance.
|
|
7489
|
+
* @param type - Score event type.
|
|
7490
|
+
*/
|
|
7389
7491
|
constructor(type) {
|
|
7390
7492
|
this.type = type;
|
|
7391
7493
|
}
|
|
7392
7494
|
};
|
|
7393
7495
|
var ScoreStaffPosEvent = class extends ScoreEvent {
|
|
7496
|
+
/**
|
|
7497
|
+
* Create new score staff position event.
|
|
7498
|
+
* @param type - Score event type.
|
|
7499
|
+
* @param renderer - Renderer.
|
|
7500
|
+
* @param scoreRow - Score row.
|
|
7501
|
+
* @param diatonicId - Diatonic id that was clicked/entered/left.
|
|
7502
|
+
*/
|
|
7394
7503
|
constructor(type, renderer, scoreRow, diatonicId) {
|
|
7395
7504
|
super(type);
|
|
7396
7505
|
this.renderer = renderer;
|
|
@@ -7399,6 +7508,12 @@ var ScoreStaffPosEvent = class extends ScoreEvent {
|
|
|
7399
7508
|
}
|
|
7400
7509
|
};
|
|
7401
7510
|
var ScoreObjectEvent = class extends ScoreEvent {
|
|
7511
|
+
/**
|
|
7512
|
+
* Create new score object event.
|
|
7513
|
+
* @param type - Score event type.
|
|
7514
|
+
* @param renderer - Renderer.
|
|
7515
|
+
* @param objects - Array of objects, last object in this array is the top object that was clicked/entered/left, previous objects are it's parent objects.
|
|
7516
|
+
*/
|
|
7402
7517
|
constructor(type, renderer, objects) {
|
|
7403
7518
|
super(type);
|
|
7404
7519
|
this.renderer = renderer;
|
|
@@ -7407,16 +7522,25 @@ var ScoreObjectEvent = class extends ScoreEvent {
|
|
|
7407
7522
|
throw new MusicError18(MusicErrorType18.Score, "Empty array in score object event!");
|
|
7408
7523
|
}
|
|
7409
7524
|
}
|
|
7525
|
+
/** Top object getter. */
|
|
7410
7526
|
get topObject() {
|
|
7411
7527
|
return this.objects[this.objects.length - 1];
|
|
7412
7528
|
}
|
|
7529
|
+
/**
|
|
7530
|
+
* Find object.
|
|
7531
|
+
* @param fn - Compare function.
|
|
7532
|
+
* @returns - First object that matched compare function, or undefined if no match.
|
|
7533
|
+
*/
|
|
7413
7534
|
findObject(fn) {
|
|
7414
7535
|
return this.objects.find((obj) => fn(obj));
|
|
7415
7536
|
}
|
|
7416
7537
|
};
|
|
7417
7538
|
|
|
7418
|
-
// src/score/pub/interface.ts
|
|
7539
|
+
// src/score/pub/music-interface.ts
|
|
7419
7540
|
import * as Audio2 from "@tspro/web-music-score/audio";
|
|
7541
|
+
import { Utils as Utils15 } from "@tspro/ts-utils-lib";
|
|
7542
|
+
|
|
7543
|
+
// src/score/pub/music-objects.ts
|
|
7420
7544
|
import { Utils as Utils14 } from "@tspro/ts-utils-lib";
|
|
7421
7545
|
import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
|
|
7422
7546
|
function assertArg2(condition, argName, argValue) {
|
|
@@ -7424,13 +7548,6 @@ function assertArg2(condition, argName, argValue) {
|
|
|
7424
7548
|
throw new MusicError19(MusicErrorType19.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
7425
7549
|
}
|
|
7426
7550
|
}
|
|
7427
|
-
function require_t(t, message) {
|
|
7428
|
-
if (t === void 0 || t === null) {
|
|
7429
|
-
throw new TypeError(message);
|
|
7430
|
-
} else {
|
|
7431
|
-
return t;
|
|
7432
|
-
}
|
|
7433
|
-
}
|
|
7434
7551
|
function isVoiceId2(value) {
|
|
7435
7552
|
return Utils14.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
|
|
7436
7553
|
}
|
|
@@ -7442,9 +7559,17 @@ function getNotationLine(line) {
|
|
|
7442
7559
|
}
|
|
7443
7560
|
}
|
|
7444
7561
|
var MusicInterface6 = class {
|
|
7562
|
+
/**
|
|
7563
|
+
* Create new music interface object.
|
|
7564
|
+
* @param name - OBject name.
|
|
7565
|
+
*/
|
|
7445
7566
|
constructor(name) {
|
|
7446
7567
|
this.name = name;
|
|
7447
7568
|
}
|
|
7569
|
+
/**
|
|
7570
|
+
* Get parent object.
|
|
7571
|
+
* @returns - Parent object or undefined.
|
|
7572
|
+
*/
|
|
7448
7573
|
getParent() {
|
|
7449
7574
|
var _a;
|
|
7450
7575
|
return (_a = this.getMusicObject().getParent()) == null ? void 0 : _a.getMusicInterface();
|
|
@@ -7460,10 +7585,15 @@ var _MAccidental = class _MAccidental extends MusicInterface6 {
|
|
|
7460
7585
|
getMusicObject() {
|
|
7461
7586
|
return this.obj;
|
|
7462
7587
|
}
|
|
7588
|
+
/**
|
|
7589
|
+
* Get accidental.
|
|
7590
|
+
* @returns - Accidental (e.g. 1 = #).
|
|
7591
|
+
*/
|
|
7463
7592
|
getAccidental() {
|
|
7464
7593
|
return this.obj.accidental;
|
|
7465
7594
|
}
|
|
7466
7595
|
};
|
|
7596
|
+
/** Object name. */
|
|
7467
7597
|
__publicField(_MAccidental, "Name", "Accidental");
|
|
7468
7598
|
var MAccidental = _MAccidental;
|
|
7469
7599
|
var _MConnective = class _MConnective extends MusicInterface6 {
|
|
@@ -7477,6 +7607,7 @@ var _MConnective = class _MConnective extends MusicInterface6 {
|
|
|
7477
7607
|
return this.obj;
|
|
7478
7608
|
}
|
|
7479
7609
|
};
|
|
7610
|
+
/** Object name. */
|
|
7480
7611
|
__publicField(_MConnective, "Name", "Connective");
|
|
7481
7612
|
var MConnective = _MConnective;
|
|
7482
7613
|
var _MArpeggio = class _MArpeggio extends MusicInterface6 {
|
|
@@ -7489,13 +7620,22 @@ var _MArpeggio = class _MArpeggio extends MusicInterface6 {
|
|
|
7489
7620
|
getMusicObject() {
|
|
7490
7621
|
return this.obj;
|
|
7491
7622
|
}
|
|
7623
|
+
/**
|
|
7624
|
+
* Get rhythm column this arpeggio is in.
|
|
7625
|
+
* @returns - Rhythm column.
|
|
7626
|
+
*/
|
|
7492
7627
|
getRhythmColumn() {
|
|
7493
7628
|
return this.obj.col.getMusicInterface();
|
|
7494
7629
|
}
|
|
7630
|
+
/**
|
|
7631
|
+
* Get notation line this arpeggio is in.
|
|
7632
|
+
* @returns - Staff or tab object.
|
|
7633
|
+
*/
|
|
7495
7634
|
getNotationLine() {
|
|
7496
7635
|
return getNotationLine(this.obj.line);
|
|
7497
7636
|
}
|
|
7498
7637
|
};
|
|
7638
|
+
/** Object name. */
|
|
7499
7639
|
__publicField(_MArpeggio, "Name", "Arpeggio");
|
|
7500
7640
|
var MArpeggio = _MArpeggio;
|
|
7501
7641
|
var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
|
|
@@ -7509,6 +7649,7 @@ var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
|
|
|
7509
7649
|
return this.obj;
|
|
7510
7650
|
}
|
|
7511
7651
|
};
|
|
7652
|
+
/** OBject name. */
|
|
7512
7653
|
__publicField(_MBeamGroup, "Name", "BeamGroup");
|
|
7513
7654
|
var MBeamGroup = _MBeamGroup;
|
|
7514
7655
|
var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
|
|
@@ -7521,10 +7662,15 @@ var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
|
|
|
7521
7662
|
getMusicObject() {
|
|
7522
7663
|
return this.obj;
|
|
7523
7664
|
}
|
|
7665
|
+
/**
|
|
7666
|
+
* Get staff this beam group is in.
|
|
7667
|
+
* @returns - Staff object.
|
|
7668
|
+
*/
|
|
7524
7669
|
getStaff() {
|
|
7525
7670
|
return this.obj.staff.getMusicInterface();
|
|
7526
7671
|
}
|
|
7527
7672
|
};
|
|
7673
|
+
/** Object name. */
|
|
7528
7674
|
__publicField(_MStaffBeamGroup, "Name", "StaffBeamGroup");
|
|
7529
7675
|
var MStaffBeamGroup = _MStaffBeamGroup;
|
|
7530
7676
|
var _MDocument = class _MDocument extends MusicInterface6 {
|
|
@@ -7537,27 +7683,53 @@ var _MDocument = class _MDocument extends MusicInterface6 {
|
|
|
7537
7683
|
getMusicObject() {
|
|
7538
7684
|
return this.obj;
|
|
7539
7685
|
}
|
|
7686
|
+
/**
|
|
7687
|
+
* Get title.
|
|
7688
|
+
* @returns - Title string or undefined.
|
|
7689
|
+
*/
|
|
7540
7690
|
getTitle() {
|
|
7541
7691
|
return this.obj.getTitle();
|
|
7542
7692
|
}
|
|
7693
|
+
/**
|
|
7694
|
+
* Get composer.
|
|
7695
|
+
* @returns - Composer string or undefined.
|
|
7696
|
+
*/
|
|
7543
7697
|
getComposer() {
|
|
7544
7698
|
return this.obj.getComposer();
|
|
7545
7699
|
3;
|
|
7546
7700
|
}
|
|
7701
|
+
/**
|
|
7702
|
+
* Get arranger.
|
|
7703
|
+
* @returns - Arranger string or undefined.
|
|
7704
|
+
*/
|
|
7547
7705
|
getArranger() {
|
|
7548
7706
|
return this.obj.getArranger();
|
|
7549
7707
|
}
|
|
7708
|
+
/**
|
|
7709
|
+
* Get score rows.
|
|
7710
|
+
* @returns - Array or score rows.
|
|
7711
|
+
*/
|
|
7550
7712
|
getRows() {
|
|
7551
7713
|
return this.obj.getRows().map((r) => r.getMusicInterface());
|
|
7552
7714
|
}
|
|
7715
|
+
/**
|
|
7716
|
+
* Get measures.
|
|
7717
|
+
* @returns - Array of measures.
|
|
7718
|
+
*/
|
|
7553
7719
|
getMeasures() {
|
|
7554
7720
|
return this.obj.getMeasures().map((m) => m.getMusicInterface());
|
|
7555
7721
|
}
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7722
|
+
/**
|
|
7723
|
+
* Play this document.
|
|
7724
|
+
* @param playStateChangeListener - Play state change listener function or undefined.
|
|
7725
|
+
* @returns - Player instance.
|
|
7726
|
+
*/
|
|
7727
|
+
play(playStateChangeListener) {
|
|
7728
|
+
assertArg2(Utils14.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
7729
|
+
return new MPlayer(this, playStateChangeListener).play();
|
|
7559
7730
|
}
|
|
7560
7731
|
};
|
|
7732
|
+
/** Object name. */
|
|
7561
7733
|
__publicField(_MDocument, "Name", "Document");
|
|
7562
7734
|
var MDocument2 = _MDocument;
|
|
7563
7735
|
var _MEnding = class _MEnding extends MusicInterface6 {
|
|
@@ -7570,14 +7742,24 @@ var _MEnding = class _MEnding extends MusicInterface6 {
|
|
|
7570
7742
|
getMusicObject() {
|
|
7571
7743
|
return this.obj;
|
|
7572
7744
|
}
|
|
7745
|
+
/**
|
|
7746
|
+
* Get passages.
|
|
7747
|
+
* @returns - Array of passage numbers, e.g. passage number 1 means that this ending is played on first pass.
|
|
7748
|
+
*/
|
|
7573
7749
|
getPassages() {
|
|
7574
7750
|
return this.obj.passages;
|
|
7575
7751
|
}
|
|
7752
|
+
/**
|
|
7753
|
+
* Has passage number?
|
|
7754
|
+
* @param passage - Passage number to find out.
|
|
7755
|
+
* @returns - Boolean whether this ending has asked passage number.
|
|
7756
|
+
*/
|
|
7576
7757
|
hasPassage(passage) {
|
|
7577
7758
|
assertArg2(Utils14.Is.isIntegerGte(passage, 1), "passage", passage);
|
|
7578
7759
|
return this.obj.hasPassage(passage);
|
|
7579
7760
|
}
|
|
7580
7761
|
};
|
|
7762
|
+
/** Object name. */
|
|
7581
7763
|
__publicField(_MEnding, "Name", "Ending");
|
|
7582
7764
|
var MEnding = _MEnding;
|
|
7583
7765
|
var _MFermata = class _MFermata extends MusicInterface6 {
|
|
@@ -7591,6 +7773,7 @@ var _MFermata = class _MFermata extends MusicInterface6 {
|
|
|
7591
7773
|
return this.obj;
|
|
7592
7774
|
}
|
|
7593
7775
|
};
|
|
7776
|
+
/** OBject name. */
|
|
7594
7777
|
__publicField(_MFermata, "Name", "Fermata");
|
|
7595
7778
|
var MFermata = _MFermata;
|
|
7596
7779
|
var _MHeader = class _MHeader extends MusicInterface6 {
|
|
@@ -7603,16 +7786,29 @@ var _MHeader = class _MHeader extends MusicInterface6 {
|
|
|
7603
7786
|
getMusicObject() {
|
|
7604
7787
|
return this.obj;
|
|
7605
7788
|
}
|
|
7789
|
+
/**
|
|
7790
|
+
* Get title.
|
|
7791
|
+
* @returns - Title string or undefined.
|
|
7792
|
+
*/
|
|
7606
7793
|
getTitle() {
|
|
7607
7794
|
return this.obj.title;
|
|
7608
7795
|
}
|
|
7796
|
+
/**
|
|
7797
|
+
* Get composer.
|
|
7798
|
+
* @returns - Composer string or undefined.
|
|
7799
|
+
*/
|
|
7609
7800
|
getComposer() {
|
|
7610
7801
|
return this.obj.composer;
|
|
7611
7802
|
}
|
|
7803
|
+
/**
|
|
7804
|
+
* Get arranger.
|
|
7805
|
+
* @returns - Arranger string or undefined.
|
|
7806
|
+
*/
|
|
7612
7807
|
getArranger() {
|
|
7613
7808
|
return this.obj.arranger;
|
|
7614
7809
|
}
|
|
7615
7810
|
};
|
|
7811
|
+
/** OBject name. */
|
|
7616
7812
|
__publicField(_MHeader, "Name", "Header");
|
|
7617
7813
|
var MHeader = _MHeader;
|
|
7618
7814
|
var _MImage = class _MImage extends MusicInterface6 {
|
|
@@ -7626,6 +7822,7 @@ var _MImage = class _MImage extends MusicInterface6 {
|
|
|
7626
7822
|
return this.obj;
|
|
7627
7823
|
}
|
|
7628
7824
|
};
|
|
7825
|
+
/** Object name. */
|
|
7629
7826
|
__publicField(_MImage, "Name", "Image");
|
|
7630
7827
|
var MImage = _MImage;
|
|
7631
7828
|
var _MMeasure = class _MMeasure extends MusicInterface6 {
|
|
@@ -7638,16 +7835,29 @@ var _MMeasure = class _MMeasure extends MusicInterface6 {
|
|
|
7638
7835
|
getMusicObject() {
|
|
7639
7836
|
return this.obj;
|
|
7640
7837
|
}
|
|
7838
|
+
/**
|
|
7839
|
+
* Get measure number.
|
|
7840
|
+
* @returns - Measure number starting from 1, or 0 if upbeat.
|
|
7841
|
+
*/
|
|
7641
7842
|
getMeasureNumber() {
|
|
7642
7843
|
return this.obj.getMeasureNumber();
|
|
7643
7844
|
}
|
|
7845
|
+
/**
|
|
7846
|
+
* Get rhythm columns.
|
|
7847
|
+
* @returns - Array of rhythm columns.
|
|
7848
|
+
*/
|
|
7644
7849
|
getRhythmColumns() {
|
|
7645
7850
|
return this.obj.getColumns().map((col) => col.getMusicInterface());
|
|
7646
7851
|
}
|
|
7852
|
+
/**
|
|
7853
|
+
* Get score row that this measure is in.
|
|
7854
|
+
* @returns - Score row.
|
|
7855
|
+
*/
|
|
7647
7856
|
getRow() {
|
|
7648
7857
|
return this.obj.row.getMusicInterface();
|
|
7649
7858
|
}
|
|
7650
7859
|
};
|
|
7860
|
+
/** OBject name. */
|
|
7651
7861
|
__publicField(_MMeasure, "Name", "Measure");
|
|
7652
7862
|
var MMeasure = _MMeasure;
|
|
7653
7863
|
var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
|
|
@@ -7661,6 +7871,7 @@ var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
|
|
|
7661
7871
|
return this.obj;
|
|
7662
7872
|
}
|
|
7663
7873
|
};
|
|
7874
|
+
/** OBject name. */
|
|
7664
7875
|
__publicField(_MBarLineRight, "Name", "BarLineRight");
|
|
7665
7876
|
var MBarLineRight = _MBarLineRight;
|
|
7666
7877
|
var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
|
|
@@ -7674,6 +7885,7 @@ var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
|
|
|
7674
7885
|
return this.obj;
|
|
7675
7886
|
}
|
|
7676
7887
|
};
|
|
7888
|
+
/** Object name. */
|
|
7677
7889
|
__publicField(_MBarLineLeft, "Name", "BarLineLeft");
|
|
7678
7890
|
var MBarLineLeft = _MBarLineLeft;
|
|
7679
7891
|
var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
@@ -7686,6 +7898,10 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
|
7686
7898
|
getMusicObject() {
|
|
7687
7899
|
return this.obj;
|
|
7688
7900
|
}
|
|
7901
|
+
/**
|
|
7902
|
+
* Get parent bar line object.
|
|
7903
|
+
* @returns - Parent bar line object.
|
|
7904
|
+
*/
|
|
7689
7905
|
getBarLine() {
|
|
7690
7906
|
let barLine = this.obj.barLine;
|
|
7691
7907
|
if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
|
|
@@ -7694,10 +7910,15 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
|
7694
7910
|
throw new MusicError19(MusicErrorType19.Score, `Bar line not let nor right.`);
|
|
7695
7911
|
}
|
|
7696
7912
|
}
|
|
7913
|
+
/**
|
|
7914
|
+
* Get staff or tab this bar lien object is in.
|
|
7915
|
+
* @returns - Staff or tab.
|
|
7916
|
+
*/
|
|
7697
7917
|
getNotationLine() {
|
|
7698
7918
|
return getNotationLine(this.obj.line);
|
|
7699
7919
|
}
|
|
7700
7920
|
};
|
|
7921
|
+
/** Object name. */
|
|
7701
7922
|
__publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
|
|
7702
7923
|
var MStaffTabBarLine = _MStaffTabBarLine;
|
|
7703
7924
|
var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
|
|
@@ -7710,19 +7931,36 @@ var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
|
|
|
7710
7931
|
getMusicObject() {
|
|
7711
7932
|
return this.obj;
|
|
7712
7933
|
}
|
|
7934
|
+
/**
|
|
7935
|
+
* Get notes of this note group.
|
|
7936
|
+
* @returns - Array of Note instances.
|
|
7937
|
+
*/
|
|
7713
7938
|
getNotes() {
|
|
7714
7939
|
return this.obj.notes;
|
|
7715
7940
|
}
|
|
7941
|
+
/**
|
|
7942
|
+
* Get rhythm props of this note group.
|
|
7943
|
+
* @returns - Rhythm props.
|
|
7944
|
+
*/
|
|
7716
7945
|
getRhythmProps() {
|
|
7717
7946
|
return this.obj.rhythmProps;
|
|
7718
7947
|
}
|
|
7948
|
+
/**
|
|
7949
|
+
* Get rhythm column this note group is in.
|
|
7950
|
+
* @returns - Rhythm column.
|
|
7951
|
+
*/
|
|
7719
7952
|
getRhythmColumn() {
|
|
7720
7953
|
return this.obj.col.getMusicInterface();
|
|
7721
7954
|
}
|
|
7955
|
+
/**
|
|
7956
|
+
* Get the measure this note group is in.
|
|
7957
|
+
* @returns - Measure.
|
|
7958
|
+
*/
|
|
7722
7959
|
getMeasure() {
|
|
7723
7960
|
return this.obj.measure.getMusicInterface();
|
|
7724
7961
|
}
|
|
7725
7962
|
};
|
|
7963
|
+
/** Object name. */
|
|
7726
7964
|
__publicField(_MNoteGroup, "Name", "NoteGroup");
|
|
7727
7965
|
var MNoteGroup = _MNoteGroup;
|
|
7728
7966
|
var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
|
|
@@ -7735,19 +7973,36 @@ var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
|
|
|
7735
7973
|
getMusicObject() {
|
|
7736
7974
|
return this.obj;
|
|
7737
7975
|
}
|
|
7976
|
+
/**
|
|
7977
|
+
* Get parent note group.
|
|
7978
|
+
* @returns - Parent note group.
|
|
7979
|
+
*/
|
|
7738
7980
|
getNoteGroup() {
|
|
7739
7981
|
return this.obj.noteGroup.getMusicInterface();
|
|
7740
7982
|
}
|
|
7983
|
+
/**
|
|
7984
|
+
* Get rhythm column this note group is in.
|
|
7985
|
+
* @returns - Rhythm column.
|
|
7986
|
+
*/
|
|
7741
7987
|
getRhythmColumn() {
|
|
7742
7988
|
return this.getNoteGroup().getRhythmColumn();
|
|
7743
7989
|
}
|
|
7990
|
+
/**
|
|
7991
|
+
* Get the measure this note group is in.
|
|
7992
|
+
* @returns - Measure.
|
|
7993
|
+
*/
|
|
7744
7994
|
getMeasure() {
|
|
7745
7995
|
return this.getNoteGroup().getMeasure();
|
|
7746
7996
|
}
|
|
7997
|
+
/**
|
|
7998
|
+
* Get staff notation line this note group is in.
|
|
7999
|
+
* @returns - Staff object.
|
|
8000
|
+
*/
|
|
7747
8001
|
getStaff() {
|
|
7748
8002
|
return this.obj.staff.getMusicInterface();
|
|
7749
8003
|
}
|
|
7750
8004
|
};
|
|
8005
|
+
/** Object name. */
|
|
7751
8006
|
__publicField(_MStaffNoteGroup, "Name", "StaffNoteGroup");
|
|
7752
8007
|
var MStaffNoteGroup = _MStaffNoteGroup;
|
|
7753
8008
|
var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
|
|
@@ -7760,19 +8015,36 @@ var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
|
|
|
7760
8015
|
getMusicObject() {
|
|
7761
8016
|
return this.obj;
|
|
7762
8017
|
}
|
|
8018
|
+
/**
|
|
8019
|
+
* Get parent note group.
|
|
8020
|
+
* @returns - Parent note group.
|
|
8021
|
+
*/
|
|
7763
8022
|
getNoteGroup() {
|
|
7764
8023
|
return this.obj.noteGroup.getMusicInterface();
|
|
7765
8024
|
}
|
|
8025
|
+
/**
|
|
8026
|
+
* Get rhythm column this note group is in.
|
|
8027
|
+
* @returns - Rhythm column.
|
|
8028
|
+
*/
|
|
7766
8029
|
getRhythmColumn() {
|
|
7767
8030
|
return this.getNoteGroup().getRhythmColumn();
|
|
7768
8031
|
}
|
|
8032
|
+
/**
|
|
8033
|
+
* Get the measure this note group is in.
|
|
8034
|
+
* @returns - Measure.
|
|
8035
|
+
*/
|
|
7769
8036
|
getMeasure() {
|
|
7770
8037
|
return this.getNoteGroup().getMeasure();
|
|
7771
8038
|
}
|
|
8039
|
+
/**
|
|
8040
|
+
* Get guitar tab this note group is in.
|
|
8041
|
+
* @returns - Tab object.
|
|
8042
|
+
*/
|
|
7772
8043
|
getTab() {
|
|
7773
8044
|
return this.obj.tab.getMusicInterface();
|
|
7774
8045
|
}
|
|
7775
8046
|
};
|
|
8047
|
+
/** OBject name. */
|
|
7776
8048
|
__publicField(_MTabNoteGroup, "Name", "TabNoteGroup");
|
|
7777
8049
|
var MTabNoteGroup = _MTabNoteGroup;
|
|
7778
8050
|
var _MRest = class _MRest extends MusicInterface6 {
|
|
@@ -7785,16 +8057,29 @@ var _MRest = class _MRest extends MusicInterface6 {
|
|
|
7785
8057
|
getMusicObject() {
|
|
7786
8058
|
return this.obj;
|
|
7787
8059
|
}
|
|
8060
|
+
/**
|
|
8061
|
+
* Get rhythm props of this rest.
|
|
8062
|
+
* @returns - Rhythm props.
|
|
8063
|
+
*/
|
|
7788
8064
|
getRhythmProps() {
|
|
7789
8065
|
return this.obj.rhythmProps;
|
|
7790
8066
|
}
|
|
8067
|
+
/**
|
|
8068
|
+
* Get rhythm column this rest is in.
|
|
8069
|
+
* @returns - Rhythm column.
|
|
8070
|
+
*/
|
|
7791
8071
|
getRhythmColumn() {
|
|
7792
8072
|
return this.obj.col.getMusicInterface();
|
|
7793
8073
|
}
|
|
8074
|
+
/**
|
|
8075
|
+
* Get the measure this rest is in.
|
|
8076
|
+
* @returns - Measure.
|
|
8077
|
+
*/
|
|
7794
8078
|
getMeasure() {
|
|
7795
8079
|
return this.obj.measure.getMusicInterface();
|
|
7796
8080
|
}
|
|
7797
8081
|
};
|
|
8082
|
+
/** OBject name. */
|
|
7798
8083
|
__publicField(_MRest, "Name", "Rest");
|
|
7799
8084
|
var MRest = _MRest;
|
|
7800
8085
|
var _MStaffRest = class _MStaffRest extends MusicInterface6 {
|
|
@@ -7807,19 +8092,36 @@ var _MStaffRest = class _MStaffRest extends MusicInterface6 {
|
|
|
7807
8092
|
getMusicObject() {
|
|
7808
8093
|
return this.obj;
|
|
7809
8094
|
}
|
|
8095
|
+
/**
|
|
8096
|
+
* Get parent rest object.
|
|
8097
|
+
* @returns - Parent rest object.
|
|
8098
|
+
*/
|
|
7810
8099
|
getRest() {
|
|
7811
8100
|
return this.obj.rest.getMusicInterface();
|
|
7812
8101
|
}
|
|
8102
|
+
/**
|
|
8103
|
+
* Get rhythm column this rest is in.
|
|
8104
|
+
* @returns - Rhythm column.
|
|
8105
|
+
*/
|
|
7813
8106
|
getRhythmColumn() {
|
|
7814
8107
|
return this.getRest().getRhythmColumn();
|
|
7815
8108
|
}
|
|
8109
|
+
/**
|
|
8110
|
+
* Get the measure this rest is in.
|
|
8111
|
+
* @returns - Measure.
|
|
8112
|
+
*/
|
|
7816
8113
|
getMeasure() {
|
|
7817
8114
|
return this.getRest().getMeasure();
|
|
7818
8115
|
}
|
|
8116
|
+
/**
|
|
8117
|
+
* Get staff notation line this rest is in.
|
|
8118
|
+
* @returns - Staff object.
|
|
8119
|
+
*/
|
|
7819
8120
|
getStaff() {
|
|
7820
8121
|
return this.obj.staff.getMusicInterface();
|
|
7821
8122
|
}
|
|
7822
8123
|
};
|
|
8124
|
+
/** Object name. */
|
|
7823
8125
|
__publicField(_MStaffRest, "Name", "StaffRest");
|
|
7824
8126
|
var MStaffRest = _MStaffRest;
|
|
7825
8127
|
var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
|
|
@@ -7832,19 +8134,36 @@ var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
|
|
|
7832
8134
|
getMusicObject() {
|
|
7833
8135
|
return this.obj;
|
|
7834
8136
|
}
|
|
8137
|
+
/**
|
|
8138
|
+
* Get symbol (note group or rest) of this column for given voice id.
|
|
8139
|
+
* @param voiceId - Voice id.
|
|
8140
|
+
* @returns - Note group, rest or undefined.
|
|
8141
|
+
*/
|
|
7835
8142
|
getRhythmSymbol(voiceId) {
|
|
7836
8143
|
var _a;
|
|
7837
8144
|
assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
|
|
7838
8145
|
return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
|
|
7839
8146
|
}
|
|
8147
|
+
/**
|
|
8148
|
+
* Get symbol (note group or rest) of this column for given voice id.
|
|
8149
|
+
* @deprecated - Use getRhythmSymbol(voiceId) instead.
|
|
8150
|
+
* @param voiceId - Voice id.
|
|
8151
|
+
* @returns - Note group, rest or undefined.
|
|
8152
|
+
*/
|
|
8153
|
+
getVoiceSymbol(voiceId) {
|
|
8154
|
+
var _a;
|
|
8155
|
+
assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
|
|
8156
|
+
return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
|
|
8157
|
+
}
|
|
8158
|
+
/**
|
|
8159
|
+
* Get the measure this rhythm column is in.
|
|
8160
|
+
* @returns - Measure.
|
|
8161
|
+
*/
|
|
7840
8162
|
getMeasure() {
|
|
7841
8163
|
return this.obj.measure.getMusicInterface();
|
|
7842
8164
|
}
|
|
7843
|
-
getVoiceSymbol(voiceId) {
|
|
7844
|
-
let s = this.obj.getVoiceSymbol(voiceId);
|
|
7845
|
-
return s instanceof ObjNoteGroup || s instanceof ObjRest ? s.getMusicInterface() : void 0;
|
|
7846
|
-
}
|
|
7847
8165
|
};
|
|
8166
|
+
/** OBject name. */
|
|
7848
8167
|
__publicField(_MRhythmColumn, "Name", "RhythmColumn");
|
|
7849
8168
|
var MRhythmColumn = _MRhythmColumn;
|
|
7850
8169
|
var _MScoreRow = class _MScoreRow extends MusicInterface6 {
|
|
@@ -7857,16 +8176,29 @@ var _MScoreRow = class _MScoreRow extends MusicInterface6 {
|
|
|
7857
8176
|
getMusicObject() {
|
|
7858
8177
|
return this.obj;
|
|
7859
8178
|
}
|
|
8179
|
+
/**
|
|
8180
|
+
* Parent music document.
|
|
8181
|
+
* @returns - Parent music document.
|
|
8182
|
+
*/
|
|
7860
8183
|
getDocument() {
|
|
7861
8184
|
return this.obj.doc.getMusicInterface();
|
|
7862
8185
|
}
|
|
8186
|
+
/**
|
|
8187
|
+
* Get measures of this score row.
|
|
8188
|
+
* @returns - Array of measures.
|
|
8189
|
+
*/
|
|
7863
8190
|
getMeasures() {
|
|
7864
8191
|
return this.obj.getMeasures().map((m) => m.getMusicInterface());
|
|
7865
8192
|
}
|
|
8193
|
+
/**
|
|
8194
|
+
* Get notation lines (staves and tabs) of this score row.
|
|
8195
|
+
* @returns - Array of staves and tabs.
|
|
8196
|
+
*/
|
|
7866
8197
|
getNotationLines() {
|
|
7867
8198
|
return this.obj.getNotationLines().map((line) => getNotationLine(line));
|
|
7868
8199
|
}
|
|
7869
8200
|
};
|
|
8201
|
+
/** Object name. */
|
|
7870
8202
|
__publicField(_MScoreRow, "Name", "ScoreRow");
|
|
7871
8203
|
var MScoreRow = _MScoreRow;
|
|
7872
8204
|
var _MStaff = class _MStaff extends MusicInterface6 {
|
|
@@ -7879,16 +8211,29 @@ var _MStaff = class _MStaff extends MusicInterface6 {
|
|
|
7879
8211
|
getMusicObject() {
|
|
7880
8212
|
return this.obj;
|
|
7881
8213
|
}
|
|
8214
|
+
/**
|
|
8215
|
+
* Get index of this staff in score row.
|
|
8216
|
+
* @returns - Index (0=top notation line).
|
|
8217
|
+
*/
|
|
7882
8218
|
getId() {
|
|
7883
8219
|
return this.obj.id;
|
|
7884
8220
|
}
|
|
8221
|
+
/**
|
|
8222
|
+
* Get name of this staff.
|
|
8223
|
+
* @returns - Staff name.
|
|
8224
|
+
*/
|
|
7885
8225
|
getName() {
|
|
7886
8226
|
return this.obj.name.length > 0 ? this.obj.name : void 0;
|
|
7887
8227
|
}
|
|
8228
|
+
/**
|
|
8229
|
+
* Get the score row this staff is in.
|
|
8230
|
+
* @returns - Score row.
|
|
8231
|
+
*/
|
|
7888
8232
|
getRow() {
|
|
7889
8233
|
return this.obj.row.getMusicInterface();
|
|
7890
8234
|
}
|
|
7891
8235
|
};
|
|
8236
|
+
/** Object name. */
|
|
7892
8237
|
__publicField(_MStaff, "Name", "Staff");
|
|
7893
8238
|
var MStaff = _MStaff;
|
|
7894
8239
|
var _MTab = class _MTab extends MusicInterface6 {
|
|
@@ -7901,16 +8246,29 @@ var _MTab = class _MTab extends MusicInterface6 {
|
|
|
7901
8246
|
getMusicObject() {
|
|
7902
8247
|
return this.obj;
|
|
7903
8248
|
}
|
|
8249
|
+
/**
|
|
8250
|
+
* Get index of this guitar tab in score row.
|
|
8251
|
+
* @returns - Index (0=top notation line).
|
|
8252
|
+
*/
|
|
7904
8253
|
getId() {
|
|
7905
8254
|
return this.obj.id;
|
|
7906
8255
|
}
|
|
8256
|
+
/**
|
|
8257
|
+
* Get name of this guitar tab.
|
|
8258
|
+
* @returns - Staff name.
|
|
8259
|
+
*/
|
|
7907
8260
|
getName() {
|
|
7908
8261
|
return this.obj.name.length > 0 ? this.obj.name : void 0;
|
|
7909
8262
|
}
|
|
8263
|
+
/**
|
|
8264
|
+
* Get the score row this guitar tab is in.
|
|
8265
|
+
* @returns - Score row.
|
|
8266
|
+
*/
|
|
7910
8267
|
getRow() {
|
|
7911
8268
|
return this.obj.row.getMusicInterface();
|
|
7912
8269
|
}
|
|
7913
8270
|
};
|
|
8271
|
+
/** Object name. */
|
|
7914
8272
|
__publicField(_MTab, "Name", "Tab");
|
|
7915
8273
|
var MTab = _MTab;
|
|
7916
8274
|
var _MSignature = class _MSignature extends MusicInterface6 {
|
|
@@ -7923,10 +8281,15 @@ var _MSignature = class _MSignature extends MusicInterface6 {
|
|
|
7923
8281
|
getMusicObject() {
|
|
7924
8282
|
return this.obj;
|
|
7925
8283
|
}
|
|
8284
|
+
/**
|
|
8285
|
+
* Get staff notation line this signature is in.
|
|
8286
|
+
* @returns - Staff object.
|
|
8287
|
+
*/
|
|
7926
8288
|
getStaff() {
|
|
7927
8289
|
return this.obj.staff.getMusicInterface();
|
|
7928
8290
|
}
|
|
7929
8291
|
};
|
|
8292
|
+
/** Object name. */
|
|
7930
8293
|
__publicField(_MSignature, "Name", "Signature");
|
|
7931
8294
|
var MSignature = _MSignature;
|
|
7932
8295
|
var _MSpecialText = class _MSpecialText extends MusicInterface6 {
|
|
@@ -7939,10 +8302,15 @@ var _MSpecialText = class _MSpecialText extends MusicInterface6 {
|
|
|
7939
8302
|
getMusicObject() {
|
|
7940
8303
|
return this.obj;
|
|
7941
8304
|
}
|
|
8305
|
+
/**
|
|
8306
|
+
* Get text content.
|
|
8307
|
+
* @returns - Text content.
|
|
8308
|
+
*/
|
|
7942
8309
|
getText() {
|
|
7943
8310
|
return this.obj.getText();
|
|
7944
8311
|
}
|
|
7945
8312
|
};
|
|
8313
|
+
/** Object name. */
|
|
7946
8314
|
__publicField(_MSpecialText, "Name", "SpecialText");
|
|
7947
8315
|
var MSpecialText = _MSpecialText;
|
|
7948
8316
|
var _MText = class _MText extends MusicInterface6 {
|
|
@@ -7955,10 +8323,15 @@ var _MText = class _MText extends MusicInterface6 {
|
|
|
7955
8323
|
getMusicObject() {
|
|
7956
8324
|
return this.obj;
|
|
7957
8325
|
}
|
|
8326
|
+
/**
|
|
8327
|
+
* Get text content.
|
|
8328
|
+
* @returns - Text content.
|
|
8329
|
+
*/
|
|
7958
8330
|
getText() {
|
|
7959
8331
|
return this.obj.getText();
|
|
7960
8332
|
}
|
|
7961
8333
|
};
|
|
8334
|
+
/** Object name. */
|
|
7962
8335
|
__publicField(_MText, "Name", "Text");
|
|
7963
8336
|
var MText = _MText;
|
|
7964
8337
|
var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
|
|
@@ -7972,33 +8345,69 @@ var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
|
|
|
7972
8345
|
return this.obj;
|
|
7973
8346
|
}
|
|
7974
8347
|
};
|
|
8348
|
+
/** OBject name. */
|
|
7975
8349
|
__publicField(_MExtensionLine, "Name", "ExtensionLine");
|
|
7976
8350
|
var MExtensionLine = _MExtensionLine;
|
|
8351
|
+
|
|
8352
|
+
// src/score/pub/music-interface.ts
|
|
8353
|
+
import { MusicError as MusicError20, MusicErrorType as MusicErrorType20 } from "@tspro/web-music-score/core";
|
|
8354
|
+
function assertArg3(condition, argName, argValue) {
|
|
8355
|
+
if (!condition) {
|
|
8356
|
+
throw new MusicError20(MusicErrorType20.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
8357
|
+
}
|
|
8358
|
+
}
|
|
8359
|
+
function require_t(t, message) {
|
|
8360
|
+
if (t === void 0 || t === null) {
|
|
8361
|
+
throw new TypeError(message);
|
|
8362
|
+
} else {
|
|
8363
|
+
return t;
|
|
8364
|
+
}
|
|
8365
|
+
}
|
|
7977
8366
|
var _MPlayer = class _MPlayer {
|
|
7978
|
-
|
|
8367
|
+
/**
|
|
8368
|
+
* Create new music player.
|
|
8369
|
+
* @param doc - Music document to play.
|
|
8370
|
+
* @param playStateChangeListener - Play state change listener.
|
|
8371
|
+
*/
|
|
8372
|
+
constructor(doc, playStateChangeListener) {
|
|
7979
8373
|
__publicField(this, "player");
|
|
7980
|
-
|
|
7981
|
-
|
|
8374
|
+
assertArg3(doc instanceof MDocument2, "doc", doc);
|
|
8375
|
+
assertArg3(Utils15.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
7982
8376
|
this.player = new Player();
|
|
7983
8377
|
this.player.setDocument(doc.getMusicObject());
|
|
7984
8378
|
this.player.setCursorPositionChangeListener((cursorRect) => doc.getMusicObject().updateCursorRect(cursorRect));
|
|
7985
|
-
if (
|
|
7986
|
-
this.player.setPlayStateChnageListener(
|
|
8379
|
+
if (playStateChangeListener) {
|
|
8380
|
+
this.player.setPlayStateChnageListener(playStateChangeListener);
|
|
7987
8381
|
}
|
|
7988
8382
|
}
|
|
8383
|
+
/**
|
|
8384
|
+
* Stop all playing.
|
|
8385
|
+
*/
|
|
7989
8386
|
static stopAll() {
|
|
7990
8387
|
this.currentlyPlaying.forEach((p) => p.stop());
|
|
7991
8388
|
Audio2.stop();
|
|
7992
8389
|
}
|
|
8390
|
+
/**
|
|
8391
|
+
* Playe attached document.
|
|
8392
|
+
* @returns - This player instance.
|
|
8393
|
+
*/
|
|
7993
8394
|
play() {
|
|
7994
8395
|
_MPlayer.currentlyPlaying.add(this);
|
|
7995
8396
|
this.player.play();
|
|
7996
8397
|
return this;
|
|
7997
8398
|
}
|
|
8399
|
+
/**
|
|
8400
|
+
* Pause playback of attached document.
|
|
8401
|
+
* @returns - This player instance.
|
|
8402
|
+
*/
|
|
7998
8403
|
pause() {
|
|
7999
8404
|
this.player.pause();
|
|
8000
8405
|
return this;
|
|
8001
8406
|
}
|
|
8407
|
+
/**
|
|
8408
|
+
* Stop playback of attached document.
|
|
8409
|
+
* @returns - This player instance.
|
|
8410
|
+
*/
|
|
8002
8411
|
stop() {
|
|
8003
8412
|
this.player.stop();
|
|
8004
8413
|
_MPlayer.currentlyPlaying.delete(this);
|
|
@@ -8008,33 +8417,61 @@ var _MPlayer = class _MPlayer {
|
|
|
8008
8417
|
__publicField(_MPlayer, "currentlyPlaying", /* @__PURE__ */ new Set());
|
|
8009
8418
|
var MPlayer = _MPlayer;
|
|
8010
8419
|
var MRenderer2 = class {
|
|
8420
|
+
/**
|
|
8421
|
+
* Create new renderer instance.
|
|
8422
|
+
*/
|
|
8011
8423
|
constructor() {
|
|
8012
8424
|
__publicField(this, "renderer");
|
|
8013
8425
|
this.renderer = new Renderer(this);
|
|
8014
8426
|
}
|
|
8427
|
+
/**
|
|
8428
|
+
* Attach music document to this renderer.
|
|
8429
|
+
* @param doc - Music document.
|
|
8430
|
+
* @returns - This renderer instance.
|
|
8431
|
+
*/
|
|
8015
8432
|
setDocument(doc) {
|
|
8016
|
-
|
|
8433
|
+
assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
8017
8434
|
this.renderer.setDocument(doc);
|
|
8018
8435
|
return this;
|
|
8019
8436
|
}
|
|
8437
|
+
/**
|
|
8438
|
+
* Set target canvas html element for this renderer.
|
|
8439
|
+
* @param canvas - HTML canvas element or element id.
|
|
8440
|
+
* @returns - This renderer instance.
|
|
8441
|
+
*/
|
|
8020
8442
|
setCanvas(canvas) {
|
|
8021
|
-
canvas = require_t(
|
|
8443
|
+
canvas = require_t(Utils15.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
|
|
8022
8444
|
this.renderer.setCanvas(canvas);
|
|
8023
8445
|
return this;
|
|
8024
8446
|
}
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8447
|
+
/**
|
|
8448
|
+
* Set score event listener.
|
|
8449
|
+
* @param scoreEventListener - Score event listener.
|
|
8450
|
+
*/
|
|
8451
|
+
setScoreEventListener(scoreEventListener) {
|
|
8452
|
+
assertArg3(Utils15.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
|
|
8453
|
+
this.renderer.setScoreEventListener(scoreEventListener);
|
|
8028
8454
|
}
|
|
8455
|
+
/**
|
|
8456
|
+
* Draw given music object hilighted.
|
|
8457
|
+
* @param obj - Music object or undefined to remove hilighting.
|
|
8458
|
+
*/
|
|
8029
8459
|
hilightObject(obj) {
|
|
8030
8460
|
this.renderer.hilightObject(obj == null ? void 0 : obj.getMusicObject());
|
|
8031
8461
|
}
|
|
8462
|
+
/**
|
|
8463
|
+
* Draw given staff position hilighted.
|
|
8464
|
+
* @param staffPos - Staff position (score row and diatonic id) or undefined to remove hilighting.
|
|
8465
|
+
*/
|
|
8032
8466
|
hilightStaffPos(staffPos) {
|
|
8033
8467
|
this.renderer.hilightStaffPos(staffPos ? {
|
|
8034
8468
|
scoreRow: staffPos.scoreRow.getMusicObject(),
|
|
8035
8469
|
diatonicId: staffPos.diatonicId
|
|
8036
8470
|
} : void 0);
|
|
8037
8471
|
}
|
|
8472
|
+
/**
|
|
8473
|
+
* Draw contents of attached music document to attached canvas.
|
|
8474
|
+
*/
|
|
8038
8475
|
draw() {
|
|
8039
8476
|
try {
|
|
8040
8477
|
this.renderer.draw();
|
|
@@ -8045,6 +8482,9 @@ var MRenderer2 = class {
|
|
|
8045
8482
|
}
|
|
8046
8483
|
};
|
|
8047
8484
|
var _MPlaybackButtons = class _MPlaybackButtons {
|
|
8485
|
+
/**
|
|
8486
|
+
* Create new playback buttons helper class instance.
|
|
8487
|
+
*/
|
|
8048
8488
|
constructor() {
|
|
8049
8489
|
__publicField(this, "playButton");
|
|
8050
8490
|
__publicField(this, "stopButton");
|
|
@@ -8077,8 +8517,13 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8077
8517
|
};
|
|
8078
8518
|
this.updateButtons();
|
|
8079
8519
|
}
|
|
8520
|
+
/**
|
|
8521
|
+
* Attach music document whose playcak will be controlled by this playback buttons helper class instance.
|
|
8522
|
+
* @param doc - Music document.
|
|
8523
|
+
* @returns
|
|
8524
|
+
*/
|
|
8080
8525
|
setDocument(doc) {
|
|
8081
|
-
|
|
8526
|
+
assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
8082
8527
|
this.onStop();
|
|
8083
8528
|
if (doc) {
|
|
8084
8529
|
this.player = new MPlayer(doc, (playState) => {
|
|
@@ -8091,6 +8536,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8091
8536
|
this.updateButtons();
|
|
8092
8537
|
return this;
|
|
8093
8538
|
}
|
|
8539
|
+
/**
|
|
8540
|
+
* Detach attached music document.
|
|
8541
|
+
*/
|
|
8094
8542
|
detachDocument() {
|
|
8095
8543
|
this.setDocument(void 0);
|
|
8096
8544
|
}
|
|
@@ -8112,31 +8560,50 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8112
8560
|
this.pauseButton.innerText = this.pauseLabel;
|
|
8113
8561
|
}
|
|
8114
8562
|
}
|
|
8563
|
+
/**
|
|
8564
|
+
* Set play button.
|
|
8565
|
+
* @param btn - HTML button element or element id.
|
|
8566
|
+
* @param btnLabel - Custom button label (e.g. "Play").
|
|
8567
|
+
* @returns - This playback buttons class instance.
|
|
8568
|
+
*/
|
|
8115
8569
|
setPlayButton(btn, btnLabel) {
|
|
8116
|
-
|
|
8570
|
+
assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8117
8571
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
|
|
8118
|
-
this.playButton = require_t(
|
|
8572
|
+
this.playButton = require_t(Utils15.Dom.getButton(btn), "Play button required!");
|
|
8119
8573
|
this.playLabel = btnLabel != null ? btnLabel : "Play";
|
|
8120
8574
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
|
|
8121
8575
|
_MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
|
|
8122
8576
|
this.updateButtons();
|
|
8123
8577
|
return this;
|
|
8124
8578
|
}
|
|
8579
|
+
/**
|
|
8580
|
+
* Set stop button.
|
|
8581
|
+
* @param btn - HTML button element or element id.
|
|
8582
|
+
* @param btnLabel - Custom button label (e.g. "Stop").
|
|
8583
|
+
* @returns - This playback buttons class instance.
|
|
8584
|
+
*/
|
|
8125
8585
|
setStopButton(btn, btnLabel) {
|
|
8126
|
-
|
|
8586
|
+
assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8127
8587
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
|
|
8128
|
-
this.stopButton = require_t(
|
|
8588
|
+
this.stopButton = require_t(Utils15.Dom.getButton(btn), "Stop button required!");
|
|
8129
8589
|
this.stopLabel = btnLabel != null ? btnLabel : "Stop";
|
|
8130
8590
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
|
|
8131
8591
|
_MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
|
|
8132
8592
|
this.updateButtons();
|
|
8133
8593
|
return this;
|
|
8134
8594
|
}
|
|
8595
|
+
/**
|
|
8596
|
+
* Set play/stop button.
|
|
8597
|
+
* @param btn - HTML button element or element id.
|
|
8598
|
+
* @param playLabel - Custom button label for play action (e.g. "Play").
|
|
8599
|
+
* @param stopLabel - Custom button label for stop action (e.g. "Stop").
|
|
8600
|
+
* @returns - This playback buttons class instance.
|
|
8601
|
+
*/
|
|
8135
8602
|
setPlayStopButton(btn, playLabel, stopLabel) {
|
|
8136
|
-
|
|
8137
|
-
|
|
8603
|
+
assertArg3(Utils15.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
|
|
8604
|
+
assertArg3(Utils15.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
|
|
8138
8605
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
|
|
8139
|
-
this.playStopButton = require_t(
|
|
8606
|
+
this.playStopButton = require_t(Utils15.Dom.getButton(btn), "Play/stop button required!");
|
|
8140
8607
|
this.playLabel = playLabel != null ? playLabel : "Play";
|
|
8141
8608
|
this.stopLabel = stopLabel != null ? stopLabel : "Stop";
|
|
8142
8609
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
|
|
@@ -8144,10 +8611,16 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8144
8611
|
this.updateButtons();
|
|
8145
8612
|
return this;
|
|
8146
8613
|
}
|
|
8614
|
+
/**
|
|
8615
|
+
* Set pause button.
|
|
8616
|
+
* @param btn - HTML button element or element id.
|
|
8617
|
+
* @param btnLabel - Custom button label (e.g. "Pause").
|
|
8618
|
+
* @returns - This playback buttons class instance.
|
|
8619
|
+
*/
|
|
8147
8620
|
setPauseButton(btn, btnLabel) {
|
|
8148
|
-
|
|
8621
|
+
assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8149
8622
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
|
|
8150
|
-
this.pauseButton = require_t(
|
|
8623
|
+
this.pauseButton = require_t(Utils15.Dom.getButton(btn), "Pause button required!");
|
|
8151
8624
|
this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
|
|
8152
8625
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
|
|
8153
8626
|
_MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
|
|
@@ -8169,7 +8642,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8169
8642
|
}
|
|
8170
8643
|
}
|
|
8171
8644
|
static addOnClickListener(btn, onClick) {
|
|
8172
|
-
|
|
8645
|
+
assertArg3(Utils15.Is.isFunction(onClick), "onClick", onClick);
|
|
8173
8646
|
btn.addEventListener("click", onClick);
|
|
8174
8647
|
let clickListeners = this.savedOnClickListeners.get(btn) || [];
|
|
8175
8648
|
this.savedOnClickListeners.set(btn, [...clickListeners, onClick]);
|
|
@@ -8188,6 +8661,7 @@ export {
|
|
|
8188
8661
|
Connective,
|
|
8189
8662
|
DivRect,
|
|
8190
8663
|
DocumentBuilder,
|
|
8664
|
+
DynamicsAnnotation,
|
|
8191
8665
|
Fermata,
|
|
8192
8666
|
Label,
|
|
8193
8667
|
MAccidental,
|
|
@@ -8229,6 +8703,7 @@ export {
|
|
|
8229
8703
|
ScoreStaffPosEvent,
|
|
8230
8704
|
StaffPreset,
|
|
8231
8705
|
Stem,
|
|
8706
|
+
TempoAnnotation,
|
|
8232
8707
|
TieType,
|
|
8233
8708
|
VerticalPosition,
|
|
8234
8709
|
getStringNumbers,
|