update demos to for latest libraries

This commit is contained in:
Michael Deal 2012-11-21 01:29:46 -08:00
parent a50ca64600
commit 26f6e8a031
3 changed files with 52 additions and 46 deletions

View file

@ -66,7 +66,7 @@ RefreshFrame = function () {
var len = circleRadius * (1 + 1.0 / nbrPoints - r);
if (Math.floor(a / PI2) !== Math.floor(tines[i] / PI2)) {
MIDI.noteOn(0, i + 21, 100, 0);
MIDI.noteOn(0, i + 21 + 36, 100, 0);
MIDI.noteOn(24, i + 21 + 36, 100, 0);
lastSound[i] = ms;
}
var x = (cx + Math.cos(a) * len);
@ -85,22 +85,25 @@ RefreshFrame = function () {
};
window.onload = function () {
MIDI.loadPlugin(function() {
loader.stop();
var canvas = document.getElementById('mycanvas');
canvas.style.width = gw + "px";
canvas.style.width = gw + "px";
canvas.width = gw;
canvas.height = gh;
dc = canvas.getContext('2d');
for (var i = 0; i < nbrPoints; ++i) {
if (i % 7 === 0) MIDI.noteOn(0, i + 21, 100, 0);
lastSound[i] = 0;
tines[i] = 0;
MIDI.loadPlugin({
instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
callback: function() {
loader.stop();
var canvas = document.getElementById('mycanvas');
canvas.style.width = gw + "px";
canvas.style.width = gw + "px";
canvas.width = gw;
canvas.height = gh;
dc = canvas.getContext('2d');
for (var i = 0; i < nbrPoints; ++i) {
if (i % 7 === 0) MIDI.noteOn(0, i + 21, 100, 0);
lastSound[i] = 0;
tines[i] = 0;
}
startTime = (new Date()).getTime();
setInterval(RefreshFrame, 1000 / 30);
}
startTime = (new Date()).getTime();
setInterval(RefreshFrame, 1000 / 30);
});
});
};
var loader = new widgets.Loader({