Generate a new shape if a sound is recorded
This commit is contained in:
parent
53c19dda03
commit
520b841c97
@ -12,6 +12,7 @@ var archiveUrl = serverUrl + '/add-to-archive/';
|
|||||||
|
|
||||||
var mic, recorder, soundFile;
|
var mic, recorder, soundFile;
|
||||||
var recordingTimeout = 30000; // 30 seconds (in milliseconds)
|
var recordingTimeout = 30000; // 30 seconds (in milliseconds)
|
||||||
|
var shouldGenerateNewShape = false;
|
||||||
|
|
||||||
function setupRecording(){
|
function setupRecording(){
|
||||||
mic = new p5.AudioIn();
|
mic = new p5.AudioIn();
|
||||||
@ -31,6 +32,7 @@ function setupRecording(){
|
|||||||
function doStopping(){
|
function doStopping(){
|
||||||
if (recorder.recording) {
|
if (recorder.recording) {
|
||||||
recorder.stop();
|
recorder.stop();
|
||||||
|
shouldGenerateNewShape = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,4 +102,9 @@ function setup(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function draw(){
|
function draw(){
|
||||||
|
if (shouldGenerateNewShape){
|
||||||
|
collectSoundParamters();
|
||||||
|
generateShape();
|
||||||
|
shouldGenerateNewShape = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user