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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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;
}
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply