I'm very new to coding and it's my first time asking something on Stack Overflow!
I'm trying to play 3 different sound files at 3 different conditions: when waist angle is < 195, the sound file "high" should play, and the two others should not play, etc.
I'm using import processing.sound.*; and have declared the sound files in the void setup().
The problem is that the angle of waist is getting constantly updated, therefore the sound file starts multiple times and crashes.
Could anyone help me with this?
if (waist != null){
if(waist.angle<195){
text("waist too high", waist.getCenter().x, waist.getCenter().y);
low.stop();
correct.stop();
high.play();
} else if(waist.angle>205){
text("waist too low", waist.getCenter().x, waist.getCenter().y);
high.stop();
correct.stop();
low.play();
} else text("you're doing well", waist.getCenter().x, waist.getCenter().y);
high.stop();
low.stop();
correct.play();
}