Generate a new shape if a sound is recorded

This commit is contained in:
Luke Murphy 2019-12-18 13:48:59 +07:00
parent 53c19dda03
commit 520b841c97
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -12,6 +12,7 @@ var archiveUrl = serverUrl + '/add-to-archive/';
var mic, recorder, soundFile;
var recordingTimeout = 30000; // 30 seconds (in milliseconds)
var shouldGenerateNewShape = false;
function setupRecording(){
mic = new p5.AudioIn();
@ -31,6 +32,7 @@ function setupRecording(){
function doStopping(){
if (recorder.recording) {
recorder.stop();
shouldGenerateNewShape = true;
}
};
@ -100,4 +102,9 @@ function setup(){
}
function draw(){
if (shouldGenerateNewShape){
collectSoundParamters();
generateShape();
shouldGenerateNewShape = false;
}
}