App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/perc-1.js view on Meta::CPAN
if (!pit)
return
}
}
p = ["C","^C","D","_E","E","F","^F","G","^G","A","_B","B"][pit % 12]
while (pit < 60) {
p += ','
pit += 12
}
while (pit >= 72) {
p += "'"
pit -= 12
}
return p
} // toabc()
// do_perc()
var a = parm.split(/\s+/),
p = a[1].replace(/[=_^]/, '')
this.do_pscom("map MIDIdrum " + a[1] +
" play=" + toabc(a[2]) +
" print=" + p +
(a[3] ? (" heads=" + a[3]) : ''))
this.set_v_param("perc", "MIDIdrum")
}, // do_perc()
// set the MIDI parameters in the current voice
set_perc: function(a) {
var i, item, s,
curvoice = this.get_curvoice()
for (i = 0; i < a.length; i++) {
switch (a[i]) {
case "perc=": // %%percmap
if (!curvoice.map)
curvoice.map = {}
curvoice.map = a[i + 1];
s = this.new_block("midiprog")
s.play = s.invis = 1 //true
curvoice.chn = s.chn = 9 // channel 10
break
}
}
}, // set_perc()
do_pscom: function(of, text) {
if (text.slice(0, 8) == "percmap ")
abc2svg.perc.do_perc.call(this, text)
else
of(text)
},
set_vp: function(of, a) {
abc2svg.perc.set_perc.call(this, a);
of(a)
},
set_hooks: function(abc) {
abc.do_pscom = abc2svg.perc.do_pscom.bind(abc, abc.do_pscom);
abc.set_vp = abc2svg.perc.set_vp.bind(abc, abc.set_vp)
}
} // perc
if (!abc2svg.mhooks)
abc2svg.mhooks = {}
abc2svg.mhooks.perc = abc2svg.perc.set_hooks
( run in 1.328 second using v1.01-cache-2.11-cpan-2398b32b56e )