optimize play thread.

This commit is contained in:
StageGuard
2021-07-01 16:33:36 +08:00
parent ee925ccc72
commit 83ec7bd803

View File

@@ -1,3 +1,5 @@
// noinspection JSUnresolvedVariable
"ui"; "ui";
"use strict"; "use strict";
/* /*
@@ -283,8 +285,7 @@ sheetplayer = {
delay += config.values.chordDelay; delay += config.values.chordDelay;
gestureMap.push([delay, 25, keyCoordinates, keyCoordinates]); gestureMap.push([delay, 25, keyCoordinates, keyCoordinates]);
}); });
gestureMap = sheetplayer.toSource(gestureMap); gestures.apply(null, gestureMap);
eval("gestures(" + gestureMap.slice(1, gestureMap.length - 1) + ");");
} }
}); });
while(sheetplayer.playing && sheetplayer.currentNote < sheetplayer.noteCount) { while(sheetplayer.playing && sheetplayer.currentNote < sheetplayer.noteCount) {
@@ -364,24 +365,7 @@ sheetplayer = {
this.bpm = j.bpm; this.bpm = j.bpm;
this.noteCount = this.notes.length; this.noteCount = this.notes.length;
this.keyCount = j.keyCount; this.keyCount = j.keyCount;
}, }
toSource: function(obj) {
var _toJSON = function toJSON(x, lev) {
var p = "", r, i;
if (typeof x == "string") {
return x;
} else if (Array.isArray(x)) {
r = new Array();
for (i = 0; i < x.length; i++) r.push(toJSON(x[i], lev - 1));
p = "[" + r.join(",") + "]";
} else {
p = String(x);
}
return p;
}
return _toJSON(obj, 32);
},
} }
config = { config = {