@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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v4.0.
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -39,6 +39,7 @@ __export(score_exports, {
|
|
|
39
39
|
Connective: () => Connective,
|
|
40
40
|
DivRect: () => DivRect,
|
|
41
41
|
DocumentBuilder: () => DocumentBuilder,
|
|
42
|
+
DynamicsAnnotation: () => DynamicsAnnotation,
|
|
42
43
|
Fermata: () => Fermata,
|
|
43
44
|
Label: () => Label,
|
|
44
45
|
MAccidental: () => MAccidental,
|
|
@@ -80,6 +81,7 @@ __export(score_exports, {
|
|
|
80
81
|
ScoreStaffPosEvent: () => ScoreStaffPosEvent,
|
|
81
82
|
StaffPreset: () => StaffPreset,
|
|
82
83
|
Stem: () => Stem,
|
|
84
|
+
TempoAnnotation: () => TempoAnnotation,
|
|
83
85
|
TieType: () => TieType,
|
|
84
86
|
VerticalPosition: () => VerticalPosition,
|
|
85
87
|
getStringNumbers: () => getStringNumbers,
|
|
@@ -445,6 +447,27 @@ var Annotation = /* @__PURE__ */ ((Annotation2) => {
|
|
|
445
447
|
Annotation2["Tempo"] = "tempo";
|
|
446
448
|
return Annotation2;
|
|
447
449
|
})(Annotation || {});
|
|
450
|
+
var DynamicsAnnotation = /* @__PURE__ */ ((DynamicsAnnotation2) => {
|
|
451
|
+
DynamicsAnnotation2["cresc"] = "cresc.";
|
|
452
|
+
DynamicsAnnotation2["decresc"] = "decresc.";
|
|
453
|
+
DynamicsAnnotation2["dim"] = "dim.";
|
|
454
|
+
DynamicsAnnotation2["ppp"] = "ppp";
|
|
455
|
+
DynamicsAnnotation2["pp"] = "pp";
|
|
456
|
+
DynamicsAnnotation2["p"] = "p";
|
|
457
|
+
DynamicsAnnotation2["mp"] = "mp";
|
|
458
|
+
DynamicsAnnotation2["m"] = "m";
|
|
459
|
+
DynamicsAnnotation2["mf"] = "mf";
|
|
460
|
+
DynamicsAnnotation2["f"] = "f";
|
|
461
|
+
DynamicsAnnotation2["ff"] = "ff";
|
|
462
|
+
DynamicsAnnotation2["fff"] = "fff";
|
|
463
|
+
return DynamicsAnnotation2;
|
|
464
|
+
})(DynamicsAnnotation || {});
|
|
465
|
+
var TempoAnnotation = /* @__PURE__ */ ((TempoAnnotation2) => {
|
|
466
|
+
TempoAnnotation2["accel"] = "accel.";
|
|
467
|
+
TempoAnnotation2["rit"] = "rit.";
|
|
468
|
+
TempoAnnotation2["a_tempo"] = "a tempo";
|
|
469
|
+
return TempoAnnotation2;
|
|
470
|
+
})(TempoAnnotation || {});
|
|
448
471
|
var Label = /* @__PURE__ */ ((Label2) => {
|
|
449
472
|
Label2["Note"] = "note";
|
|
450
473
|
Label2["Chord"] = "chord";
|
|
@@ -3408,6 +3431,9 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
3408
3431
|
}
|
|
3409
3432
|
};
|
|
3410
3433
|
|
|
3434
|
+
// src/score/engine/extension.ts
|
|
3435
|
+
var import_core9 = require("@tspro/web-music-score/core");
|
|
3436
|
+
|
|
3411
3437
|
// src/score/engine/element-data.ts
|
|
3412
3438
|
var import_ts_utils_lib5 = require("@tspro/ts-utils-lib");
|
|
3413
3439
|
|
|
@@ -3530,29 +3556,8 @@ function getNavigationString(navigation) {
|
|
|
3530
3556
|
return navigation[0].toUpperCase() + navigation.substring(1);
|
|
3531
3557
|
}
|
|
3532
3558
|
}
|
|
3533
|
-
var DynamicsAnnotations = /* @__PURE__ */ ((DynamicsAnnotations2) => {
|
|
3534
|
-
DynamicsAnnotations2["cresc"] = "cresc.";
|
|
3535
|
-
DynamicsAnnotations2["decresc"] = "decresc.";
|
|
3536
|
-
DynamicsAnnotations2["dim"] = "dim.";
|
|
3537
|
-
DynamicsAnnotations2["ppp"] = "ppp";
|
|
3538
|
-
DynamicsAnnotations2["pp"] = "pp";
|
|
3539
|
-
DynamicsAnnotations2["p"] = "p";
|
|
3540
|
-
DynamicsAnnotations2["mp"] = "mp";
|
|
3541
|
-
DynamicsAnnotations2["m"] = "m";
|
|
3542
|
-
DynamicsAnnotations2["mf"] = "mf";
|
|
3543
|
-
DynamicsAnnotations2["f"] = "f";
|
|
3544
|
-
DynamicsAnnotations2["ff"] = "ff";
|
|
3545
|
-
DynamicsAnnotations2["fff"] = "fff";
|
|
3546
|
-
return DynamicsAnnotations2;
|
|
3547
|
-
})(DynamicsAnnotations || {});
|
|
3548
|
-
var TempoAnnotations = /* @__PURE__ */ ((TempoAnnotations2) => {
|
|
3549
|
-
TempoAnnotations2["accel"] = "accel.";
|
|
3550
|
-
TempoAnnotations2["rit"] = "rit.";
|
|
3551
|
-
TempoAnnotations2["a_tempo"] = "a tempo";
|
|
3552
|
-
return TempoAnnotations2;
|
|
3553
|
-
})(TempoAnnotations || {});
|
|
3554
3559
|
function isDynamicsText(text) {
|
|
3555
|
-
return import_ts_utils_lib5.Utils.Is.isEnumValue(text,
|
|
3560
|
+
return import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotation);
|
|
3556
3561
|
}
|
|
3557
3562
|
function getDynamicsVolume(text) {
|
|
3558
3563
|
if (/^(p+|f+|m|mp|mf)$/.test(text)) {
|
|
@@ -3563,12 +3568,12 @@ function getDynamicsVolume(text) {
|
|
|
3563
3568
|
}
|
|
3564
3569
|
}
|
|
3565
3570
|
function isTempoText(text) {
|
|
3566
|
-
return import_ts_utils_lib5.Utils.Is.isEnumValue(text,
|
|
3571
|
+
return import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotation);
|
|
3567
3572
|
}
|
|
3568
3573
|
function getAnnotation(text) {
|
|
3569
|
-
if (import_ts_utils_lib5.Utils.Is.isEnumValue(text,
|
|
3574
|
+
if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotation)) {
|
|
3570
3575
|
return "dynamics" /* Dynamics */;
|
|
3571
|
-
} else if (import_ts_utils_lib5.Utils.Is.isEnumValue(text,
|
|
3576
|
+
} else if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotation)) {
|
|
3572
3577
|
return "tempo" /* Tempo */;
|
|
3573
3578
|
} else {
|
|
3574
3579
|
return void 0;
|
|
@@ -3576,7 +3581,6 @@ function getAnnotation(text) {
|
|
|
3576
3581
|
}
|
|
3577
3582
|
|
|
3578
3583
|
// src/score/engine/extension.ts
|
|
3579
|
-
var import_core9 = require("@tspro/web-music-score/core");
|
|
3580
3584
|
function getTextAnchorY(linePos) {
|
|
3581
3585
|
switch (linePos) {
|
|
3582
3586
|
case "bottom":
|
|
@@ -7119,6 +7123,9 @@ function isTupletRatio(tupletRatio) {
|
|
|
7119
7123
|
}
|
|
7120
7124
|
}
|
|
7121
7125
|
var DocumentBuilder = class {
|
|
7126
|
+
/**
|
|
7127
|
+
* Create new document builder instance.
|
|
7128
|
+
*/
|
|
7122
7129
|
constructor() {
|
|
7123
7130
|
__publicField(this, "doc");
|
|
7124
7131
|
this.doc = new ObjDocument();
|
|
@@ -7152,9 +7159,20 @@ var DocumentBuilder = class {
|
|
|
7152
7159
|
var _a;
|
|
7153
7160
|
return (_a = this.doc.getLastMeasure()) != null ? _a : this.doc.addMeasure();
|
|
7154
7161
|
}
|
|
7162
|
+
/**
|
|
7163
|
+
* Get music document after finished building.
|
|
7164
|
+
* @returns - Music document.
|
|
7165
|
+
*/
|
|
7155
7166
|
getDocument() {
|
|
7156
7167
|
return this.doc.getMusicInterface();
|
|
7157
7168
|
}
|
|
7169
|
+
/**
|
|
7170
|
+
* Set header texts.
|
|
7171
|
+
* @param title - Title of this docmument/musical piece.
|
|
7172
|
+
* @param composer - Composer of this document/musical piece.
|
|
7173
|
+
* @param arranger - Arranger of this document/musical piece.
|
|
7174
|
+
* @returns - This document builder instance.
|
|
7175
|
+
*/
|
|
7158
7176
|
setHeader(title, composer, arranger) {
|
|
7159
7177
|
assertArg(import_ts_utils_lib13.Utils.Is.isStringOrUndefined(title), "title", title);
|
|
7160
7178
|
assertArg(import_ts_utils_lib13.Utils.Is.isStringOrUndefined(composer), "composer", composer);
|
|
@@ -7162,11 +7180,20 @@ var DocumentBuilder = class {
|
|
|
7162
7180
|
this.doc.setHeader(title, composer, arranger);
|
|
7163
7181
|
return this;
|
|
7164
7182
|
}
|
|
7183
|
+
/**
|
|
7184
|
+
* Automatically limit number of measures per score row.
|
|
7185
|
+
* @param measuresPerRow - Number of measures per row. Must be integer >=1 or Infinity.
|
|
7186
|
+
* @returns - This document builder instance.
|
|
7187
|
+
*/
|
|
7165
7188
|
setMeasuresPerRow(measuresPerRow) {
|
|
7166
7189
|
assertArg(import_ts_utils_lib13.Utils.Is.isIntegerGte(measuresPerRow, 1) || import_ts_utils_lib13.Utils.Is.isPosInfinity(measuresPerRow), "measuresPerRow", measuresPerRow);
|
|
7167
7190
|
this.doc.setMeasuresPerRow(measuresPerRow);
|
|
7168
7191
|
return this;
|
|
7169
7192
|
}
|
|
7193
|
+
/**
|
|
7194
|
+
* Add new measure.
|
|
7195
|
+
* @returns - This document builder instance.
|
|
7196
|
+
*/
|
|
7170
7197
|
addMeasure() {
|
|
7171
7198
|
this.doc.addMeasure();
|
|
7172
7199
|
return this;
|
|
@@ -7176,6 +7203,11 @@ var DocumentBuilder = class {
|
|
|
7176
7203
|
this.getMeasure().setKeySignature(...args);
|
|
7177
7204
|
return this;
|
|
7178
7205
|
}
|
|
7206
|
+
/**
|
|
7207
|
+
* Set time signature for current measure and forward.
|
|
7208
|
+
* @param timeSignature - TimeSignature object instance or string (e.g. "3/4").
|
|
7209
|
+
* @returns - This document builder instance.
|
|
7210
|
+
*/
|
|
7179
7211
|
setTimeSignature(timeSignature) {
|
|
7180
7212
|
assertArg(timeSignature instanceof import_theory13.TimeSignature || import_ts_utils_lib13.Utils.Is.isNonEmptyString(timeSignature), "timeSignature", timeSignature);
|
|
7181
7213
|
this.getMeasure().setTimeSignature(timeSignature);
|
|
@@ -7192,6 +7224,14 @@ var DocumentBuilder = class {
|
|
|
7192
7224
|
this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
|
|
7193
7225
|
return this;
|
|
7194
7226
|
}
|
|
7227
|
+
/**
|
|
7228
|
+
* Add note o current measure.
|
|
7229
|
+
* @param voiceId - Voice id to add note to.
|
|
7230
|
+
* @param note - Note instance of Note or string (e.g. "D4").
|
|
7231
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
7232
|
+
* @param options - Note options.
|
|
7233
|
+
* @returns - This document builder instance.
|
|
7234
|
+
*/
|
|
7195
7235
|
addNote(voiceId, note, noteLength, options) {
|
|
7196
7236
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7197
7237
|
assertArg(note instanceof import_theory13.Note || import_ts_utils_lib13.Utils.Is.isNonEmptyString(note), "note", note);
|
|
@@ -7202,6 +7242,13 @@ var DocumentBuilder = class {
|
|
|
7202
7242
|
this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options);
|
|
7203
7243
|
return this;
|
|
7204
7244
|
}
|
|
7245
|
+
/**
|
|
7246
|
+
* @param voiceId - Voice id to add chord to.
|
|
7247
|
+
* @param notes - Array of notes, each instance of Note or string (e.g. "D4").
|
|
7248
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
7249
|
+
* @param options - Note options.
|
|
7250
|
+
* @returns - This document builder instance.
|
|
7251
|
+
*/
|
|
7205
7252
|
addChord(voiceId, notes, noteLength, options) {
|
|
7206
7253
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7207
7254
|
assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib13.Utils.Is.isNonEmptyString(note)), "notes", notes);
|
|
@@ -7212,6 +7259,13 @@ var DocumentBuilder = class {
|
|
|
7212
7259
|
this.getMeasure().addNoteGroup(voiceId, notes, noteLength, options);
|
|
7213
7260
|
return this;
|
|
7214
7261
|
}
|
|
7262
|
+
/**
|
|
7263
|
+
*
|
|
7264
|
+
* @param voiceId - Voice id to add rest to.
|
|
7265
|
+
* @param restLength - Rest length (e.g. "4n").
|
|
7266
|
+
* @param options - Rest options.
|
|
7267
|
+
* @returns - This document builder instance.
|
|
7268
|
+
*/
|
|
7215
7269
|
addRest(voiceId, restLength, options) {
|
|
7216
7270
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
7217
7271
|
assertArg(import_ts_utils_lib13.Utils.Is.isEnumValue(restLength, import_theory13.NoteLength) || isNoteLength(restLength), "restLength", restLength);
|
|
@@ -7231,10 +7285,10 @@ var DocumentBuilder = class {
|
|
|
7231
7285
|
* });
|
|
7232
7286
|
* </pre>
|
|
7233
7287
|
*
|
|
7234
|
-
* @param voiceId
|
|
7288
|
+
* @param voiceId - Voice id to add tuplet to.
|
|
7235
7289
|
* @param tupletRatio - You can also use Theory.Tuplet presets (e.g. Theory.Tuplet.Triplet).
|
|
7236
|
-
* @param tupletBuilder
|
|
7237
|
-
* @returns
|
|
7290
|
+
* @param tupletBuilder - Tuplet builder function to build tuplet.
|
|
7291
|
+
* @returns - This document builder instance.
|
|
7238
7292
|
*/
|
|
7239
7293
|
addTuplet(voiceId, tupletRatio, tupletBuilder) {
|
|
7240
7294
|
assertArg(isVoiceId(voiceId), "voiceId", voiceId);
|
|
@@ -7285,10 +7339,20 @@ var DocumentBuilder = class {
|
|
|
7285
7339
|
this.getMeasure().addFermata(staffTabOrGroups, fermata);
|
|
7286
7340
|
return this;
|
|
7287
7341
|
}
|
|
7342
|
+
/**
|
|
7343
|
+
* Add fermata to current measure.
|
|
7344
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
7345
|
+
* @returns - This document builder instance.
|
|
7346
|
+
*/
|
|
7288
7347
|
addFermata(fermata = "atNote" /* AtNote */) {
|
|
7289
7348
|
return this.addFermataInternal(void 0, fermata);
|
|
7290
7349
|
}
|
|
7291
|
-
/**
|
|
7350
|
+
/**
|
|
7351
|
+
* Add Fermata to current measure to given staff/tab/group.
|
|
7352
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
7353
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
7354
|
+
* @returns - This document builder instance.
|
|
7355
|
+
*/
|
|
7292
7356
|
addFermataTo(staffTabOrGroups, fermata = "atNote" /* AtNote */) {
|
|
7293
7357
|
return this.addFermataInternal(staffTabOrGroups, fermata);
|
|
7294
7358
|
}
|
|
@@ -7341,10 +7405,22 @@ var DocumentBuilder = class {
|
|
|
7341
7405
|
this.getMeasure().addLabel(staffTabOrGroups, label, text);
|
|
7342
7406
|
return this;
|
|
7343
7407
|
}
|
|
7408
|
+
/**
|
|
7409
|
+
* Add label text to column of last added note/chord/rest in current measure.
|
|
7410
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
7411
|
+
* @param text - label text (e.g. "Am").
|
|
7412
|
+
* @returns - This document builder instance.
|
|
7413
|
+
*/
|
|
7344
7414
|
addLabel(label, text) {
|
|
7345
7415
|
return this.addLabelInternal(void 0, label, text);
|
|
7346
7416
|
}
|
|
7347
|
-
/**
|
|
7417
|
+
/**
|
|
7418
|
+
* Add label text to column of last added note/chord/rest in current measure to given staff/tab/group.
|
|
7419
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
7420
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
7421
|
+
* @param text - label text (e.g. "Am").
|
|
7422
|
+
* @returns - This document builder instance.
|
|
7423
|
+
*/
|
|
7348
7424
|
addLabelTo(staffTabOrGroups, label, text) {
|
|
7349
7425
|
return this.addLabelInternal(staffTabOrGroups, label, text);
|
|
7350
7426
|
}
|
|
@@ -7370,16 +7446,16 @@ var DocumentBuilder = class {
|
|
|
7370
7446
|
return this;
|
|
7371
7447
|
}
|
|
7372
7448
|
/**
|
|
7373
|
-
*
|
|
7449
|
+
* Add extension line to previously added annotation or label element.
|
|
7374
7450
|
* <pre>
|
|
7451
|
+
* // Example
|
|
7375
7452
|
* addExtension(ext => ext.notes("1n", 2)) // length is 2 whole notes
|
|
7376
7453
|
* addExtension(ext => ext.measures(3).hide()) // length is 3 measures, hidden
|
|
7377
7454
|
* addExtension(ext => ext.measures(1).notes("8n")) // length is 1 measure + 1 eigth note
|
|
7378
7455
|
* addExtension(ext => ext.infinity()) // length is as long as possible
|
|
7379
7456
|
* </pre>
|
|
7380
|
-
* @param
|
|
7381
|
-
* @
|
|
7382
|
-
* @returns
|
|
7457
|
+
* @param extensionBuilder - Extension builder function used to build exstension.
|
|
7458
|
+
* @returns - This document builder instance.
|
|
7383
7459
|
*/
|
|
7384
7460
|
addExtension(extensionBuilder) {
|
|
7385
7461
|
assertArg(import_ts_utils_lib13.Utils.Is.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, for e.g. addExtension(ext => ext.measures(2)). Please refer to README or API Reference.", extensionBuilder);
|
|
@@ -7415,11 +7491,11 @@ var DocumentBuilder = class {
|
|
|
7415
7491
|
return this;
|
|
7416
7492
|
}
|
|
7417
7493
|
/**
|
|
7418
|
-
*
|
|
7494
|
+
* Add staff group.
|
|
7419
7495
|
* @param groupName - Name of staff group.
|
|
7420
7496
|
* @param staffsTabsAndGroups - staff/tab index (0=top), staff/tab name, or staff group name. Single value or array.
|
|
7421
7497
|
* @param verticalPosition - Vertical position, are elements added above, below or both.
|
|
7422
|
-
* @returns
|
|
7498
|
+
* @returns - This document builder instance.
|
|
7423
7499
|
*/
|
|
7424
7500
|
addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
|
|
7425
7501
|
assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyString(groupName), "groupName", groupName);
|
|
@@ -7432,24 +7508,48 @@ var DocumentBuilder = class {
|
|
|
7432
7508
|
this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
|
|
7433
7509
|
return this;
|
|
7434
7510
|
}
|
|
7511
|
+
/**
|
|
7512
|
+
* Add song end. Adds certain bar line at the end of measure.
|
|
7513
|
+
* @returns - This document builder instance.
|
|
7514
|
+
*/
|
|
7435
7515
|
endSong() {
|
|
7436
7516
|
this.getMeasure().endSong();
|
|
7437
7517
|
return this;
|
|
7438
7518
|
}
|
|
7519
|
+
/**
|
|
7520
|
+
* Add section end. Adds certain bar line at the end of measure.
|
|
7521
|
+
* @returns - This document builder instance.
|
|
7522
|
+
*/
|
|
7439
7523
|
endSection() {
|
|
7440
7524
|
this.getMeasure().endSection();
|
|
7441
7525
|
return this;
|
|
7442
7526
|
}
|
|
7527
|
+
/**
|
|
7528
|
+
* End current score row. Next measure will start new row.
|
|
7529
|
+
* @returns - This document builder instance.
|
|
7530
|
+
*/
|
|
7443
7531
|
endRow() {
|
|
7444
7532
|
var _a;
|
|
7445
7533
|
(_a = this.doc.getLastMeasure()) == null ? void 0 : _a.endRow();
|
|
7446
7534
|
return this;
|
|
7447
7535
|
}
|
|
7536
|
+
/**
|
|
7537
|
+
* Add rests to fill current measure.
|
|
7538
|
+
* @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
|
|
7539
|
+
* @returns - This document builder instance.
|
|
7540
|
+
*/
|
|
7448
7541
|
completeRests(voiceId) {
|
|
7449
7542
|
assertArg(import_ts_utils_lib13.Utils.Is.isUndefined(voiceId) || isVoiceId(voiceId) || import_ts_utils_lib13.Utils.Is.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)), "voiceId", voiceId);
|
|
7450
7543
|
this.getMeasure().completeRests(voiceId);
|
|
7451
7544
|
return this;
|
|
7452
7545
|
}
|
|
7546
|
+
/**
|
|
7547
|
+
* Add notes of given scale in ascending order.
|
|
7548
|
+
* @param scale - Scale.
|
|
7549
|
+
* @param bottomNote - Scale starts from note >= bottom note.
|
|
7550
|
+
* @param numOctaves - Number of octaves to add.
|
|
7551
|
+
* @returns - This document builder instance.
|
|
7552
|
+
*/
|
|
7453
7553
|
addScaleArpeggio(scale, bottomNote, numOctaves) {
|
|
7454
7554
|
assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
|
|
7455
7555
|
assertArg(import_ts_utils_lib13.Utils.Is.isIntegerGte(numOctaves, 1), "numOctaves", numOctaves);
|
|
@@ -7470,11 +7570,22 @@ var DocumentBuilder = class {
|
|
|
7470
7570
|
// src/score/pub/event.ts
|
|
7471
7571
|
var import_core18 = require("@tspro/web-music-score/core");
|
|
7472
7572
|
var ScoreEvent = class {
|
|
7573
|
+
/**
|
|
7574
|
+
* Create new score event instance.
|
|
7575
|
+
* @param type - Score event type.
|
|
7576
|
+
*/
|
|
7473
7577
|
constructor(type) {
|
|
7474
7578
|
this.type = type;
|
|
7475
7579
|
}
|
|
7476
7580
|
};
|
|
7477
7581
|
var ScoreStaffPosEvent = class extends ScoreEvent {
|
|
7582
|
+
/**
|
|
7583
|
+
* Create new score staff position event.
|
|
7584
|
+
* @param type - Score event type.
|
|
7585
|
+
* @param renderer - Renderer.
|
|
7586
|
+
* @param scoreRow - Score row.
|
|
7587
|
+
* @param diatonicId - Diatonic id that was clicked/entered/left.
|
|
7588
|
+
*/
|
|
7478
7589
|
constructor(type, renderer, scoreRow, diatonicId) {
|
|
7479
7590
|
super(type);
|
|
7480
7591
|
this.renderer = renderer;
|
|
@@ -7483,6 +7594,12 @@ var ScoreStaffPosEvent = class extends ScoreEvent {
|
|
|
7483
7594
|
}
|
|
7484
7595
|
};
|
|
7485
7596
|
var ScoreObjectEvent = class extends ScoreEvent {
|
|
7597
|
+
/**
|
|
7598
|
+
* Create new score object event.
|
|
7599
|
+
* @param type - Score event type.
|
|
7600
|
+
* @param renderer - Renderer.
|
|
7601
|
+
* @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.
|
|
7602
|
+
*/
|
|
7486
7603
|
constructor(type, renderer, objects) {
|
|
7487
7604
|
super(type);
|
|
7488
7605
|
this.renderer = renderer;
|
|
@@ -7491,16 +7608,25 @@ var ScoreObjectEvent = class extends ScoreEvent {
|
|
|
7491
7608
|
throw new import_core18.MusicError(import_core18.MusicErrorType.Score, "Empty array in score object event!");
|
|
7492
7609
|
}
|
|
7493
7610
|
}
|
|
7611
|
+
/** Top object getter. */
|
|
7494
7612
|
get topObject() {
|
|
7495
7613
|
return this.objects[this.objects.length - 1];
|
|
7496
7614
|
}
|
|
7615
|
+
/**
|
|
7616
|
+
* Find object.
|
|
7617
|
+
* @param fn - Compare function.
|
|
7618
|
+
* @returns - First object that matched compare function, or undefined if no match.
|
|
7619
|
+
*/
|
|
7497
7620
|
findObject(fn) {
|
|
7498
7621
|
return this.objects.find((obj) => fn(obj));
|
|
7499
7622
|
}
|
|
7500
7623
|
};
|
|
7501
7624
|
|
|
7502
|
-
// src/score/pub/interface.ts
|
|
7625
|
+
// src/score/pub/music-interface.ts
|
|
7503
7626
|
var Audio2 = __toESM(require("@tspro/web-music-score/audio"));
|
|
7627
|
+
var import_ts_utils_lib15 = require("@tspro/ts-utils-lib");
|
|
7628
|
+
|
|
7629
|
+
// src/score/pub/music-objects.ts
|
|
7504
7630
|
var import_ts_utils_lib14 = require("@tspro/ts-utils-lib");
|
|
7505
7631
|
var import_core19 = require("@tspro/web-music-score/core");
|
|
7506
7632
|
function assertArg2(condition, argName, argValue) {
|
|
@@ -7508,13 +7634,6 @@ function assertArg2(condition, argName, argValue) {
|
|
|
7508
7634
|
throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
7509
7635
|
}
|
|
7510
7636
|
}
|
|
7511
|
-
function require_t(t, message) {
|
|
7512
|
-
if (t === void 0 || t === null) {
|
|
7513
|
-
throw new TypeError(message);
|
|
7514
|
-
} else {
|
|
7515
|
-
return t;
|
|
7516
|
-
}
|
|
7517
|
-
}
|
|
7518
7637
|
function isVoiceId2(value) {
|
|
7519
7638
|
return import_ts_utils_lib14.Utils.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
|
|
7520
7639
|
}
|
|
@@ -7526,9 +7645,17 @@ function getNotationLine(line) {
|
|
|
7526
7645
|
}
|
|
7527
7646
|
}
|
|
7528
7647
|
var MusicInterface6 = class {
|
|
7648
|
+
/**
|
|
7649
|
+
* Create new music interface object.
|
|
7650
|
+
* @param name - OBject name.
|
|
7651
|
+
*/
|
|
7529
7652
|
constructor(name) {
|
|
7530
7653
|
this.name = name;
|
|
7531
7654
|
}
|
|
7655
|
+
/**
|
|
7656
|
+
* Get parent object.
|
|
7657
|
+
* @returns - Parent object or undefined.
|
|
7658
|
+
*/
|
|
7532
7659
|
getParent() {
|
|
7533
7660
|
var _a;
|
|
7534
7661
|
return (_a = this.getMusicObject().getParent()) == null ? void 0 : _a.getMusicInterface();
|
|
@@ -7544,10 +7671,15 @@ var _MAccidental = class _MAccidental extends MusicInterface6 {
|
|
|
7544
7671
|
getMusicObject() {
|
|
7545
7672
|
return this.obj;
|
|
7546
7673
|
}
|
|
7674
|
+
/**
|
|
7675
|
+
* Get accidental.
|
|
7676
|
+
* @returns - Accidental (e.g. 1 = #).
|
|
7677
|
+
*/
|
|
7547
7678
|
getAccidental() {
|
|
7548
7679
|
return this.obj.accidental;
|
|
7549
7680
|
}
|
|
7550
7681
|
};
|
|
7682
|
+
/** Object name. */
|
|
7551
7683
|
__publicField(_MAccidental, "Name", "Accidental");
|
|
7552
7684
|
var MAccidental = _MAccidental;
|
|
7553
7685
|
var _MConnective = class _MConnective extends MusicInterface6 {
|
|
@@ -7561,6 +7693,7 @@ var _MConnective = class _MConnective extends MusicInterface6 {
|
|
|
7561
7693
|
return this.obj;
|
|
7562
7694
|
}
|
|
7563
7695
|
};
|
|
7696
|
+
/** Object name. */
|
|
7564
7697
|
__publicField(_MConnective, "Name", "Connective");
|
|
7565
7698
|
var MConnective = _MConnective;
|
|
7566
7699
|
var _MArpeggio = class _MArpeggio extends MusicInterface6 {
|
|
@@ -7573,13 +7706,22 @@ var _MArpeggio = class _MArpeggio extends MusicInterface6 {
|
|
|
7573
7706
|
getMusicObject() {
|
|
7574
7707
|
return this.obj;
|
|
7575
7708
|
}
|
|
7709
|
+
/**
|
|
7710
|
+
* Get rhythm column this arpeggio is in.
|
|
7711
|
+
* @returns - Rhythm column.
|
|
7712
|
+
*/
|
|
7576
7713
|
getRhythmColumn() {
|
|
7577
7714
|
return this.obj.col.getMusicInterface();
|
|
7578
7715
|
}
|
|
7716
|
+
/**
|
|
7717
|
+
* Get notation line this arpeggio is in.
|
|
7718
|
+
* @returns - Staff or tab object.
|
|
7719
|
+
*/
|
|
7579
7720
|
getNotationLine() {
|
|
7580
7721
|
return getNotationLine(this.obj.line);
|
|
7581
7722
|
}
|
|
7582
7723
|
};
|
|
7724
|
+
/** Object name. */
|
|
7583
7725
|
__publicField(_MArpeggio, "Name", "Arpeggio");
|
|
7584
7726
|
var MArpeggio = _MArpeggio;
|
|
7585
7727
|
var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
|
|
@@ -7593,6 +7735,7 @@ var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
|
|
|
7593
7735
|
return this.obj;
|
|
7594
7736
|
}
|
|
7595
7737
|
};
|
|
7738
|
+
/** OBject name. */
|
|
7596
7739
|
__publicField(_MBeamGroup, "Name", "BeamGroup");
|
|
7597
7740
|
var MBeamGroup = _MBeamGroup;
|
|
7598
7741
|
var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
|
|
@@ -7605,10 +7748,15 @@ var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
|
|
|
7605
7748
|
getMusicObject() {
|
|
7606
7749
|
return this.obj;
|
|
7607
7750
|
}
|
|
7751
|
+
/**
|
|
7752
|
+
* Get staff this beam group is in.
|
|
7753
|
+
* @returns - Staff object.
|
|
7754
|
+
*/
|
|
7608
7755
|
getStaff() {
|
|
7609
7756
|
return this.obj.staff.getMusicInterface();
|
|
7610
7757
|
}
|
|
7611
7758
|
};
|
|
7759
|
+
/** Object name. */
|
|
7612
7760
|
__publicField(_MStaffBeamGroup, "Name", "StaffBeamGroup");
|
|
7613
7761
|
var MStaffBeamGroup = _MStaffBeamGroup;
|
|
7614
7762
|
var _MDocument = class _MDocument extends MusicInterface6 {
|
|
@@ -7621,27 +7769,53 @@ var _MDocument = class _MDocument extends MusicInterface6 {
|
|
|
7621
7769
|
getMusicObject() {
|
|
7622
7770
|
return this.obj;
|
|
7623
7771
|
}
|
|
7772
|
+
/**
|
|
7773
|
+
* Get title.
|
|
7774
|
+
* @returns - Title string or undefined.
|
|
7775
|
+
*/
|
|
7624
7776
|
getTitle() {
|
|
7625
7777
|
return this.obj.getTitle();
|
|
7626
7778
|
}
|
|
7779
|
+
/**
|
|
7780
|
+
* Get composer.
|
|
7781
|
+
* @returns - Composer string or undefined.
|
|
7782
|
+
*/
|
|
7627
7783
|
getComposer() {
|
|
7628
7784
|
return this.obj.getComposer();
|
|
7629
7785
|
3;
|
|
7630
7786
|
}
|
|
7787
|
+
/**
|
|
7788
|
+
* Get arranger.
|
|
7789
|
+
* @returns - Arranger string or undefined.
|
|
7790
|
+
*/
|
|
7631
7791
|
getArranger() {
|
|
7632
7792
|
return this.obj.getArranger();
|
|
7633
7793
|
}
|
|
7794
|
+
/**
|
|
7795
|
+
* Get score rows.
|
|
7796
|
+
* @returns - Array or score rows.
|
|
7797
|
+
*/
|
|
7634
7798
|
getRows() {
|
|
7635
7799
|
return this.obj.getRows().map((r) => r.getMusicInterface());
|
|
7636
7800
|
}
|
|
7801
|
+
/**
|
|
7802
|
+
* Get measures.
|
|
7803
|
+
* @returns - Array of measures.
|
|
7804
|
+
*/
|
|
7637
7805
|
getMeasures() {
|
|
7638
7806
|
return this.obj.getMeasures().map((m) => m.getMusicInterface());
|
|
7639
7807
|
}
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7808
|
+
/**
|
|
7809
|
+
* Play this document.
|
|
7810
|
+
* @param playStateChangeListener - Play state change listener function or undefined.
|
|
7811
|
+
* @returns - Player instance.
|
|
7812
|
+
*/
|
|
7813
|
+
play(playStateChangeListener) {
|
|
7814
|
+
assertArg2(import_ts_utils_lib14.Utils.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
7815
|
+
return new MPlayer(this, playStateChangeListener).play();
|
|
7643
7816
|
}
|
|
7644
7817
|
};
|
|
7818
|
+
/** Object name. */
|
|
7645
7819
|
__publicField(_MDocument, "Name", "Document");
|
|
7646
7820
|
var MDocument2 = _MDocument;
|
|
7647
7821
|
var _MEnding = class _MEnding extends MusicInterface6 {
|
|
@@ -7654,14 +7828,24 @@ var _MEnding = class _MEnding extends MusicInterface6 {
|
|
|
7654
7828
|
getMusicObject() {
|
|
7655
7829
|
return this.obj;
|
|
7656
7830
|
}
|
|
7831
|
+
/**
|
|
7832
|
+
* Get passages.
|
|
7833
|
+
* @returns - Array of passage numbers, e.g. passage number 1 means that this ending is played on first pass.
|
|
7834
|
+
*/
|
|
7657
7835
|
getPassages() {
|
|
7658
7836
|
return this.obj.passages;
|
|
7659
7837
|
}
|
|
7838
|
+
/**
|
|
7839
|
+
* Has passage number?
|
|
7840
|
+
* @param passage - Passage number to find out.
|
|
7841
|
+
* @returns - Boolean whether this ending has asked passage number.
|
|
7842
|
+
*/
|
|
7660
7843
|
hasPassage(passage) {
|
|
7661
7844
|
assertArg2(import_ts_utils_lib14.Utils.Is.isIntegerGte(passage, 1), "passage", passage);
|
|
7662
7845
|
return this.obj.hasPassage(passage);
|
|
7663
7846
|
}
|
|
7664
7847
|
};
|
|
7848
|
+
/** Object name. */
|
|
7665
7849
|
__publicField(_MEnding, "Name", "Ending");
|
|
7666
7850
|
var MEnding = _MEnding;
|
|
7667
7851
|
var _MFermata = class _MFermata extends MusicInterface6 {
|
|
@@ -7675,6 +7859,7 @@ var _MFermata = class _MFermata extends MusicInterface6 {
|
|
|
7675
7859
|
return this.obj;
|
|
7676
7860
|
}
|
|
7677
7861
|
};
|
|
7862
|
+
/** OBject name. */
|
|
7678
7863
|
__publicField(_MFermata, "Name", "Fermata");
|
|
7679
7864
|
var MFermata = _MFermata;
|
|
7680
7865
|
var _MHeader = class _MHeader extends MusicInterface6 {
|
|
@@ -7687,16 +7872,29 @@ var _MHeader = class _MHeader extends MusicInterface6 {
|
|
|
7687
7872
|
getMusicObject() {
|
|
7688
7873
|
return this.obj;
|
|
7689
7874
|
}
|
|
7875
|
+
/**
|
|
7876
|
+
* Get title.
|
|
7877
|
+
* @returns - Title string or undefined.
|
|
7878
|
+
*/
|
|
7690
7879
|
getTitle() {
|
|
7691
7880
|
return this.obj.title;
|
|
7692
7881
|
}
|
|
7882
|
+
/**
|
|
7883
|
+
* Get composer.
|
|
7884
|
+
* @returns - Composer string or undefined.
|
|
7885
|
+
*/
|
|
7693
7886
|
getComposer() {
|
|
7694
7887
|
return this.obj.composer;
|
|
7695
7888
|
}
|
|
7889
|
+
/**
|
|
7890
|
+
* Get arranger.
|
|
7891
|
+
* @returns - Arranger string or undefined.
|
|
7892
|
+
*/
|
|
7696
7893
|
getArranger() {
|
|
7697
7894
|
return this.obj.arranger;
|
|
7698
7895
|
}
|
|
7699
7896
|
};
|
|
7897
|
+
/** OBject name. */
|
|
7700
7898
|
__publicField(_MHeader, "Name", "Header");
|
|
7701
7899
|
var MHeader = _MHeader;
|
|
7702
7900
|
var _MImage = class _MImage extends MusicInterface6 {
|
|
@@ -7710,6 +7908,7 @@ var _MImage = class _MImage extends MusicInterface6 {
|
|
|
7710
7908
|
return this.obj;
|
|
7711
7909
|
}
|
|
7712
7910
|
};
|
|
7911
|
+
/** Object name. */
|
|
7713
7912
|
__publicField(_MImage, "Name", "Image");
|
|
7714
7913
|
var MImage = _MImage;
|
|
7715
7914
|
var _MMeasure = class _MMeasure extends MusicInterface6 {
|
|
@@ -7722,16 +7921,29 @@ var _MMeasure = class _MMeasure extends MusicInterface6 {
|
|
|
7722
7921
|
getMusicObject() {
|
|
7723
7922
|
return this.obj;
|
|
7724
7923
|
}
|
|
7924
|
+
/**
|
|
7925
|
+
* Get measure number.
|
|
7926
|
+
* @returns - Measure number starting from 1, or 0 if upbeat.
|
|
7927
|
+
*/
|
|
7725
7928
|
getMeasureNumber() {
|
|
7726
7929
|
return this.obj.getMeasureNumber();
|
|
7727
7930
|
}
|
|
7931
|
+
/**
|
|
7932
|
+
* Get rhythm columns.
|
|
7933
|
+
* @returns - Array of rhythm columns.
|
|
7934
|
+
*/
|
|
7728
7935
|
getRhythmColumns() {
|
|
7729
7936
|
return this.obj.getColumns().map((col) => col.getMusicInterface());
|
|
7730
7937
|
}
|
|
7938
|
+
/**
|
|
7939
|
+
* Get score row that this measure is in.
|
|
7940
|
+
* @returns - Score row.
|
|
7941
|
+
*/
|
|
7731
7942
|
getRow() {
|
|
7732
7943
|
return this.obj.row.getMusicInterface();
|
|
7733
7944
|
}
|
|
7734
7945
|
};
|
|
7946
|
+
/** OBject name. */
|
|
7735
7947
|
__publicField(_MMeasure, "Name", "Measure");
|
|
7736
7948
|
var MMeasure = _MMeasure;
|
|
7737
7949
|
var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
|
|
@@ -7745,6 +7957,7 @@ var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
|
|
|
7745
7957
|
return this.obj;
|
|
7746
7958
|
}
|
|
7747
7959
|
};
|
|
7960
|
+
/** OBject name. */
|
|
7748
7961
|
__publicField(_MBarLineRight, "Name", "BarLineRight");
|
|
7749
7962
|
var MBarLineRight = _MBarLineRight;
|
|
7750
7963
|
var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
|
|
@@ -7758,6 +7971,7 @@ var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
|
|
|
7758
7971
|
return this.obj;
|
|
7759
7972
|
}
|
|
7760
7973
|
};
|
|
7974
|
+
/** Object name. */
|
|
7761
7975
|
__publicField(_MBarLineLeft, "Name", "BarLineLeft");
|
|
7762
7976
|
var MBarLineLeft = _MBarLineLeft;
|
|
7763
7977
|
var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
@@ -7770,6 +7984,10 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
|
7770
7984
|
getMusicObject() {
|
|
7771
7985
|
return this.obj;
|
|
7772
7986
|
}
|
|
7987
|
+
/**
|
|
7988
|
+
* Get parent bar line object.
|
|
7989
|
+
* @returns - Parent bar line object.
|
|
7990
|
+
*/
|
|
7773
7991
|
getBarLine() {
|
|
7774
7992
|
let barLine = this.obj.barLine;
|
|
7775
7993
|
if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
|
|
@@ -7778,10 +7996,15 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
|
|
|
7778
7996
|
throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Bar line not let nor right.`);
|
|
7779
7997
|
}
|
|
7780
7998
|
}
|
|
7999
|
+
/**
|
|
8000
|
+
* Get staff or tab this bar lien object is in.
|
|
8001
|
+
* @returns - Staff or tab.
|
|
8002
|
+
*/
|
|
7781
8003
|
getNotationLine() {
|
|
7782
8004
|
return getNotationLine(this.obj.line);
|
|
7783
8005
|
}
|
|
7784
8006
|
};
|
|
8007
|
+
/** Object name. */
|
|
7785
8008
|
__publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
|
|
7786
8009
|
var MStaffTabBarLine = _MStaffTabBarLine;
|
|
7787
8010
|
var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
|
|
@@ -7794,19 +8017,36 @@ var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
|
|
|
7794
8017
|
getMusicObject() {
|
|
7795
8018
|
return this.obj;
|
|
7796
8019
|
}
|
|
8020
|
+
/**
|
|
8021
|
+
* Get notes of this note group.
|
|
8022
|
+
* @returns - Array of Note instances.
|
|
8023
|
+
*/
|
|
7797
8024
|
getNotes() {
|
|
7798
8025
|
return this.obj.notes;
|
|
7799
8026
|
}
|
|
8027
|
+
/**
|
|
8028
|
+
* Get rhythm props of this note group.
|
|
8029
|
+
* @returns - Rhythm props.
|
|
8030
|
+
*/
|
|
7800
8031
|
getRhythmProps() {
|
|
7801
8032
|
return this.obj.rhythmProps;
|
|
7802
8033
|
}
|
|
8034
|
+
/**
|
|
8035
|
+
* Get rhythm column this note group is in.
|
|
8036
|
+
* @returns - Rhythm column.
|
|
8037
|
+
*/
|
|
7803
8038
|
getRhythmColumn() {
|
|
7804
8039
|
return this.obj.col.getMusicInterface();
|
|
7805
8040
|
}
|
|
8041
|
+
/**
|
|
8042
|
+
* Get the measure this note group is in.
|
|
8043
|
+
* @returns - Measure.
|
|
8044
|
+
*/
|
|
7806
8045
|
getMeasure() {
|
|
7807
8046
|
return this.obj.measure.getMusicInterface();
|
|
7808
8047
|
}
|
|
7809
8048
|
};
|
|
8049
|
+
/** Object name. */
|
|
7810
8050
|
__publicField(_MNoteGroup, "Name", "NoteGroup");
|
|
7811
8051
|
var MNoteGroup = _MNoteGroup;
|
|
7812
8052
|
var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
|
|
@@ -7819,19 +8059,36 @@ var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
|
|
|
7819
8059
|
getMusicObject() {
|
|
7820
8060
|
return this.obj;
|
|
7821
8061
|
}
|
|
8062
|
+
/**
|
|
8063
|
+
* Get parent note group.
|
|
8064
|
+
* @returns - Parent note group.
|
|
8065
|
+
*/
|
|
7822
8066
|
getNoteGroup() {
|
|
7823
8067
|
return this.obj.noteGroup.getMusicInterface();
|
|
7824
8068
|
}
|
|
8069
|
+
/**
|
|
8070
|
+
* Get rhythm column this note group is in.
|
|
8071
|
+
* @returns - Rhythm column.
|
|
8072
|
+
*/
|
|
7825
8073
|
getRhythmColumn() {
|
|
7826
8074
|
return this.getNoteGroup().getRhythmColumn();
|
|
7827
8075
|
}
|
|
8076
|
+
/**
|
|
8077
|
+
* Get the measure this note group is in.
|
|
8078
|
+
* @returns - Measure.
|
|
8079
|
+
*/
|
|
7828
8080
|
getMeasure() {
|
|
7829
8081
|
return this.getNoteGroup().getMeasure();
|
|
7830
8082
|
}
|
|
8083
|
+
/**
|
|
8084
|
+
* Get staff notation line this note group is in.
|
|
8085
|
+
* @returns - Staff object.
|
|
8086
|
+
*/
|
|
7831
8087
|
getStaff() {
|
|
7832
8088
|
return this.obj.staff.getMusicInterface();
|
|
7833
8089
|
}
|
|
7834
8090
|
};
|
|
8091
|
+
/** Object name. */
|
|
7835
8092
|
__publicField(_MStaffNoteGroup, "Name", "StaffNoteGroup");
|
|
7836
8093
|
var MStaffNoteGroup = _MStaffNoteGroup;
|
|
7837
8094
|
var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
|
|
@@ -7844,19 +8101,36 @@ var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
|
|
|
7844
8101
|
getMusicObject() {
|
|
7845
8102
|
return this.obj;
|
|
7846
8103
|
}
|
|
8104
|
+
/**
|
|
8105
|
+
* Get parent note group.
|
|
8106
|
+
* @returns - Parent note group.
|
|
8107
|
+
*/
|
|
7847
8108
|
getNoteGroup() {
|
|
7848
8109
|
return this.obj.noteGroup.getMusicInterface();
|
|
7849
8110
|
}
|
|
8111
|
+
/**
|
|
8112
|
+
* Get rhythm column this note group is in.
|
|
8113
|
+
* @returns - Rhythm column.
|
|
8114
|
+
*/
|
|
7850
8115
|
getRhythmColumn() {
|
|
7851
8116
|
return this.getNoteGroup().getRhythmColumn();
|
|
7852
8117
|
}
|
|
8118
|
+
/**
|
|
8119
|
+
* Get the measure this note group is in.
|
|
8120
|
+
* @returns - Measure.
|
|
8121
|
+
*/
|
|
7853
8122
|
getMeasure() {
|
|
7854
8123
|
return this.getNoteGroup().getMeasure();
|
|
7855
8124
|
}
|
|
8125
|
+
/**
|
|
8126
|
+
* Get guitar tab this note group is in.
|
|
8127
|
+
* @returns - Tab object.
|
|
8128
|
+
*/
|
|
7856
8129
|
getTab() {
|
|
7857
8130
|
return this.obj.tab.getMusicInterface();
|
|
7858
8131
|
}
|
|
7859
8132
|
};
|
|
8133
|
+
/** OBject name. */
|
|
7860
8134
|
__publicField(_MTabNoteGroup, "Name", "TabNoteGroup");
|
|
7861
8135
|
var MTabNoteGroup = _MTabNoteGroup;
|
|
7862
8136
|
var _MRest = class _MRest extends MusicInterface6 {
|
|
@@ -7869,16 +8143,29 @@ var _MRest = class _MRest extends MusicInterface6 {
|
|
|
7869
8143
|
getMusicObject() {
|
|
7870
8144
|
return this.obj;
|
|
7871
8145
|
}
|
|
8146
|
+
/**
|
|
8147
|
+
* Get rhythm props of this rest.
|
|
8148
|
+
* @returns - Rhythm props.
|
|
8149
|
+
*/
|
|
7872
8150
|
getRhythmProps() {
|
|
7873
8151
|
return this.obj.rhythmProps;
|
|
7874
8152
|
}
|
|
8153
|
+
/**
|
|
8154
|
+
* Get rhythm column this rest is in.
|
|
8155
|
+
* @returns - Rhythm column.
|
|
8156
|
+
*/
|
|
7875
8157
|
getRhythmColumn() {
|
|
7876
8158
|
return this.obj.col.getMusicInterface();
|
|
7877
8159
|
}
|
|
8160
|
+
/**
|
|
8161
|
+
* Get the measure this rest is in.
|
|
8162
|
+
* @returns - Measure.
|
|
8163
|
+
*/
|
|
7878
8164
|
getMeasure() {
|
|
7879
8165
|
return this.obj.measure.getMusicInterface();
|
|
7880
8166
|
}
|
|
7881
8167
|
};
|
|
8168
|
+
/** OBject name. */
|
|
7882
8169
|
__publicField(_MRest, "Name", "Rest");
|
|
7883
8170
|
var MRest = _MRest;
|
|
7884
8171
|
var _MStaffRest = class _MStaffRest extends MusicInterface6 {
|
|
@@ -7891,19 +8178,36 @@ var _MStaffRest = class _MStaffRest extends MusicInterface6 {
|
|
|
7891
8178
|
getMusicObject() {
|
|
7892
8179
|
return this.obj;
|
|
7893
8180
|
}
|
|
8181
|
+
/**
|
|
8182
|
+
* Get parent rest object.
|
|
8183
|
+
* @returns - Parent rest object.
|
|
8184
|
+
*/
|
|
7894
8185
|
getRest() {
|
|
7895
8186
|
return this.obj.rest.getMusicInterface();
|
|
7896
8187
|
}
|
|
8188
|
+
/**
|
|
8189
|
+
* Get rhythm column this rest is in.
|
|
8190
|
+
* @returns - Rhythm column.
|
|
8191
|
+
*/
|
|
7897
8192
|
getRhythmColumn() {
|
|
7898
8193
|
return this.getRest().getRhythmColumn();
|
|
7899
8194
|
}
|
|
8195
|
+
/**
|
|
8196
|
+
* Get the measure this rest is in.
|
|
8197
|
+
* @returns - Measure.
|
|
8198
|
+
*/
|
|
7900
8199
|
getMeasure() {
|
|
7901
8200
|
return this.getRest().getMeasure();
|
|
7902
8201
|
}
|
|
8202
|
+
/**
|
|
8203
|
+
* Get staff notation line this rest is in.
|
|
8204
|
+
* @returns - Staff object.
|
|
8205
|
+
*/
|
|
7903
8206
|
getStaff() {
|
|
7904
8207
|
return this.obj.staff.getMusicInterface();
|
|
7905
8208
|
}
|
|
7906
8209
|
};
|
|
8210
|
+
/** Object name. */
|
|
7907
8211
|
__publicField(_MStaffRest, "Name", "StaffRest");
|
|
7908
8212
|
var MStaffRest = _MStaffRest;
|
|
7909
8213
|
var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
|
|
@@ -7916,19 +8220,36 @@ var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
|
|
|
7916
8220
|
getMusicObject() {
|
|
7917
8221
|
return this.obj;
|
|
7918
8222
|
}
|
|
8223
|
+
/**
|
|
8224
|
+
* Get symbol (note group or rest) of this column for given voice id.
|
|
8225
|
+
* @param voiceId - Voice id.
|
|
8226
|
+
* @returns - Note group, rest or undefined.
|
|
8227
|
+
*/
|
|
7919
8228
|
getRhythmSymbol(voiceId) {
|
|
7920
8229
|
var _a;
|
|
7921
8230
|
assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
|
|
7922
8231
|
return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
|
|
7923
8232
|
}
|
|
8233
|
+
/**
|
|
8234
|
+
* Get symbol (note group or rest) of this column for given voice id.
|
|
8235
|
+
* @deprecated - Use getRhythmSymbol(voiceId) instead.
|
|
8236
|
+
* @param voiceId - Voice id.
|
|
8237
|
+
* @returns - Note group, rest or undefined.
|
|
8238
|
+
*/
|
|
8239
|
+
getVoiceSymbol(voiceId) {
|
|
8240
|
+
var _a;
|
|
8241
|
+
assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
|
|
8242
|
+
return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
|
|
8243
|
+
}
|
|
8244
|
+
/**
|
|
8245
|
+
* Get the measure this rhythm column is in.
|
|
8246
|
+
* @returns - Measure.
|
|
8247
|
+
*/
|
|
7924
8248
|
getMeasure() {
|
|
7925
8249
|
return this.obj.measure.getMusicInterface();
|
|
7926
8250
|
}
|
|
7927
|
-
getVoiceSymbol(voiceId) {
|
|
7928
|
-
let s = this.obj.getVoiceSymbol(voiceId);
|
|
7929
|
-
return s instanceof ObjNoteGroup || s instanceof ObjRest ? s.getMusicInterface() : void 0;
|
|
7930
|
-
}
|
|
7931
8251
|
};
|
|
8252
|
+
/** OBject name. */
|
|
7932
8253
|
__publicField(_MRhythmColumn, "Name", "RhythmColumn");
|
|
7933
8254
|
var MRhythmColumn = _MRhythmColumn;
|
|
7934
8255
|
var _MScoreRow = class _MScoreRow extends MusicInterface6 {
|
|
@@ -7941,16 +8262,29 @@ var _MScoreRow = class _MScoreRow extends MusicInterface6 {
|
|
|
7941
8262
|
getMusicObject() {
|
|
7942
8263
|
return this.obj;
|
|
7943
8264
|
}
|
|
8265
|
+
/**
|
|
8266
|
+
* Parent music document.
|
|
8267
|
+
* @returns - Parent music document.
|
|
8268
|
+
*/
|
|
7944
8269
|
getDocument() {
|
|
7945
8270
|
return this.obj.doc.getMusicInterface();
|
|
7946
8271
|
}
|
|
8272
|
+
/**
|
|
8273
|
+
* Get measures of this score row.
|
|
8274
|
+
* @returns - Array of measures.
|
|
8275
|
+
*/
|
|
7947
8276
|
getMeasures() {
|
|
7948
8277
|
return this.obj.getMeasures().map((m) => m.getMusicInterface());
|
|
7949
8278
|
}
|
|
8279
|
+
/**
|
|
8280
|
+
* Get notation lines (staves and tabs) of this score row.
|
|
8281
|
+
* @returns - Array of staves and tabs.
|
|
8282
|
+
*/
|
|
7950
8283
|
getNotationLines() {
|
|
7951
8284
|
return this.obj.getNotationLines().map((line) => getNotationLine(line));
|
|
7952
8285
|
}
|
|
7953
8286
|
};
|
|
8287
|
+
/** Object name. */
|
|
7954
8288
|
__publicField(_MScoreRow, "Name", "ScoreRow");
|
|
7955
8289
|
var MScoreRow = _MScoreRow;
|
|
7956
8290
|
var _MStaff = class _MStaff extends MusicInterface6 {
|
|
@@ -7963,16 +8297,29 @@ var _MStaff = class _MStaff extends MusicInterface6 {
|
|
|
7963
8297
|
getMusicObject() {
|
|
7964
8298
|
return this.obj;
|
|
7965
8299
|
}
|
|
8300
|
+
/**
|
|
8301
|
+
* Get index of this staff in score row.
|
|
8302
|
+
* @returns - Index (0=top notation line).
|
|
8303
|
+
*/
|
|
7966
8304
|
getId() {
|
|
7967
8305
|
return this.obj.id;
|
|
7968
8306
|
}
|
|
8307
|
+
/**
|
|
8308
|
+
* Get name of this staff.
|
|
8309
|
+
* @returns - Staff name.
|
|
8310
|
+
*/
|
|
7969
8311
|
getName() {
|
|
7970
8312
|
return this.obj.name.length > 0 ? this.obj.name : void 0;
|
|
7971
8313
|
}
|
|
8314
|
+
/**
|
|
8315
|
+
* Get the score row this staff is in.
|
|
8316
|
+
* @returns - Score row.
|
|
8317
|
+
*/
|
|
7972
8318
|
getRow() {
|
|
7973
8319
|
return this.obj.row.getMusicInterface();
|
|
7974
8320
|
}
|
|
7975
8321
|
};
|
|
8322
|
+
/** Object name. */
|
|
7976
8323
|
__publicField(_MStaff, "Name", "Staff");
|
|
7977
8324
|
var MStaff = _MStaff;
|
|
7978
8325
|
var _MTab = class _MTab extends MusicInterface6 {
|
|
@@ -7985,16 +8332,29 @@ var _MTab = class _MTab extends MusicInterface6 {
|
|
|
7985
8332
|
getMusicObject() {
|
|
7986
8333
|
return this.obj;
|
|
7987
8334
|
}
|
|
8335
|
+
/**
|
|
8336
|
+
* Get index of this guitar tab in score row.
|
|
8337
|
+
* @returns - Index (0=top notation line).
|
|
8338
|
+
*/
|
|
7988
8339
|
getId() {
|
|
7989
8340
|
return this.obj.id;
|
|
7990
8341
|
}
|
|
8342
|
+
/**
|
|
8343
|
+
* Get name of this guitar tab.
|
|
8344
|
+
* @returns - Staff name.
|
|
8345
|
+
*/
|
|
7991
8346
|
getName() {
|
|
7992
8347
|
return this.obj.name.length > 0 ? this.obj.name : void 0;
|
|
7993
8348
|
}
|
|
8349
|
+
/**
|
|
8350
|
+
* Get the score row this guitar tab is in.
|
|
8351
|
+
* @returns - Score row.
|
|
8352
|
+
*/
|
|
7994
8353
|
getRow() {
|
|
7995
8354
|
return this.obj.row.getMusicInterface();
|
|
7996
8355
|
}
|
|
7997
8356
|
};
|
|
8357
|
+
/** Object name. */
|
|
7998
8358
|
__publicField(_MTab, "Name", "Tab");
|
|
7999
8359
|
var MTab = _MTab;
|
|
8000
8360
|
var _MSignature = class _MSignature extends MusicInterface6 {
|
|
@@ -8007,10 +8367,15 @@ var _MSignature = class _MSignature extends MusicInterface6 {
|
|
|
8007
8367
|
getMusicObject() {
|
|
8008
8368
|
return this.obj;
|
|
8009
8369
|
}
|
|
8370
|
+
/**
|
|
8371
|
+
* Get staff notation line this signature is in.
|
|
8372
|
+
* @returns - Staff object.
|
|
8373
|
+
*/
|
|
8010
8374
|
getStaff() {
|
|
8011
8375
|
return this.obj.staff.getMusicInterface();
|
|
8012
8376
|
}
|
|
8013
8377
|
};
|
|
8378
|
+
/** Object name. */
|
|
8014
8379
|
__publicField(_MSignature, "Name", "Signature");
|
|
8015
8380
|
var MSignature = _MSignature;
|
|
8016
8381
|
var _MSpecialText = class _MSpecialText extends MusicInterface6 {
|
|
@@ -8023,10 +8388,15 @@ var _MSpecialText = class _MSpecialText extends MusicInterface6 {
|
|
|
8023
8388
|
getMusicObject() {
|
|
8024
8389
|
return this.obj;
|
|
8025
8390
|
}
|
|
8391
|
+
/**
|
|
8392
|
+
* Get text content.
|
|
8393
|
+
* @returns - Text content.
|
|
8394
|
+
*/
|
|
8026
8395
|
getText() {
|
|
8027
8396
|
return this.obj.getText();
|
|
8028
8397
|
}
|
|
8029
8398
|
};
|
|
8399
|
+
/** Object name. */
|
|
8030
8400
|
__publicField(_MSpecialText, "Name", "SpecialText");
|
|
8031
8401
|
var MSpecialText = _MSpecialText;
|
|
8032
8402
|
var _MText = class _MText extends MusicInterface6 {
|
|
@@ -8039,10 +8409,15 @@ var _MText = class _MText extends MusicInterface6 {
|
|
|
8039
8409
|
getMusicObject() {
|
|
8040
8410
|
return this.obj;
|
|
8041
8411
|
}
|
|
8412
|
+
/**
|
|
8413
|
+
* Get text content.
|
|
8414
|
+
* @returns - Text content.
|
|
8415
|
+
*/
|
|
8042
8416
|
getText() {
|
|
8043
8417
|
return this.obj.getText();
|
|
8044
8418
|
}
|
|
8045
8419
|
};
|
|
8420
|
+
/** Object name. */
|
|
8046
8421
|
__publicField(_MText, "Name", "Text");
|
|
8047
8422
|
var MText = _MText;
|
|
8048
8423
|
var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
|
|
@@ -8056,33 +8431,69 @@ var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
|
|
|
8056
8431
|
return this.obj;
|
|
8057
8432
|
}
|
|
8058
8433
|
};
|
|
8434
|
+
/** OBject name. */
|
|
8059
8435
|
__publicField(_MExtensionLine, "Name", "ExtensionLine");
|
|
8060
8436
|
var MExtensionLine = _MExtensionLine;
|
|
8437
|
+
|
|
8438
|
+
// src/score/pub/music-interface.ts
|
|
8439
|
+
var import_core20 = require("@tspro/web-music-score/core");
|
|
8440
|
+
function assertArg3(condition, argName, argValue) {
|
|
8441
|
+
if (!condition) {
|
|
8442
|
+
throw new import_core20.MusicError(import_core20.MusicErrorType.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8445
|
+
function require_t(t, message) {
|
|
8446
|
+
if (t === void 0 || t === null) {
|
|
8447
|
+
throw new TypeError(message);
|
|
8448
|
+
} else {
|
|
8449
|
+
return t;
|
|
8450
|
+
}
|
|
8451
|
+
}
|
|
8061
8452
|
var _MPlayer = class _MPlayer {
|
|
8062
|
-
|
|
8453
|
+
/**
|
|
8454
|
+
* Create new music player.
|
|
8455
|
+
* @param doc - Music document to play.
|
|
8456
|
+
* @param playStateChangeListener - Play state change listener.
|
|
8457
|
+
*/
|
|
8458
|
+
constructor(doc, playStateChangeListener) {
|
|
8063
8459
|
__publicField(this, "player");
|
|
8064
|
-
|
|
8065
|
-
|
|
8460
|
+
assertArg3(doc instanceof MDocument2, "doc", doc);
|
|
8461
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
8066
8462
|
this.player = new Player();
|
|
8067
8463
|
this.player.setDocument(doc.getMusicObject());
|
|
8068
8464
|
this.player.setCursorPositionChangeListener((cursorRect) => doc.getMusicObject().updateCursorRect(cursorRect));
|
|
8069
|
-
if (
|
|
8070
|
-
this.player.setPlayStateChnageListener(
|
|
8465
|
+
if (playStateChangeListener) {
|
|
8466
|
+
this.player.setPlayStateChnageListener(playStateChangeListener);
|
|
8071
8467
|
}
|
|
8072
8468
|
}
|
|
8469
|
+
/**
|
|
8470
|
+
* Stop all playing.
|
|
8471
|
+
*/
|
|
8073
8472
|
static stopAll() {
|
|
8074
8473
|
this.currentlyPlaying.forEach((p) => p.stop());
|
|
8075
8474
|
Audio2.stop();
|
|
8076
8475
|
}
|
|
8476
|
+
/**
|
|
8477
|
+
* Playe attached document.
|
|
8478
|
+
* @returns - This player instance.
|
|
8479
|
+
*/
|
|
8077
8480
|
play() {
|
|
8078
8481
|
_MPlayer.currentlyPlaying.add(this);
|
|
8079
8482
|
this.player.play();
|
|
8080
8483
|
return this;
|
|
8081
8484
|
}
|
|
8485
|
+
/**
|
|
8486
|
+
* Pause playback of attached document.
|
|
8487
|
+
* @returns - This player instance.
|
|
8488
|
+
*/
|
|
8082
8489
|
pause() {
|
|
8083
8490
|
this.player.pause();
|
|
8084
8491
|
return this;
|
|
8085
8492
|
}
|
|
8493
|
+
/**
|
|
8494
|
+
* Stop playback of attached document.
|
|
8495
|
+
* @returns - This player instance.
|
|
8496
|
+
*/
|
|
8086
8497
|
stop() {
|
|
8087
8498
|
this.player.stop();
|
|
8088
8499
|
_MPlayer.currentlyPlaying.delete(this);
|
|
@@ -8092,33 +8503,61 @@ var _MPlayer = class _MPlayer {
|
|
|
8092
8503
|
__publicField(_MPlayer, "currentlyPlaying", /* @__PURE__ */ new Set());
|
|
8093
8504
|
var MPlayer = _MPlayer;
|
|
8094
8505
|
var MRenderer2 = class {
|
|
8506
|
+
/**
|
|
8507
|
+
* Create new renderer instance.
|
|
8508
|
+
*/
|
|
8095
8509
|
constructor() {
|
|
8096
8510
|
__publicField(this, "renderer");
|
|
8097
8511
|
this.renderer = new Renderer(this);
|
|
8098
8512
|
}
|
|
8513
|
+
/**
|
|
8514
|
+
* Attach music document to this renderer.
|
|
8515
|
+
* @param doc - Music document.
|
|
8516
|
+
* @returns - This renderer instance.
|
|
8517
|
+
*/
|
|
8099
8518
|
setDocument(doc) {
|
|
8100
|
-
|
|
8519
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
8101
8520
|
this.renderer.setDocument(doc);
|
|
8102
8521
|
return this;
|
|
8103
8522
|
}
|
|
8523
|
+
/**
|
|
8524
|
+
* Set target canvas html element for this renderer.
|
|
8525
|
+
* @param canvas - HTML canvas element or element id.
|
|
8526
|
+
* @returns - This renderer instance.
|
|
8527
|
+
*/
|
|
8104
8528
|
setCanvas(canvas) {
|
|
8105
|
-
canvas = require_t(
|
|
8529
|
+
canvas = require_t(import_ts_utils_lib15.Utils.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
|
|
8106
8530
|
this.renderer.setCanvas(canvas);
|
|
8107
8531
|
return this;
|
|
8108
8532
|
}
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8533
|
+
/**
|
|
8534
|
+
* Set score event listener.
|
|
8535
|
+
* @param scoreEventListener - Score event listener.
|
|
8536
|
+
*/
|
|
8537
|
+
setScoreEventListener(scoreEventListener) {
|
|
8538
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
|
|
8539
|
+
this.renderer.setScoreEventListener(scoreEventListener);
|
|
8112
8540
|
}
|
|
8541
|
+
/**
|
|
8542
|
+
* Draw given music object hilighted.
|
|
8543
|
+
* @param obj - Music object or undefined to remove hilighting.
|
|
8544
|
+
*/
|
|
8113
8545
|
hilightObject(obj) {
|
|
8114
8546
|
this.renderer.hilightObject(obj == null ? void 0 : obj.getMusicObject());
|
|
8115
8547
|
}
|
|
8548
|
+
/**
|
|
8549
|
+
* Draw given staff position hilighted.
|
|
8550
|
+
* @param staffPos - Staff position (score row and diatonic id) or undefined to remove hilighting.
|
|
8551
|
+
*/
|
|
8116
8552
|
hilightStaffPos(staffPos) {
|
|
8117
8553
|
this.renderer.hilightStaffPos(staffPos ? {
|
|
8118
8554
|
scoreRow: staffPos.scoreRow.getMusicObject(),
|
|
8119
8555
|
diatonicId: staffPos.diatonicId
|
|
8120
8556
|
} : void 0);
|
|
8121
8557
|
}
|
|
8558
|
+
/**
|
|
8559
|
+
* Draw contents of attached music document to attached canvas.
|
|
8560
|
+
*/
|
|
8122
8561
|
draw() {
|
|
8123
8562
|
try {
|
|
8124
8563
|
this.renderer.draw();
|
|
@@ -8129,6 +8568,9 @@ var MRenderer2 = class {
|
|
|
8129
8568
|
}
|
|
8130
8569
|
};
|
|
8131
8570
|
var _MPlaybackButtons = class _MPlaybackButtons {
|
|
8571
|
+
/**
|
|
8572
|
+
* Create new playback buttons helper class instance.
|
|
8573
|
+
*/
|
|
8132
8574
|
constructor() {
|
|
8133
8575
|
__publicField(this, "playButton");
|
|
8134
8576
|
__publicField(this, "stopButton");
|
|
@@ -8161,8 +8603,13 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8161
8603
|
};
|
|
8162
8604
|
this.updateButtons();
|
|
8163
8605
|
}
|
|
8606
|
+
/**
|
|
8607
|
+
* Attach music document whose playcak will be controlled by this playback buttons helper class instance.
|
|
8608
|
+
* @param doc - Music document.
|
|
8609
|
+
* @returns
|
|
8610
|
+
*/
|
|
8164
8611
|
setDocument(doc) {
|
|
8165
|
-
|
|
8612
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
8166
8613
|
this.onStop();
|
|
8167
8614
|
if (doc) {
|
|
8168
8615
|
this.player = new MPlayer(doc, (playState) => {
|
|
@@ -8175,6 +8622,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8175
8622
|
this.updateButtons();
|
|
8176
8623
|
return this;
|
|
8177
8624
|
}
|
|
8625
|
+
/**
|
|
8626
|
+
* Detach attached music document.
|
|
8627
|
+
*/
|
|
8178
8628
|
detachDocument() {
|
|
8179
8629
|
this.setDocument(void 0);
|
|
8180
8630
|
}
|
|
@@ -8196,31 +8646,50 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8196
8646
|
this.pauseButton.innerText = this.pauseLabel;
|
|
8197
8647
|
}
|
|
8198
8648
|
}
|
|
8649
|
+
/**
|
|
8650
|
+
* Set play button.
|
|
8651
|
+
* @param btn - HTML button element or element id.
|
|
8652
|
+
* @param btnLabel - Custom button label (e.g. "Play").
|
|
8653
|
+
* @returns - This playback buttons class instance.
|
|
8654
|
+
*/
|
|
8199
8655
|
setPlayButton(btn, btnLabel) {
|
|
8200
|
-
|
|
8656
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8201
8657
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
|
|
8202
|
-
this.playButton = require_t(
|
|
8658
|
+
this.playButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Play button required!");
|
|
8203
8659
|
this.playLabel = btnLabel != null ? btnLabel : "Play";
|
|
8204
8660
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
|
|
8205
8661
|
_MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
|
|
8206
8662
|
this.updateButtons();
|
|
8207
8663
|
return this;
|
|
8208
8664
|
}
|
|
8665
|
+
/**
|
|
8666
|
+
* Set stop button.
|
|
8667
|
+
* @param btn - HTML button element or element id.
|
|
8668
|
+
* @param btnLabel - Custom button label (e.g. "Stop").
|
|
8669
|
+
* @returns - This playback buttons class instance.
|
|
8670
|
+
*/
|
|
8209
8671
|
setStopButton(btn, btnLabel) {
|
|
8210
|
-
|
|
8672
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8211
8673
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
|
|
8212
|
-
this.stopButton = require_t(
|
|
8674
|
+
this.stopButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Stop button required!");
|
|
8213
8675
|
this.stopLabel = btnLabel != null ? btnLabel : "Stop";
|
|
8214
8676
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
|
|
8215
8677
|
_MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
|
|
8216
8678
|
this.updateButtons();
|
|
8217
8679
|
return this;
|
|
8218
8680
|
}
|
|
8681
|
+
/**
|
|
8682
|
+
* Set play/stop button.
|
|
8683
|
+
* @param btn - HTML button element or element id.
|
|
8684
|
+
* @param playLabel - Custom button label for play action (e.g. "Play").
|
|
8685
|
+
* @param stopLabel - Custom button label for stop action (e.g. "Stop").
|
|
8686
|
+
* @returns - This playback buttons class instance.
|
|
8687
|
+
*/
|
|
8219
8688
|
setPlayStopButton(btn, playLabel, stopLabel) {
|
|
8220
|
-
|
|
8221
|
-
|
|
8689
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
|
|
8690
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
|
|
8222
8691
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
|
|
8223
|
-
this.playStopButton = require_t(
|
|
8692
|
+
this.playStopButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Play/stop button required!");
|
|
8224
8693
|
this.playLabel = playLabel != null ? playLabel : "Play";
|
|
8225
8694
|
this.stopLabel = stopLabel != null ? stopLabel : "Stop";
|
|
8226
8695
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
|
|
@@ -8228,10 +8697,16 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8228
8697
|
this.updateButtons();
|
|
8229
8698
|
return this;
|
|
8230
8699
|
}
|
|
8700
|
+
/**
|
|
8701
|
+
* Set pause button.
|
|
8702
|
+
* @param btn - HTML button element or element id.
|
|
8703
|
+
* @param btnLabel - Custom button label (e.g. "Pause").
|
|
8704
|
+
* @returns - This playback buttons class instance.
|
|
8705
|
+
*/
|
|
8231
8706
|
setPauseButton(btn, btnLabel) {
|
|
8232
|
-
|
|
8707
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
8233
8708
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
|
|
8234
|
-
this.pauseButton = require_t(
|
|
8709
|
+
this.pauseButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Pause button required!");
|
|
8235
8710
|
this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
|
|
8236
8711
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
|
|
8237
8712
|
_MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
|
|
@@ -8253,7 +8728,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
8253
8728
|
}
|
|
8254
8729
|
}
|
|
8255
8730
|
static addOnClickListener(btn, onClick) {
|
|
8256
|
-
|
|
8731
|
+
assertArg3(import_ts_utils_lib15.Utils.Is.isFunction(onClick), "onClick", onClick);
|
|
8257
8732
|
btn.addEventListener("click", onClick);
|
|
8258
8733
|
let clickListeners = this.savedOnClickListeners.get(btn) || [];
|
|
8259
8734
|
this.savedOnClickListeners.set(btn, [...clickListeners, onClick]);
|
|
@@ -8263,8 +8738,8 @@ __publicField(_MPlaybackButtons, "savedOnClickListeners", /* @__PURE__ */ new Ma
|
|
|
8263
8738
|
var MPlaybackButtons = _MPlaybackButtons;
|
|
8264
8739
|
|
|
8265
8740
|
// src/score/index.ts
|
|
8266
|
-
var
|
|
8267
|
-
(0,
|
|
8741
|
+
var import_core21 = require("@tspro/web-music-score/core");
|
|
8742
|
+
(0, import_core21.init)();
|
|
8268
8743
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8269
8744
|
0 && (module.exports = {
|
|
8270
8745
|
Annotation,
|
|
@@ -8273,6 +8748,7 @@ var import_core20 = require("@tspro/web-music-score/core");
|
|
|
8273
8748
|
Connective,
|
|
8274
8749
|
DivRect,
|
|
8275
8750
|
DocumentBuilder,
|
|
8751
|
+
DynamicsAnnotation,
|
|
8276
8752
|
Fermata,
|
|
8277
8753
|
Label,
|
|
8278
8754
|
MAccidental,
|
|
@@ -8314,6 +8790,7 @@ var import_core20 = require("@tspro/web-music-score/core");
|
|
|
8314
8790
|
ScoreStaffPosEvent,
|
|
8315
8791
|
StaffPreset,
|
|
8316
8792
|
Stem,
|
|
8793
|
+
TempoAnnotation,
|
|
8317
8794
|
TieType,
|
|
8318
8795
|
VerticalPosition,
|
|
8319
8796
|
getStringNumbers,
|