Browse Source

Maybe working multiple shape noises

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

15
voicegardens/static/voicegardens.js

@ -138,7 +138,7 @@ function setupRecording() {
}
class GeneratedShape {
constructor() {
constructor(soundRecorded) {
/**
* Initialise the new shape.
**/
@ -223,7 +223,7 @@ class GeneratedShape {
this.destY = random(windowHeight);
// the sound recording attached to this shape
this.recording;
this.soundRecorded = soundRecorded;
// the shape that was last collided with
this.lastCollidedShape;
@ -293,8 +293,8 @@ class GeneratedShape {
/**
* Play a sound after a collision is detected.
**/
if (this.recording.isLoaded()) {
this.recording.play();
if (this.soundRecorded.isLoaded()) {
this.soundRecorded.play();
}
}
@ -434,9 +434,12 @@ function draw() {
// generate a new shape after a sound recording
if (newSoundJustRecorded === true) {
let newShape = new GeneratedShape();
newShape.recording = recording;
let soundBlob = recording.getBlob();
let recordedSound = new p5.SoundFile(new p5.File(soundBlob));
let newShape = new GeneratedShape(recordedSound);
shapes.push(newShape);
newSoundJustRecorded = false;
}

Loading…
Cancel
Save