diff --git a/lib/encoder.js b/lib/encoder.js index ee51cf7..1614376 100644 --- a/lib/encoder.js +++ b/lib/encoder.js @@ -112,8 +112,6 @@ class Encoder { // Now trigger all MIDI actions for (var i = 0; i < this.midiactions.length; i++) { - console.log("DOING "+this.val); - this.midiactions[i].trigger(this.val); } } diff --git a/lib/midi.js b/lib/midi.js index 352a25b..f28c970 100644 --- a/lib/midi.js +++ b/lib/midi.js @@ -159,7 +159,7 @@ class MidiAction { } trigger(value) { - console.log(this) + //console.log(this) switch (this.type) { case "note": if(this.on) { diff --git a/lib/touchmidi.js b/lib/touchmidi.js index 551ab7c..70a88c9 100644 --- a/lib/touchmidi.js +++ b/lib/touchmidi.js @@ -103,7 +103,7 @@ function init() { let storedval = getWidgetValue(pad); if(storedval) { pad.xval = storedval.split('|')[0]; - pad.yval = storedval.split('|')[0]; + pad.yval = storedval.split('|')[1]; widgets_with_saved_vals.push(pad); } } @@ -347,7 +347,12 @@ function saveWidgetValue(widget) { if(widget.no_save) return; var filename = window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1); let id = hashCode(`${widget.constructor.name}_${widget.midiactions[0]}`); - localStorage.setItem(`touchmidi.${filename}.${id}`, widget.val); + + if(widget.constructor.name.toLowerCase() == 'xypad') { + localStorage.setItem(`touchmidi.${filename}.${id}`, `${widget.xval}|${widget.yval}`); + } else { + localStorage.setItem(`touchmidi.${filename}.${id}`, widget.val); + } } // ============================================================================= diff --git a/lib/xypad.js b/lib/xypad.js index 34ba417..b4ccf79 100644 --- a/lib/xypad.js +++ b/lib/xypad.js @@ -71,10 +71,7 @@ class XYPad { this.xval = Math.round(new_val_x); this.yval = Math.round(new_val_y); - // if(this.store_id) { - // saveWidgetValue(this.store_id + "_x", this.xval); - // saveWidgetValue(this.store_id + "_y", this.yval); - // } + saveWidgetValue(this); this.redraw(); } @@ -89,6 +86,8 @@ class XYPad { // Redraw the crosshair based on x & y position, and trigger MIDI actions // ============================================================================= redraw() { + console.log("herere"); + var ctx = this.ctx; ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);