From f829eea9117b0083e42a6003fcc35027ab02f98f Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Thu, 7 Mar 2024 11:14:24 +0100 Subject: [PATCH] remember play state --- bin/em/variabletime/web/js/record.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/em/variabletime/web/js/record.js b/bin/em/variabletime/web/js/record.js index 708115e..445eb96 100644 --- a/bin/em/variabletime/web/js/record.js +++ b/bin/em/variabletime/web/js/record.js @@ -160,10 +160,15 @@ const Record = function(tp) { const liveUpdater = new LiveUpdater(tp, buffy); let isInitialized = false; + let remember = {}; + const init = () => { if (!isInitialized) { tp.core.onChange(tp.sheet.sequence.pointer.playing, (playing) => { if (isRecording === RECORDING && !playing) { + // when you hit space to stop recording, + // we want to keep it paused + remember.isPlaying = false; stopRecording(); } }); @@ -440,6 +445,7 @@ const Record = function(tp) { init(); } lastPositions = {}; + remember.isPlaying = tp.core.val(tp.sheet.sequence.pointer.playing); tp.sheet.sequence.pause(); const layerKeys = Object.keys(hot); layerKeys.forEach((layerID) => { @@ -554,6 +560,12 @@ const Record = function(tp) { .classList.remove('visible'); console.log('Record::stopRecording', 'stopped recording'); isRecording = NOT_RECORDING; + + if (remember.isPlaying) { + tp.sheet.sequence.play(); + } else { + tp.sheet.sequence.pause(); + } resolve(); }); });