From f65efc9002ce56bb500df383b6fcdfd2f2e6c8c7 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 1 Jun 2021 18:21:50 +0200 Subject: [PATCH] Revert "Set fifth click to reset screen" This reverts commit 1839f914384930905954fc0ca85ed5a9499b2096. --- voicegardens/static/voicegardens.js | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index ef1e7e2..0ad9b90 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -12,7 +12,7 @@ var _canvas; var offlineRecordingDuration = 2000; // Offline limits for hardware considerations -var offlineLimits = 3; +var offlineLimits = 4; // URL which exposes the archive saving API end-point var archiveUrl = window.location + "add-to-archive"; @@ -88,7 +88,7 @@ function gardenOfflineLimits() { /** * Ensure shapes stay within limits **/ - if (shapes.length < offlineLimits) return false; + if (shapes.length < offlineLimits) return; for (let i = 0; i < shapes.length; i++) { let shape = shapes[i]; @@ -585,20 +585,18 @@ function draw() { // generate a new shape after a sound recording if (newSoundJustRecorded === true) { - let limits = gardenOfflineLimits(); - if (limits === false) { - // build a new copy of the recording to store on the shape object - let soundBlob = recording.getBlob(); - let data = new p5.File(soundBlob); - let sound = new p5.SoundFile(data, function () { - let amp = sound.getPeaks(1)[0] * 100; - let dur = sound.duration(); - let shape = new GeneratedShape(sound, amp, dur); - shape.sound(); - shapes.push(shape); - sendToArchive(); - }); - } + // build a new copy of the recording to store on the shape object + let soundBlob = recording.getBlob(); + let data = new p5.File(soundBlob); + let sound = new p5.SoundFile(data, function () { + let amp = sound.getPeaks(1)[0] * 100; + let dur = sound.duration(); + let shape = new GeneratedShape(sound, amp, dur); + gardenOfflineLimits(); + shape.sound(); + shapes.push(shape); + sendToArchive(); + }); newSoundJustRecorded = false; }