From 705e2f65857fb9baaa1425acaeca26db3fffb3bd Mon Sep 17 00:00:00 2001 From: root Date: Sun, 21 Feb 2021 22:38:39 +0100 Subject: [PATCH] fixed save and copy track --- src/init.js | 7 ++++++- src/lib.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/init.js b/src/init.js index 573b9a2..c966427 100755 --- a/src/init.js +++ b/src/init.js @@ -87,7 +87,12 @@ exports.render = () => { }; exports.save = (path) => { - fs.writeFileSync(path, JSON.stringify({scenes: scenes, state: state})); + const bufferedState = {chords : state.chords} //Add only needed fields, IMPORTANT cannot stringify resetClockTimeout + fs.writeFile(path, JSON.stringify({scenes: scenes,state: bufferedState}), (err) => { + if(err){ + console.log(err); + } + }); }; exports.load = (path) => { diff --git a/src/lib.js b/src/lib.js index ae3e26b..940ea78 100644 --- a/src/lib.js +++ b/src/lib.js @@ -73,6 +73,7 @@ exports.copyTrack = (state,scenes) => { var bufferTrack = JSON.parse(JSON.stringify(scenes[state.currentScene].tracks[state.currentTrack])); var targetTrack = cons.MUTE_BUTTONS.indexOf(state.pressedButtons[1]); bufferTrack.color = trackColors[targetTrack]; + bufferTrack.channel = targetTrack; scenes[state.currentScene].tracks[targetTrack] = bufferTrack; io.blinkButton(11,cons.COLOR_BLINK,0); }