App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/swing-1.js view on Meta::CPAN
|| !s.dur) {
if (s.a_meter)
set_dur(s)
continue
}
if ((s.time + anac - a_dur[0]) % beat
&& (s.time + anac - a_dur[1]) % beat) {
s2 = s
continue
}
if (s2 && s2.time + s2.dur == s.time) {
d = s2.dur - (s2.time + s2.dur) % beat + sw[0] * beat
s2.dur = d
for (m = 0; m < s.nhd; m++)
s2.notes[m].dur = d
}
d = s.time + s.dur
s.time = ((s.time / beat | 0) + sw[0] + sw[1]) * beat
if (s.dur > beat / 2 || s.ti1)
d -= s.time
else
d = sw[2] * beat
s.dur = d
for (m = 0; m < s.nhd; m++)
s.notes[m].dur = d
s2 = s
}
}
}, // swing()
set_fmt: function(of, cmd, parm) {
var parse, sw, curvoice, i, s
if (cmd == "playswing") {
parse = this.get_parse(),
curvoice = this.get_curvoice()
sw = /(\d+)\s+(\d+)\s+(\d+)/.exec(parm)
if (sw) {
sw = sw.splice(1)
if (+sw[0] + +sw[1] + +sw[2] > 100)
return abc.syntax(1, "playswing greater than 100%")
for (i = 0; i < 3; i++)
sw[i] = +sw[i] / 100
}
if (parse.state >= 2) {
s = this.new_block("swing")
s.play = s.invis = 1 //true
s.sw = sw
if (sw)
curvoice.swing = 1 //true
} else {
this.cfmt().swing = sw
}
return
}
of(cmd, parm)
}, // set_fmt()
set_hooks: function(abc) {
abc.set_format = abc2svg.swing.set_fmt.bind(abc, abc.set_format)
}
} // swing
if (!abc2svg.mhooks)
abc2svg.mhooks = {}
abc2svg.mhooks.swing = abc2svg.swing.set_hooks
( run in 1.559 second using v1.01-cache-2.11-cpan-2398b32b56e )