Page 1 of 1

My code not working ???? function ChoseMic(){ this.x = 30; this.y = 100; this.width = 20; this.height = 50;

Posted: Fri Apr 29, 2022 7:02 am
by answerhappygod
My code not working ????
function ChoseMic(){
this.x = 30;
this.y = 100;
this.width = 20;
this.height = 50;

var mic;
mic = new p5.AudioIn();
mic.start();
mic.start = false;

this.draw = function(){

var vol = mic.getLevel();

//draw mic

if(mic.start){
fill(255,255,0);


ellipse(this.x,this.y,this.width,this.height);

circle(this.x,this.y-20,this.width+10);

}
else{


ellipse(this.x,this.y,this.width,this.height);

circle(this.x,this.y-20,this.width+10);
}


this.micCheck = function() {

if (mouseX > this.x
&& mouseX <
this.x + this.width
&& mouseY >
this.y
&& mouseY <
this.y + this.height) {


if (mic.start()) {

sound.pause();
}
else {

sound.loop();

}

}
return false;
}
}
}