133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
0, // tempo
0, // (free)
0, // block
0 // remark
])
function sort_all() {
var s, s2, time, w, wmin, ir, fmt,
var s, s2, time, w, wmin, ir, fmt, v, p_voice, prev,
fl, new_sy,
nv = voice_tb.length,
vtb = [],
vn = [], // voice indexed by range
sy = cur_sy, // first staff system
sy = cur_sy // first staff system
v = sy.top_voice,
p_voice = voice_tb[v], // top voice
prev = { // symbol defining the first staff system
type: C.STAVES,
dur: 0,
v: v,
p_v: p_voice,
time: 0,
st: 0,
sy: sy,
next: p_voice.sym,
seqst: true
}
if (!p_voice.sym)
return
// check if different bars at the same time
function b_chk() {
var bt, s, s2, v, tim,
ir = 0
while (1) {
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
|
}
} else {
error(1, s, "Different bars $1 and $2",
bt, s.bar_type)
}
} // b_chk()
prev.fmt = fmt = p_voice.sym.fmt // starting format
// set the first symbol of each voice
for (v = 0; v < nv; v++) {
s = voice_tb[v].sym
vtb[v] = s
if (sy.voices[v])
if (sy.voices[v]) {
vn[sy.voices[v].range] = v
if (!prev && s) {
fmt = s.fmt
p_voice = voice_tb[v]
prev = { // symbol defining the first staff system
type: C.STAVES,
dur: 0,
v: v,
p_v: p_voice,
time: 0,
st: 0,
sy: sy,
next: s,
fmt: fmt,
seqst: true
}
// insert the first staff system in the top voice
}
}
}
}
if (!prev)
return // no symbol yet
// insert the first staff system in the first voice
p_voice.sym = tsfirst = s = prev
if (s.next)
s.next.prev = s
else
p_voice.last_sym = s
// if Q: from tune header, put it at start of the music
|