We are about to switch to a new forum software. Until then we have removed the registration on this forum.
import ddf.minim.*;
AudioPlayer song;
AudioPlayer soong;
AudioPlayer sooong;
Minim minim;//audio context
void setup() {
size(600, 600);
frameRate(20);
minim = new Minim(this);
song = minim.loadFile("Low.mp3", 5048);
soong = minim.loadFile("Mid.mp3", 2048);
sooong = minim.loadFile("High.mp3", 2048);
}
void draw() {
if (mouseY > 400 && mouseY < 600) {
song.play();
}
if (mouseY > 200 && mouseY < 400) {
soong.play();
}
if (mouseY > 0 && mouseY < 200) {
sooong.play();
}
void stop() {
super.stop();
}
How can I make Processing only play the sound one time when the mosueY reaches certain area? Thanks a lot!
Answers
Perhaps you gotta pause all the other 1s? :(|)
I changed part of code like this, but Processing just still keeping playing weird sounds(not original ones).
perhaps use some sub-conditional for stopping others, like this:
and use 2 variations of this one for rest.
btw, in minim documentation under rewind(), it states:
This should work in theory. Hopefully will work in your sketch.
edit: sorry, I messed up numbers...