Moving towards auto archiving and footer listing
This commit is contained in:
parent
83018a963f
commit
c9bf6f5e5d
@ -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…
Reference in New Issue
Block a user