App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/jianpu-1.js view on Meta::CPAN
if (!s.next
|| s.next.bar_type
|| s.next.time >= s1.time)
break
s = s.next
}
}
s = s.next
}
} // ov_def()
// output the key and time signatures
function set_head() {
var v, p_v, mt, s2, sk, s,
tsfirst = abc.get_tsfirst()
// search a jianpu voice
for (v = 0; v < voice_tb.length; v++) {
p_v = voice_tb[v]
if (p_v.jianpu)
break
}
if (v >= voice_tb.length)
return
mt = p_v.meter.a_meter[0]
sk = p_v.key
s2 = p_v.sym
s = {
type: C.BLOCK,
subtype: "text",
time: s2.time,
dur: 0,
v: 0,
p_v: p_v,
st: 0,
fmt: s2.fmt,
seqst: true,
text: (sk.k_mode + 1) + "=" +
(abc2svg.jianpu.k_tb[sk.k_sf + 7 +
abc2svg.jianpu.cde2fcg[sk.k_mode]]),
font: abc.get_font("text")
}
if (mt)
s.text += ' ' + (mt.bot ? (mt.top + '/' + mt.bot) : mt.top)
// insert the block after the first %%staves
s2 = tsfirst
s.next = s2.next
if (s.next)
s.next.prev = s
s.prev = s2
s2.next = s
s.ts_next = s2.ts_next
s.ts_next.ts_prev = s
s.ts_prev = s2
s2.ts_next = s
} // set head()
// expand a long note/rest
function slice(s) {
var n, s2, s3,
jn = s.type == C.REST ? 0 : 8 // '0' or '-'
if (s.dur >= C.BLEN)
n = 3
else if (s.dur == C.BLEN / 2)
n = 1
else
n = 2
// duplicate the note/rest for display
s2 = abc.clone(s)
s2.invis =
s2.play = 1 //true
s2.next = s
if (s2.prev)
s2.prev.next = s2
s.prev = s2
s2.ts_next = s
if (s2.ts_prev)
s2.ts_prev.ts_next = s2
s.ts_prev = s2
delete s.seqst
s.noplay = 1 // true
// create the continuation symbols
// s.notes[0].dur =
s.dur = s.dur_orig = C.BLEN / 4
delete s.fmr
while (--n >= 0) {
s2 = {
type: C.REST,
v: s.v,
p_v: s.p_v,
st: s.st,
dur: C.BLEN / 4,
dur_orig: C.BLEN / 4,
fmt: s.fmt,
stem: 0,
multi: 0,
nhd: 0,
notes: [{
dur: s.dur,
pit: s.notes[0].pit,
jn: jn
}],
xmx: 0,
noplay: true,
time: s.time + C.BLEN / 4,
prev: s,
next: s.next
}
s.next = s2
if (s2.next)
s2.next.prev = s2
if (!s.ts_next) {
s.ts_next = s2
if (s.soln)
( run in 1.282 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )