Problems with sound
in
Programming Questions
•
1 year ago
Hello,
I want that Processing plays a song, but when you click on your mouse the song stops.
I've tried a several things, but nothing worked :(
I must say I'm still not very practised inProcessing.
This is the latest code I made:
_________________________________________________________________________________________________
// Pre setup
import ddf.minim.*;
Minim minim;
AudioPlayer introMusic;
AudioPlayer silenceMusic;
boolean music = true;
//setup
void setup(){
minim = new Minim(this);
introMusic = minim.loadFile("bloodbeat.mp3");
silenceMusic = minim.loadFile("silence.mp3");
}
//Draw
//Song always plays
void draw(){
if(music == true){
introMusic.play();
} else {
silenceMusic.play();
}
}
//When you press your mouse, the song stops.
void mousePressed(){
music = false;
}
_________________________________________________________________________________________________
I hope someone can help me. Thanks anyway!
I want that Processing plays a song, but when you click on your mouse the song stops.
I've tried a several things, but nothing worked :(
I must say I'm still not very practised inProcessing.
This is the latest code I made:
_________________________________________________________________________________________________
// Pre setup
import ddf.minim.*;
Minim minim;
AudioPlayer introMusic;
AudioPlayer silenceMusic;
boolean music = true;
//setup
void setup(){
minim = new Minim(this);
introMusic = minim.loadFile("bloodbeat.mp3");
silenceMusic = minim.loadFile("silence.mp3");
}
//Draw
//Song always plays
void draw(){
if(music == true){
introMusic.play();
} else {
silenceMusic.play();
}
}
//When you press your mouse, the song stops.
void mousePressed(){
music = false;
}
_________________________________________________________________________________________________
I hope someone can help me. Thanks anyway!
1