Skip to content

Commit

Permalink
fixed save and copy track
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 21, 2021
1 parent 399db66 commit 705e2f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
1 change: 1 addition & 0 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 705e2f6

Please sign in to comment.