Browse Source

Moving towards auto archiving and footer listing

main
Luke Murphy 4 years ago
parent
commit
c9bf6f5e5d
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 24
      voicegardens/static/voicegardens.js

24
voicegardens/static/voicegardens.js

@ -27,7 +27,6 @@ var recording;
var newSoundJustRecorded = false;
// All user clickable buttons
var archiveButton;
var playButton;
var recordButton;
var stopButton;
@ -85,6 +84,9 @@ function stop() {
// https://p5js.org/reference/#/p5.SoundFile/duration
duration = recording.duration();
sendToArchive();
addToFooterArchive();
}
}
@ -97,9 +99,9 @@ function play() {
}
}
function archive() {
function sendToArchive() {
/**
* Send the sound to the back-end for archving.
* Send the sound to the back-end for archiving.
**/
var soundBlob = recording.getBlob();
@ -119,6 +121,12 @@ function archive() {
});
}
function addToFooterArchive() {
/**
* Add shape to the archive.
**/
}
function setupRecording() {
/**
* Setup logic for sound recording.
@ -142,10 +150,6 @@ function setupRecording() {
playButton = createButton("play");
playButton.position(10, 75);
playButton.mousePressed(play);
archiveButton = createButton("archive");
archiveButton.position(10, 110);
archiveButton.mousePressed(archive);
}
class GeneratedShape {
@ -383,14 +387,18 @@ function draw() {
translate(screenX, screenY);
if (newSoundJustRecorded === true) {
shapes.push(new GeneratedShape());
newShape = new GeneratedShape();
shapes.push(newShape);
addToArchive(newShape);
newSoundJustRecorded = false;
}
for (let i = 0; i < shapes.length; i++) {
let shape = shapes[i];
shape.draw();
shape.move();
if (shape.collide(shapes) === true) {
shape.sound();
}

Loading…
Cancel
Save