Browse Source

Revert "Set fifth click to reset screen"

This reverts commit 1839f91438.
offline
decentral1se 3 years ago
parent
commit
f65efc9002
No known key found for this signature in database GPG Key ID: 92DAD76BD9567B8A
  1. 30
      voicegardens/static/voicegardens.js

30
voicegardens/static/voicegardens.js

@ -12,7 +12,7 @@ var _canvas;
var offlineRecordingDuration = 2000; var offlineRecordingDuration = 2000;
// Offline limits for hardware considerations // Offline limits for hardware considerations
var offlineLimits = 3; var offlineLimits = 4;
// URL which exposes the archive saving API end-point // URL which exposes the archive saving API end-point
var archiveUrl = window.location + "add-to-archive"; var archiveUrl = window.location + "add-to-archive";
@ -88,7 +88,7 @@ function gardenOfflineLimits() {
/** /**
* Ensure shapes stay within limits * Ensure shapes stay within limits
**/ **/
if (shapes.length < offlineLimits) return false; if (shapes.length < offlineLimits) return;
for (let i = 0; i < shapes.length; i++) { for (let i = 0; i < shapes.length; i++) {
let shape = shapes[i]; let shape = shapes[i];
@ -585,20 +585,18 @@ function draw() {
// generate a new shape after a sound recording // generate a new shape after a sound recording
if (newSoundJustRecorded === true) { if (newSoundJustRecorded === true) {
let limits = gardenOfflineLimits(); // build a new copy of the recording to store on the shape object
if (limits === false) { let soundBlob = recording.getBlob();
// build a new copy of the recording to store on the shape object let data = new p5.File(soundBlob);
let soundBlob = recording.getBlob(); let sound = new p5.SoundFile(data, function () {
let data = new p5.File(soundBlob); let amp = sound.getPeaks(1)[0] * 100;
let sound = new p5.SoundFile(data, function () { let dur = sound.duration();
let amp = sound.getPeaks(1)[0] * 100; let shape = new GeneratedShape(sound, amp, dur);
let dur = sound.duration(); gardenOfflineLimits();
let shape = new GeneratedShape(sound, amp, dur); shape.sound();
shape.sound(); shapes.push(shape);
shapes.push(shape); sendToArchive();
sendToArchive(); });
});
}
newSoundJustRecorded = false; newSoundJustRecorded = false;
} }

Loading…
Cancel
Save