jpfun 0.1.0
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/LICENSE +201 -0
- package/README.md +134 -0
- package/dist/diagnostic.d.ts +27 -0
- package/dist/diagnostic.js +141 -0
- package/dist/functions/ASTtypes.d.ts +115 -0
- package/dist/functions/ASTtypes.js +187 -0
- package/dist/functions/bar/index.d.ts +2 -0
- package/dist/functions/bar/index.js +180 -0
- package/dist/functions/beam/auto.d.ts +4 -0
- package/dist/functions/beam/auto.js +202 -0
- package/dist/functions/beam/index.d.ts +2 -0
- package/dist/functions/beam/index.js +54 -0
- package/dist/functions/beam/layout.d.ts +9 -0
- package/dist/functions/beam/layout.js +233 -0
- package/dist/functions/box/index.d.ts +2 -0
- package/dist/functions/box/index.js +202 -0
- package/dist/functions/br/index.d.ts +2 -0
- package/dist/functions/br/index.js +83 -0
- package/dist/functions/dash/index.d.ts +2 -0
- package/dist/functions/dash/index.js +61 -0
- package/dist/functions/default.d.ts +2 -0
- package/dist/functions/default.js +32 -0
- package/dist/functions/div/index.d.ts +50 -0
- package/dist/functions/div/index.js +190 -0
- package/dist/functions/dot/index.d.ts +2 -0
- package/dist/functions/dot/index.js +160 -0
- package/dist/functions/grace/index.d.ts +84 -0
- package/dist/functions/grace/index.js +464 -0
- package/dist/functions/key/index.d.ts +2 -0
- package/dist/functions/key/index.js +40 -0
- package/dist/functions/note/accidentals.d.ts +10 -0
- package/dist/functions/note/accidentals.js +60 -0
- package/dist/functions/note/index.d.ts +2 -0
- package/dist/functions/note/index.js +284 -0
- package/dist/functions/note/noteNameFSM.d.ts +8 -0
- package/dist/functions/note/noteNameFSM.js +192 -0
- package/dist/functions/over/index.d.ts +2 -0
- package/dist/functions/over/index.js +307 -0
- package/dist/functions/page/index.d.ts +20 -0
- package/dist/functions/page/index.js +63 -0
- package/dist/functions/set/index.d.ts +2 -0
- package/dist/functions/set/index.js +55 -0
- package/dist/functions/stack/index.d.ts +2 -0
- package/dist/functions/stack/index.js +164 -0
- package/dist/functions/tempo/index.d.ts +2 -0
- package/dist/functions/tempo/index.js +37 -0
- package/dist/functions/text/index.d.ts +2 -0
- package/dist/functions/text/index.js +65 -0
- package/dist/functions/tie/index.d.ts +2 -0
- package/dist/functions/tie/index.js +301 -0
- package/dist/functions/voice/index.d.ts +3 -0
- package/dist/functions/voice/index.js +714 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/layout/default.d.ts +12 -0
- package/dist/layout/default.js +27 -0
- package/dist/layout/engine.d.ts +47 -0
- package/dist/layout/engine.js +410 -0
- package/dist/layout/model.d.ts +73 -0
- package/dist/layout/model.js +422 -0
- package/dist/layout/page.d.ts +27 -0
- package/dist/layout/page.js +121 -0
- package/dist/layout/types.d.ts +197 -0
- package/dist/layout/types.js +1 -0
- package/dist/lowering/loweringContext.d.ts +126 -0
- package/dist/lowering/loweringContext.js +625 -0
- package/dist/lowering/track.d.ts +61 -0
- package/dist/lowering/track.js +35 -0
- package/dist/lowering/types.d.ts +176 -0
- package/dist/lowering/types.js +82 -0
- package/dist/parser/grammarType.d.ts +81 -0
- package/dist/parser/grammarType.js +1 -0
- package/dist/parser/parse-utils/brace-utils.d.ts +1 -0
- package/dist/parser/parse-utils/brace-utils.js +29 -0
- package/dist/parser/parse-utils/call-utils.d.ts +24 -0
- package/dist/parser/parse-utils/call-utils.js +178 -0
- package/dist/parser/parse-utils/label-utils.d.ts +4 -0
- package/dist/parser/parse-utils/label-utils.js +17 -0
- package/dist/parser/parse-utils/length-utils.d.ts +3 -0
- package/dist/parser/parse-utils/length-utils.js +20 -0
- package/dist/parser/parse-utils/note-utils.d.ts +10 -0
- package/dist/parser/parse-utils/note-utils.js +111 -0
- package/dist/parser/parserContext.d.ts +93 -0
- package/dist/parser/parserContext.js +542 -0
- package/dist/parser/preprocess.d.ts +6 -0
- package/dist/parser/preprocess.js +193 -0
- package/dist/parser/types.d.ts +31 -0
- package/dist/parser/types.js +2 -0
- package/dist/pipeline.d.ts +36 -0
- package/dist/pipeline.js +51 -0
- package/dist/render/canvas.d.ts +19 -0
- package/dist/render/canvas.js +121 -0
- package/dist/render/index.d.ts +5 -0
- package/dist/render/index.js +5 -0
- package/dist/render/recording.d.ts +46 -0
- package/dist/render/recording.js +76 -0
- package/dist/render/svg.d.ts +18 -0
- package/dist/render/svg.js +126 -0
- package/dist/render/text.d.ts +6 -0
- package/dist/render/text.js +17 -0
- package/dist/render/types.d.ts +86 -0
- package/dist/render/types.js +1 -0
- package/grammar.md +123 -0
- package/package.json +58 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
import { ASTNodeBase, ASTBraceNode, ASTFunctionNode, ASTTextNode } from "../ASTtypes.js";
|
|
2
|
+
import { Diagnostic, ErrorDiagnostic, WarningDiagnostic } from "../../diagnostic.js";
|
|
3
|
+
import { findRightParen, removeQuote } from "../../parser/parse-utils/call-utils.js";
|
|
4
|
+
import { ParserContext, skipSpaces } from "../../parser/parserContext.js";
|
|
5
|
+
import { isVisualTemporalNode, TemporalNodeBase, } from "../../lowering/types.js";
|
|
6
|
+
const WHITEPACE_RE = /\s/;
|
|
7
|
+
/**
|
|
8
|
+
* voices 块在宿主基线上局部居中:首末两条 voice 基线的中点对齐宿主轴
|
|
9
|
+
*
|
|
10
|
+
* 居中只看**基线**,不看成员的整体视觉边界,也不取所有基线的算术平均值。
|
|
11
|
+
* 因此嵌套的 stack、歌词、装饰只会撑开相邻基线的间距和行高,
|
|
12
|
+
* 不会把整个块相对于主旋律的语义中心挪走。
|
|
13
|
+
*
|
|
14
|
+
* 本行没有实质高度的成员(空声部,或内容都在上一行)仍然占一个默认高度的槽位,
|
|
15
|
+
* 声部数量因而保持稳定,居中结果也不会因为某一声部没写东西而跳变。
|
|
16
|
+
*/
|
|
17
|
+
function makeVoicesArrange(emptySlotHeight) {
|
|
18
|
+
const half = emptySlotHeight / 2;
|
|
19
|
+
return (_host, members, gap) => {
|
|
20
|
+
const extents = members.map(member => member && member.bottom - member.top > 1e-6 ? member : { top: -half, bottom: half });
|
|
21
|
+
const offsets = [];
|
|
22
|
+
let y = 0;
|
|
23
|
+
for (let i = 0; i < extents.length; i++) {
|
|
24
|
+
if (i > 0)
|
|
25
|
+
y += extents[i - 1].bottom + gap - extents[i].top;
|
|
26
|
+
offsets.push(y);
|
|
27
|
+
}
|
|
28
|
+
const center = (offsets[0] + offsets[offsets.length - 1]) / 2;
|
|
29
|
+
return offsets.map((offset, i) => ({ offset: offset - center, extent: extents[i] }));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
class VoiceFunction extends ASTFunctionNode {
|
|
33
|
+
static def = {
|
|
34
|
+
name: ["voice", "v"],
|
|
35
|
+
description: "声部",
|
|
36
|
+
example: `@voice({}, name, 歌词1名=歌词1, 歌词2名=歌词2, ...)
|
|
37
|
+
第一个参数为音符内容,第二个参数为写在最左侧的声部名称(可不填);
|
|
38
|
+
命名参数为歌词左侧的名称和内容,可以任意多个。也可以是位置参数,表示不需要名称。
|
|
39
|
+
例:
|
|
40
|
+
@voice({C1 D1 E1}, 钢琴, 男=ha ha ha, 女=la la la)
|
|
41
|
+
@voice({C1 D1 E1}, , ha ha ha, 女="la la la") 表示音符和第一个歌词都没有名称
|
|
42
|
+
歌词可以被引号包裹,如果包含逗号等歧义字符一定需要引号
|
|
43
|
+
语法糖:
|
|
44
|
+
N(name): C1 D1 E1
|
|
45
|
+
L(name): ha ha ha...
|
|
46
|
+
L: ...
|
|
47
|
+
前面可以有任意空白,但最后换行表示结束。歌词此时允许有逗号而不加引号
|
|
48
|
+
如果一定要换行,最后加上'\\'
|
|
49
|
+
英文歌词用空格和连字符'-'分词,用'@'占位
|
|
50
|
+
`,
|
|
51
|
+
allowExtraArgs: true,
|
|
52
|
+
extraArgType: "string",
|
|
53
|
+
args: [
|
|
54
|
+
{
|
|
55
|
+
type: "content",
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "name",
|
|
60
|
+
type: "string",
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
// 之后的参数都当作歌词参数
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
// 去糖第一阶段识别两个标签 这里先不消费换行符,因为 br 可能需要
|
|
67
|
+
static deSugarAtom(source, start, end) {
|
|
68
|
+
if (source[start] !== 'N' && source[start] !== 'L')
|
|
69
|
+
return null;
|
|
70
|
+
let pos = start + 1;
|
|
71
|
+
let name = '';
|
|
72
|
+
if (source[pos] === '(') {
|
|
73
|
+
// `X(name)` 提取括号
|
|
74
|
+
const at = findRightParen(source, pos + 1, end);
|
|
75
|
+
if (at < 0)
|
|
76
|
+
return null; // 没有找到匹配的右括号 不去糖
|
|
77
|
+
name = removeQuote(source.slice(pos + 1, at).trim());
|
|
78
|
+
pos = at + 1;
|
|
79
|
+
}
|
|
80
|
+
if (source[pos++] !== ':')
|
|
81
|
+
return null; // `:` 之前不允许有空格
|
|
82
|
+
// 识别具体内容
|
|
83
|
+
if (source[start] === 'N') {
|
|
84
|
+
// 等到第二轮寻找该层级的终止符 \n 来确定内容范围
|
|
85
|
+
const node = {
|
|
86
|
+
kind: "sugar",
|
|
87
|
+
data: {
|
|
88
|
+
class: VoiceFunction,
|
|
89
|
+
name,
|
|
90
|
+
},
|
|
91
|
+
span: { start, end: pos },
|
|
92
|
+
};
|
|
93
|
+
return { next: pos, node };
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// 字符串收集
|
|
97
|
+
let lystart = pos = skipSpaces(source, pos, end);
|
|
98
|
+
if (pos >= end)
|
|
99
|
+
return null; // 没有内容了 不去糖
|
|
100
|
+
let lyend = end;
|
|
101
|
+
const quote = source[pos];
|
|
102
|
+
// 双引号才是字符串,单引号不是
|
|
103
|
+
if (quote === '"') {
|
|
104
|
+
// 有引号的 直接以引号为界切分
|
|
105
|
+
lystart = ++pos;
|
|
106
|
+
let escaped = false;
|
|
107
|
+
for (; pos < end; pos++) {
|
|
108
|
+
const ch = source[pos];
|
|
109
|
+
if (escaped)
|
|
110
|
+
escaped = false;
|
|
111
|
+
else if (ch === "\\")
|
|
112
|
+
escaped = true;
|
|
113
|
+
else if (ch === quote)
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
if (pos >= end)
|
|
117
|
+
throw Diagnostic.error.UnterminatedString({
|
|
118
|
+
start: lystart - 1, end
|
|
119
|
+
});
|
|
120
|
+
lyend = pos++; // 跳过结尾引号
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// 没有引号的 以换行符为界切分 预处理已经跳过了转义的换行符了
|
|
124
|
+
for (; pos < end; pos++) {
|
|
125
|
+
if (source[pos] === '\n')
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
lyend = pos;
|
|
129
|
+
}
|
|
130
|
+
const node = {
|
|
131
|
+
kind: "sugar",
|
|
132
|
+
data: {
|
|
133
|
+
class: VoiceFunction,
|
|
134
|
+
lyric: source.slice(lystart, lyend).trim(),
|
|
135
|
+
name,
|
|
136
|
+
},
|
|
137
|
+
span: { start, end: pos },
|
|
138
|
+
};
|
|
139
|
+
return { next: pos, node };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
static deSugarRelation(ctx, nodes, at) {
|
|
143
|
+
const n = nodes[at++];
|
|
144
|
+
if (n.data?.class !== VoiceFunction)
|
|
145
|
+
return null;
|
|
146
|
+
if (n.data?.lyric !== void 0) {
|
|
147
|
+
// 歌词 需要找到最近的voice节点并添加歌词
|
|
148
|
+
let voiceNode = null;
|
|
149
|
+
let voiceNodeAt = ctx.nodes.length - 1;
|
|
150
|
+
for (; voiceNodeAt >= 0; voiceNodeAt--) {
|
|
151
|
+
const n = ctx.nodes[voiceNodeAt];
|
|
152
|
+
if (n instanceof ASTTextNode) {
|
|
153
|
+
if (!ctx.strict)
|
|
154
|
+
continue; // 非严格模式下允许文本节点夹在N和L之间
|
|
155
|
+
// ParserContext.parseGrammar 处理后不会有空白字符
|
|
156
|
+
throw new ErrorDiagnostic("E_LYRICS_WITHOUT_VOICE_NOTES", `strict 模式下,语法糖 'L:' 或 'L(name)' 必须跟在 @voice 的音符之后,但在其前面发现了未知文本`, n.sourceSpan);
|
|
157
|
+
}
|
|
158
|
+
if (n instanceof VoiceFunction)
|
|
159
|
+
voiceNode = n;
|
|
160
|
+
else if (n instanceof VoicesFunction)
|
|
161
|
+
voiceNode = n.voices.at(-1) ?? null;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (voiceNode === null) {
|
|
165
|
+
throw new ErrorDiagnostic("E_LYRICS_WITHOUT_VOICE_NOTES", `语法糖 'L:' 或 'L(name):' 必须跟在 @voice(或 N:)之后,但没有找到符合要求的 voice;请检查语法或直接使用 @voice 函数`, n.span);
|
|
166
|
+
}
|
|
167
|
+
voiceNode.addLyric(n.data.name, n.data.lyric, n.span, ctx);
|
|
168
|
+
ctx.nodes.length = voiceNodeAt + 1; // 清除voiceNodeAt之后的TextNode 因为被夹在N和L之间
|
|
169
|
+
// 消费后面可能的换行符 只消费一个
|
|
170
|
+
if (at < nodes.length && typeof nodes[at] === "number" && ctx.source[nodes[at]] === '\n')
|
|
171
|
+
at++;
|
|
172
|
+
return at;
|
|
173
|
+
}
|
|
174
|
+
// 音符 向后找到第一个 \n 或下一个 voice 组件
|
|
175
|
+
let breakAt = at;
|
|
176
|
+
let endWithBr = 0;
|
|
177
|
+
for (; breakAt < nodes.length; breakAt++) {
|
|
178
|
+
const n = nodes[breakAt];
|
|
179
|
+
if (typeof n === "number") {
|
|
180
|
+
if (ctx.source[n] === '\n') {
|
|
181
|
+
// 换行符应该被 N: 消费
|
|
182
|
+
endWithBr = 1;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if (n.kind === "sugar" && n.data?.class === VoiceFunction)
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
// 解析后面的内容 得到 VoiceFunction
|
|
190
|
+
const newCtx = new ParserContext(ctx);
|
|
191
|
+
const slicedNodes = nodes.slice(at, breakAt); // 防止子解析越界
|
|
192
|
+
breakAt += endWithBr; // 不让子内容有换行符
|
|
193
|
+
newCtx.makeNodes(slicedNodes);
|
|
194
|
+
if (newCtx.nodes.length === 0) {
|
|
195
|
+
throw Diagnostic.error.EmptyContent("voice", "content", n.span);
|
|
196
|
+
}
|
|
197
|
+
const argMap = new Map();
|
|
198
|
+
if (newCtx.nodes.length === 1 && newCtx.nodes[0] instanceof ASTBraceNode)
|
|
199
|
+
argMap.set(0, newCtx.nodes[0]);
|
|
200
|
+
else
|
|
201
|
+
argMap.set(0, new ASTBraceNode(n.span, newCtx.nodes));
|
|
202
|
+
argMap.set("name", n.data.name);
|
|
203
|
+
const newVoice = new VoiceFunction({
|
|
204
|
+
start: n.span.start,
|
|
205
|
+
end: breakAt < nodes.length ? nodes[breakAt] : ctx.source.length
|
|
206
|
+
}, argMap, ctx, null);
|
|
207
|
+
// 如果前面紧挨着 VoicesFunction | VoiceFunction 则直接加入
|
|
208
|
+
let voicesNode = null;
|
|
209
|
+
let voicesNodeAt = ctx.nodes.length - 1;
|
|
210
|
+
let textBetween = null;
|
|
211
|
+
ifCombine: for (; voicesNodeAt >= 0; voicesNodeAt--) {
|
|
212
|
+
const n = ctx.nodes[voicesNodeAt];
|
|
213
|
+
if (n instanceof ASTTextNode) {
|
|
214
|
+
if (ctx.strict)
|
|
215
|
+
break;
|
|
216
|
+
// 如果中间有换行符,直接说明是两个独立的 voice 组件,不能合并
|
|
217
|
+
for (let i = n.sourceSpan.start; i < n.sourceSpan.end; i++) {
|
|
218
|
+
if (ctx.source[i] === '\n')
|
|
219
|
+
break ifCombine;
|
|
220
|
+
}
|
|
221
|
+
textBetween = n;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (n instanceof VoicesFunction) {
|
|
225
|
+
if (!n.createdBySugar)
|
|
226
|
+
break; // 不会合并到函数创建的 voices 中
|
|
227
|
+
voicesNode = n;
|
|
228
|
+
}
|
|
229
|
+
else if (n instanceof VoiceFunction) {
|
|
230
|
+
const args = new Map();
|
|
231
|
+
args.set(0, n);
|
|
232
|
+
voicesNode = new VoicesFunction({
|
|
233
|
+
start: n.sourceSpan.start,
|
|
234
|
+
end: n.sourceSpan.end
|
|
235
|
+
}, args, ctx, null);
|
|
236
|
+
voicesNode.createdBySugar = true;
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
if (voicesNode) {
|
|
241
|
+
ctx.nodes[voicesNodeAt] = voicesNode;
|
|
242
|
+
voicesNode.addVoice(newVoice);
|
|
243
|
+
if (textBetween) {
|
|
244
|
+
ctx.nodes.length = voicesNodeAt + 1;
|
|
245
|
+
ctx.diagnostics.push(new WarningDiagnostic("W_VOICES_TEXT_BETWEEN", `两个 @voice 之间有未知文本。当前处于非 strict 模式,会忽略该内容、合并为一个 @voices`, textBetween.sourceSpan));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else
|
|
249
|
+
ctx.pushNode(newVoice);
|
|
250
|
+
return breakAt;
|
|
251
|
+
}
|
|
252
|
+
content; // 声部内容
|
|
253
|
+
name; // 声部名称
|
|
254
|
+
size; // 声部的字体大小
|
|
255
|
+
lyrics;
|
|
256
|
+
get children() { return [this.content]; }
|
|
257
|
+
timeFlowModel() {
|
|
258
|
+
return {
|
|
259
|
+
children: this.children,
|
|
260
|
+
mode: "sequence",
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* voice 的音符内容仍按普通 sequence 进入全局时间列
|
|
265
|
+
* 此处只建立歌词作用域,并按需在内容前创建声部名对象
|
|
266
|
+
*/
|
|
267
|
+
loweringEnter(ctx) {
|
|
268
|
+
// 无名声部也要产出一个(不可见的)名称事件,才能保证同一个 voices 块内
|
|
269
|
+
// 每个成员的列结构完全一致,从而把所有声部名归并到同一列
|
|
270
|
+
const parent = this.parent;
|
|
271
|
+
// 多声部时同时在名称右侧预留大括号的横向空间
|
|
272
|
+
const braceSpace = parent instanceof VoicesFunction && parent.voices.length > 1
|
|
273
|
+
? parent.braceSpace
|
|
274
|
+
: 0;
|
|
275
|
+
const nameHost = new VoiceNameTemporal(this, braceSpace);
|
|
276
|
+
// 收集范围内的
|
|
277
|
+
const temporalMembers = [];
|
|
278
|
+
ctx.beginLoweringGroup(this, {
|
|
279
|
+
attachment: new VoiceLyricsAttachment(temporalMembers, nameHost),
|
|
280
|
+
onTemporal(node) {
|
|
281
|
+
temporalMembers.push(node);
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
return [nameHost];
|
|
285
|
+
}
|
|
286
|
+
loweringExit(ctx) {
|
|
287
|
+
ctx.endLoweringGroup(this);
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
constructor(span, args, ctx, parent = null) {
|
|
291
|
+
super(span, parent);
|
|
292
|
+
this.size = ctx.fontSize;
|
|
293
|
+
[this.content, this.name] = this.getArgValue(args, ctx);
|
|
294
|
+
this.content.parent = this;
|
|
295
|
+
args.delete(0);
|
|
296
|
+
args.delete("name");
|
|
297
|
+
args.delete(1);
|
|
298
|
+
this.lyrics = [];
|
|
299
|
+
for (const [key, value] of args) {
|
|
300
|
+
if (typeof value === "string") {
|
|
301
|
+
this.addLyric(key, value);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const v = ctx.parseArgWithType(value.start, value.end, "string", span.start);
|
|
305
|
+
if (v === null) {
|
|
306
|
+
ctx.diagnostics.push(new WarningDiagnostic("W_VOICE_INVALID_LYRIC", `@voice 的歌词参数值解析失败, 参数[${key}]将被忽略`, value));
|
|
307
|
+
}
|
|
308
|
+
else
|
|
309
|
+
this.addLyric(key, v);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
addLyric(name, lyric, span = null, ctx = null) {
|
|
313
|
+
if (typeof name === "number")
|
|
314
|
+
name = "";
|
|
315
|
+
const tokens = VoiceFunction.parseLyric(lyric);
|
|
316
|
+
if (tokens.length === 0 && ctx && span) {
|
|
317
|
+
ctx.diagnostics.push(new WarningDiagnostic("W_EMPTY_LYRIC", `@voice的歌词${name}是空的`, span));
|
|
318
|
+
}
|
|
319
|
+
this.lyrics.push({ name, tokens });
|
|
320
|
+
if (span) {
|
|
321
|
+
this.sourceSpan.start = Math.min(span.start, this.sourceSpan.start);
|
|
322
|
+
this.sourceSpan.end = Math.max(span.end, this.sourceSpan.end);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
static parseLyric(value) {
|
|
326
|
+
const result = [];
|
|
327
|
+
let lastPos = 0;
|
|
328
|
+
for (let i = 0; i < value.length; i++) {
|
|
329
|
+
const ch = value[i];
|
|
330
|
+
if (WHITEPACE_RE.test(ch)) {
|
|
331
|
+
if (i > lastPos)
|
|
332
|
+
result.push(value.slice(lastPos, i));
|
|
333
|
+
lastPos = i + 1;
|
|
334
|
+
}
|
|
335
|
+
else if (ch === "-") {
|
|
336
|
+
// 如果前面有内容 则把-放到前一个词里
|
|
337
|
+
if (i > lastPos) {
|
|
338
|
+
result.push(value.slice(lastPos, i + 1));
|
|
339
|
+
lastPos = i + 1;
|
|
340
|
+
}
|
|
341
|
+
else
|
|
342
|
+
lastPos = i; // 把-放到下一个词里
|
|
343
|
+
}
|
|
344
|
+
else if (ch === "@") {
|
|
345
|
+
if (i > lastPos)
|
|
346
|
+
result.push(value.slice(lastPos, i + 1));
|
|
347
|
+
result.push('');
|
|
348
|
+
lastPos = i + 1;
|
|
349
|
+
}
|
|
350
|
+
else if (ch.charCodeAt(0) > 0x7F) {
|
|
351
|
+
// 遇到中文等非ASCII字符 直接切分成单个字符
|
|
352
|
+
if (i > lastPos)
|
|
353
|
+
result.push(value.slice(lastPos, i));
|
|
354
|
+
result.push(ch);
|
|
355
|
+
lastPos = i + 1;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (lastPos < value.length)
|
|
359
|
+
result.push(value.slice(lastPos));
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
toString(source) {
|
|
363
|
+
const notes = this.content.toString(source);
|
|
364
|
+
const lyricStrs = this.lyrics.map(lyric => {
|
|
365
|
+
let lyricstr = lyric.tokens.map(token => token.length === 0 ? "@" : token).join(" ");
|
|
366
|
+
if (lyricstr.includes(",") || lyricstr.includes("\n"))
|
|
367
|
+
lyricstr = `"${lyricstr.replace(/"/g, '\\"')}"`;
|
|
368
|
+
return `${lyric.name ? `${lyric.name}=${lyricstr}` : lyricstr}`;
|
|
369
|
+
});
|
|
370
|
+
return `@voice(\n\t${notes},${this.name},\n\t${lyricStrs.join(",\n\t")}\n)`;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
class VoicesFunction extends ASTFunctionNode {
|
|
374
|
+
static def = {
|
|
375
|
+
name: ["voices", "vs"],
|
|
376
|
+
description: "多个声部",
|
|
377
|
+
example: `@voices(
|
|
378
|
+
@voice({C1 D1 E1}, 钢琴, 男=ha ha ha),
|
|
379
|
+
@voice({C2 D2 E2}, , "la la la")
|
|
380
|
+
)
|
|
381
|
+
语法糖:当多个 voice 用 voice 的语法糖写在一起时,会自动创建一个 voices 组件包裹它们。
|
|
382
|
+
例:
|
|
383
|
+
N(钢琴): C1 D1 E1
|
|
384
|
+
L(男): ha ha ha
|
|
385
|
+
N: C2 D2 E2
|
|
386
|
+
L: la la la
|
|
387
|
+
`,
|
|
388
|
+
allowExtraArgs: true,
|
|
389
|
+
extraArgType: "content",
|
|
390
|
+
args: []
|
|
391
|
+
};
|
|
392
|
+
voices;
|
|
393
|
+
createdBySugar = false; // 不同创建方式的不能合并
|
|
394
|
+
size; // parse 期冻结的字号,px
|
|
395
|
+
/** 声部名右侧为大括号预留的横向空间 */
|
|
396
|
+
braceSpace;
|
|
397
|
+
/** 闭包捕获 parse 期冻结的字号,用来决定空声部槽位的默认高度(1em) */
|
|
398
|
+
arrange;
|
|
399
|
+
get children() { return this.voices; }
|
|
400
|
+
timeFlowModel() {
|
|
401
|
+
return {
|
|
402
|
+
children: this.children,
|
|
403
|
+
mode: "parallel",
|
|
404
|
+
tracks: {
|
|
405
|
+
laneKey: `voices/${this.voices.length}`,
|
|
406
|
+
hostIndex: null, // 宿主不是成员:第一个 voice 也必须拥有独立轨道
|
|
407
|
+
arrange: this.arrange,
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
/** 收集本块产生的声部名事件,退出时注册左侧大括号 */
|
|
412
|
+
loweringEnter(ctx) {
|
|
413
|
+
const names = [];
|
|
414
|
+
ctx.beginLoweringGroup(this, {
|
|
415
|
+
attachment: new VoicesBraceAttachment(names, this),
|
|
416
|
+
onTemporal(node) {
|
|
417
|
+
if (node instanceof VoiceNameTemporal)
|
|
418
|
+
names.push(node);
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
return [];
|
|
422
|
+
}
|
|
423
|
+
loweringExit(ctx) {
|
|
424
|
+
ctx.endLoweringGroup(this);
|
|
425
|
+
return [];
|
|
426
|
+
}
|
|
427
|
+
constructor(span, args, ctx, parent = null) {
|
|
428
|
+
super(span, parent);
|
|
429
|
+
this.voices = [];
|
|
430
|
+
this.size = ctx.fontSize;
|
|
431
|
+
this.braceSpace = ctx.fontSize;
|
|
432
|
+
this.arrange = makeVoicesArrange(ctx.fontSize);
|
|
433
|
+
for (const [, value] of args) {
|
|
434
|
+
if (value instanceof ASTNodeBase) {
|
|
435
|
+
if (value instanceof VoiceFunction)
|
|
436
|
+
this.addVoice(value);
|
|
437
|
+
else {
|
|
438
|
+
throw new ErrorDiagnostic("E_VOICES_INVALID_CHILD", `@voices 的参数必须是 @voice 函数,但发现了其他类型 ${value.constructor.name}`, value instanceof ASTNodeBase ? value.sourceSpan : span);
|
|
439
|
+
}
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
// 是用 SourceSpan 体现的原始参数
|
|
443
|
+
const v = ctx.parseArgWithType(value.start, value.end, "content", span.start);
|
|
444
|
+
if (v instanceof VoiceFunction)
|
|
445
|
+
this.addVoice(v);
|
|
446
|
+
else {
|
|
447
|
+
throw new ErrorDiagnostic("E_VOICES_INVALID_CHILD", `@voices 的参数必须是 @voice 函数,但发现了其他类型 ${v?.constructor.name}`, value);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (this.voices.length === 0) {
|
|
451
|
+
throw new ErrorDiagnostic("E_VOICES_EMPTY", `@voices 必须至少包含一个 @voice 函数`, span);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
addVoice(v) {
|
|
455
|
+
this.voices.push(v);
|
|
456
|
+
v.parent = this;
|
|
457
|
+
this.sourceSpan.start = Math.min(v.sourceSpan.start, this.sourceSpan.start);
|
|
458
|
+
this.sourceSpan.end = Math.max(v.sourceSpan.end, this.sourceSpan.end);
|
|
459
|
+
}
|
|
460
|
+
toString(source) {
|
|
461
|
+
const voicelines = Array(this.voices.length);
|
|
462
|
+
for (let i = 0; i < this.voices.length; i++) {
|
|
463
|
+
const part = this.voices[i].toString(source).replace(/^/gm, "\t");
|
|
464
|
+
voicelines[i] = part;
|
|
465
|
+
}
|
|
466
|
+
return `@voices(\n${voicelines.join(",\n")}\n)`;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
export const VoiceNode = VoiceFunction;
|
|
470
|
+
export const VoicesNode = VoicesFunction;
|
|
471
|
+
/** 歌词与歌词行名称相对声部字号的字号 */
|
|
472
|
+
const LYRIC_SIZE_RATIO = 0.82;
|
|
473
|
+
/** 无大括号时标签右侧的空隙,相对声部字号 */
|
|
474
|
+
const NAME_GAP_RATIO = 0.6;
|
|
475
|
+
/** 歌词行名称的宽度决定标签列宽度,因此声部名事件和歌词附件必须用同一个样式测量 */
|
|
476
|
+
function lyricNameStyle(size) {
|
|
477
|
+
return {
|
|
478
|
+
fontSize: size * LYRIC_SIZE_RATIO,
|
|
479
|
+
fill: "#000",
|
|
480
|
+
fontWeight: 600,
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
class VoiceNameTemporal extends TemporalNodeBase {
|
|
484
|
+
/** 名称右侧为大括号预留的横向空间,0 表示不需要 */
|
|
485
|
+
braceSpace;
|
|
486
|
+
textBaselineY = 0;
|
|
487
|
+
constructor(ast, braceSpace) {
|
|
488
|
+
super();
|
|
489
|
+
this.ast = ast;
|
|
490
|
+
this.braceSpace = braceSpace;
|
|
491
|
+
this.T = 0;
|
|
492
|
+
// 同一个 voices 块里每个成员都会产生本事件,列结构对称,
|
|
493
|
+
// 因此可以安全地归并成一列并右对齐;
|
|
494
|
+
// 独立的 @voice 与相邻分支不对称,必须单独成列,否则会把同时刻的音符挤到下一列
|
|
495
|
+
this.type = ast.parent instanceof VoicesFunction ? 2 /* ColType.DEFAULT */ : 1 /* ColType.SINGLE */;
|
|
496
|
+
// 既没有名称、也不需要括号空间和标签列时只保留不可见的占位事件:
|
|
497
|
+
// 它不进入可见对象,也不让空声部失去默认槽位高度
|
|
498
|
+
if (ast.name || braceSpace > 0 || ast.lyrics.some(lyric => lyric.name))
|
|
499
|
+
this.initLayoutBox();
|
|
500
|
+
}
|
|
501
|
+
prepareLayout(context) {
|
|
502
|
+
const metrics = this.ast.name
|
|
503
|
+
? context.textMeasurer.measureText(this.ast.name, this.style)
|
|
504
|
+
: { w: 0, h: 0, baseline: 0 };
|
|
505
|
+
// 声部名和歌词行名称共用这一列,列宽取其中最宽的一个
|
|
506
|
+
let labelWidth = metrics.w;
|
|
507
|
+
for (const lyric of this.ast.lyrics) {
|
|
508
|
+
if (!lyric.name)
|
|
509
|
+
continue;
|
|
510
|
+
const lyricMetrics = context.textMeasurer.measureText(lyric.name, lyricNameStyle(this.ast.size));
|
|
511
|
+
labelWidth = Math.max(labelWidth, lyricMetrics.w);
|
|
512
|
+
}
|
|
513
|
+
// 没有大括号时也要在标签右侧留出与内容分离的空隙
|
|
514
|
+
const rightSpace = this.braceSpace > 0 ? this.braceSpace
|
|
515
|
+
: labelWidth > 0 ? this.ast.size * NAME_GAP_RATIO : 0;
|
|
516
|
+
// 对齐点放在标签右边界:同一列共享 `x + anchor`,因此长短不一的声部名会右对齐,
|
|
517
|
+
// 括号空间统一落在对齐点右侧
|
|
518
|
+
this.box.w = labelWidth + rightSpace;
|
|
519
|
+
this.box.h = metrics.h;
|
|
520
|
+
this.box.anchor = labelWidth;
|
|
521
|
+
this.box.visualAxis = metrics.h / 2;
|
|
522
|
+
this.textBaselineY = metrics.baseline;
|
|
523
|
+
// 声部名与第一个音符之间需要稳定但可压缩的横向间距
|
|
524
|
+
this.springConfig.alpha_R = 0.45;
|
|
525
|
+
}
|
|
526
|
+
get style() {
|
|
527
|
+
return {
|
|
528
|
+
fontSize: this.ast.size * 0.85,
|
|
529
|
+
fill: "#000",
|
|
530
|
+
fontWeight: 600,
|
|
531
|
+
textAlign: "right",
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
paint(painter) {
|
|
535
|
+
if (!this.ast.name)
|
|
536
|
+
return;
|
|
537
|
+
painter.drawText(this.ast.name, this.box.x + this.box.anchor, this.box.y + this.textBaselineY, this.style);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
/** 括线端头的小钩;单位尺寸,绘制时按粗竖线宽度缩放并上下镜像 */
|
|
541
|
+
const BRACE_HOOK_REACH = 2.33;
|
|
542
|
+
const BRACE_HOOK_DROP = 1.17;
|
|
543
|
+
const BRACE_HOOK_BASE = 0.34;
|
|
544
|
+
const BRACE_HOOK_COMMANDS = [
|
|
545
|
+
{ op: "M", x: 0, y: 0 },
|
|
546
|
+
{ op: "L", x: 0, y: -BRACE_HOOK_BASE },
|
|
547
|
+
{
|
|
548
|
+
op: "C",
|
|
549
|
+
cx1: BRACE_HOOK_REACH * 0.421, cy1: -BRACE_HOOK_BASE + BRACE_HOOK_DROP * 0.077,
|
|
550
|
+
cx2: BRACE_HOOK_REACH * 0.733, cy2: -BRACE_HOOK_BASE + BRACE_HOOK_DROP * 0.346,
|
|
551
|
+
x: BRACE_HOOK_REACH, y: -BRACE_HOOK_BASE + BRACE_HOOK_DROP,
|
|
552
|
+
},
|
|
553
|
+
{ op: "L", x: BRACE_HOOK_REACH * 0.929, y: -BRACE_HOOK_BASE + BRACE_HOOK_DROP },
|
|
554
|
+
{
|
|
555
|
+
op: "C",
|
|
556
|
+
cx1: BRACE_HOOK_REACH * 0.696, cy1: -BRACE_HOOK_BASE + BRACE_HOOK_DROP * 0.535,
|
|
557
|
+
cx2: BRACE_HOOK_REACH * 0.328, cy2: -BRACE_HOOK_BASE + BRACE_HOOK_DROP * 0.352,
|
|
558
|
+
x: 0, y: 0,
|
|
559
|
+
},
|
|
560
|
+
{ op: "Z" },
|
|
561
|
+
];
|
|
562
|
+
/**
|
|
563
|
+
* 画在声部名与音符之间的多声部括线
|
|
564
|
+
*
|
|
565
|
+
* 由一条粗竖线、一条略向内收的细竖线和两端的小钩组成。
|
|
566
|
+
* 纵向跨度直接取首末声部名事件的视觉轴(无名声部的占位盒高度为 0,其 y 就是轨道视觉轴),
|
|
567
|
+
* 因此不需要反查任何轨道信息。
|
|
568
|
+
*/
|
|
569
|
+
class VoicesBraceAttachment {
|
|
570
|
+
box = { x: 0, y: 0, w: 0, h: 0 };
|
|
571
|
+
layer = "background";
|
|
572
|
+
names;
|
|
573
|
+
ast;
|
|
574
|
+
bars = [];
|
|
575
|
+
hooks = [];
|
|
576
|
+
constructor(names, ast) {
|
|
577
|
+
this.names = names;
|
|
578
|
+
this.ast = ast;
|
|
579
|
+
}
|
|
580
|
+
layout() {
|
|
581
|
+
this.bars = [];
|
|
582
|
+
this.hooks = [];
|
|
583
|
+
if (this.names.length < 2)
|
|
584
|
+
return [];
|
|
585
|
+
const first = this.names[0].box;
|
|
586
|
+
const last = this.names[this.names.length - 1].box;
|
|
587
|
+
const em = this.ast.size;
|
|
588
|
+
const top = first.y + first.visualAxis - em * 0.5;
|
|
589
|
+
const bottom = last.y + last.visualAxis + em * 0.5;
|
|
590
|
+
if (bottom - top < 1e-6)
|
|
591
|
+
return [];
|
|
592
|
+
// 各部分尺寸都以粗竖线宽度为单位,比例取自常见简谱软件的括线
|
|
593
|
+
const stem = Math.max(2.5, em * 0.19);
|
|
594
|
+
const reach = stem * BRACE_HOOK_REACH;
|
|
595
|
+
const drop = stem * BRACE_HOOK_DROP;
|
|
596
|
+
const x = first.x + first.anchor + this.ast.braceSpace * 0.3 + stem / 2;
|
|
597
|
+
this.bars = [
|
|
598
|
+
{ x: x - stem / 2, y: top, w: stem, h: bottom - top },
|
|
599
|
+
{
|
|
600
|
+
x: x + stem * 1.33 - stem * 0.165,
|
|
601
|
+
y: top + stem * 0.67,
|
|
602
|
+
w: stem * 0.33,
|
|
603
|
+
h: bottom - top - stem * 1.34,
|
|
604
|
+
},
|
|
605
|
+
];
|
|
606
|
+
this.hooks = [
|
|
607
|
+
{ x, y: top, scale: stem, dir: -1 },
|
|
608
|
+
{ x, y: bottom, scale: stem, dir: 1 },
|
|
609
|
+
];
|
|
610
|
+
// 括线画在声部名左侧的空白里,只参与画布边界,不抢任何轨道的纵向空间
|
|
611
|
+
return [{
|
|
612
|
+
x: x - stem / 2,
|
|
613
|
+
y: top - drop,
|
|
614
|
+
w: reach + stem / 2,
|
|
615
|
+
h: bottom - top + drop * 2,
|
|
616
|
+
}];
|
|
617
|
+
}
|
|
618
|
+
paint(painter) {
|
|
619
|
+
for (const bar of this.bars) {
|
|
620
|
+
painter.drawRect(bar.x, bar.y, bar.w, bar.h, { fill: "#000" });
|
|
621
|
+
}
|
|
622
|
+
for (const hook of this.hooks) {
|
|
623
|
+
painter.drawPath(BRACE_HOOK_COMMANDS, { fill: "#000" }, { x: hook.x, y: hook.y, scaleX: hook.scale, scaleY: hook.scale * hook.dir });
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
class VoiceLyricsAttachment {
|
|
628
|
+
box = { x: 0, y: 0, w: 0, h: 0 };
|
|
629
|
+
layer = "foreground";
|
|
630
|
+
/** lowering 会持续向这个数组加入 voice 内容产生的 temporal */
|
|
631
|
+
temporalMembers;
|
|
632
|
+
/** 同一个 voice 的声部名事件,歌词行名称向它的对齐点右对齐 */
|
|
633
|
+
nameHost;
|
|
634
|
+
preparedText = [];
|
|
635
|
+
constructor(temporalMembers, nameHost) {
|
|
636
|
+
this.temporalMembers = temporalMembers;
|
|
637
|
+
this.nameHost = nameHost;
|
|
638
|
+
}
|
|
639
|
+
layout(context) {
|
|
640
|
+
this.updateGeometry(context);
|
|
641
|
+
// 同一行同一轨的多行歌词由引擎合并成一段占用
|
|
642
|
+
return this.preparedText;
|
|
643
|
+
}
|
|
644
|
+
paint(painter) {
|
|
645
|
+
for (const item of this.preparedText) {
|
|
646
|
+
painter.drawText(item.text, item.x, item.y + item.textBaselineY, item.style);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
updateGeometry(context) {
|
|
650
|
+
const { lyrics, size } = this.nameHost.ast;
|
|
651
|
+
this.preparedText.length = 0;
|
|
652
|
+
const targets = this.temporalMembers
|
|
653
|
+
.filter(isVisualTemporalNode)
|
|
654
|
+
.filter(node => node.ports?.["lyric"]);
|
|
655
|
+
if (targets.length === 0 || lyrics.length === 0)
|
|
656
|
+
return;
|
|
657
|
+
// 每个 system+track 的歌词共用一条基线
|
|
658
|
+
// 装饰高度先汇总为下边界,不进入单个 token 的 y 计算
|
|
659
|
+
const contentBottom = new Map();
|
|
660
|
+
for (const target of targets) {
|
|
661
|
+
let byTrack = contentBottom.get(target.layoutLine);
|
|
662
|
+
if (!byTrack)
|
|
663
|
+
contentBottom.set(target.layoutLine, byTrack = new Map());
|
|
664
|
+
const bottom = target.box.y + target.box.h;
|
|
665
|
+
byTrack.set(target.track, Math.max(byTrack.get(target.track) ?? bottom, bottom));
|
|
666
|
+
}
|
|
667
|
+
const fontSize = size * LYRIC_SIZE_RATIO;
|
|
668
|
+
const rowGap = size * 0.24;
|
|
669
|
+
const firstRowGap = size * 0.32;
|
|
670
|
+
const lyricStyle = { fontSize, fill: "#000" };
|
|
671
|
+
const nameStyle = lyricNameStyle(size);
|
|
672
|
+
const baselineOffset = context.textMeasurer.measureText("M", lyricStyle).baseline + firstRowGap;
|
|
673
|
+
const baselineOf = (bottom, row) => bottom + baselineOffset + row * (fontSize + rowGap);
|
|
674
|
+
// 歌词行名称与声部名共用左侧那一列,因此只出现在声部名所在的那一行
|
|
675
|
+
const { box: labelBox, layoutLine: labelLine, track: labelTrack } = this.nameHost;
|
|
676
|
+
const labelBottom = contentBottom.get(labelLine)?.get(labelTrack);
|
|
677
|
+
for (let row = 0; row < lyrics.length; row++) {
|
|
678
|
+
const lyric = lyrics[row];
|
|
679
|
+
for (let i = 0; i < lyric.tokens.length && i < targets.length; i++) {
|
|
680
|
+
const text = lyric.tokens[i];
|
|
681
|
+
const target = targets[i];
|
|
682
|
+
const bottom = contentBottom.get(target.layoutLine)?.get(target.track);
|
|
683
|
+
if (!text || bottom === undefined)
|
|
684
|
+
continue;
|
|
685
|
+
const metrics = context.textMeasurer.measureText(text, lyricStyle);
|
|
686
|
+
this.preparedText.push({
|
|
687
|
+
text,
|
|
688
|
+
style: lyricStyle,
|
|
689
|
+
textBaselineY: metrics.baseline,
|
|
690
|
+
x: target.box.x + target.ports["lyric"].x - metrics.w / 2,
|
|
691
|
+
y: baselineOf(bottom, row) - metrics.baseline,
|
|
692
|
+
w: metrics.w,
|
|
693
|
+
h: metrics.h,
|
|
694
|
+
line: target.layoutLine,
|
|
695
|
+
track: target.track,
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
if (!lyric.name || !labelBox || labelBottom === undefined)
|
|
699
|
+
continue;
|
|
700
|
+
const metrics = context.textMeasurer.measureText(lyric.name, nameStyle);
|
|
701
|
+
this.preparedText.push({
|
|
702
|
+
text: lyric.name,
|
|
703
|
+
style: nameStyle,
|
|
704
|
+
textBaselineY: metrics.baseline,
|
|
705
|
+
x: labelBox.x + labelBox.anchor - metrics.w,
|
|
706
|
+
y: baselineOf(labelBottom, row) - metrics.baseline,
|
|
707
|
+
w: metrics.w,
|
|
708
|
+
h: metrics.h,
|
|
709
|
+
line: labelLine,
|
|
710
|
+
track: labelTrack,
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|