We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm using the minim Library for the means of initiating sound. Now I am trying to pause the song whenever the user clicks on the white square however there is something wrong because as I click on the background it pauses and restarts instead of continuing. Any help? please.
import ddf.minim.*; import ddf.minim.analysis.*;
Minim minim; AudioPlayer song; boolean isMute = false;
void setup(){ size(500,500); background(0); minim = new Minim(this); song = minim.loadFile("portal.mp3", 1024); song.play(); }
void draw(){ background(0); rectMode(CENTER); rect(width/2,height/2,100,100);
}
void mousePressed(){ if(mouseX < width/2 && mouseY < height/2){ song.pause(); } else{ song.loop(); } }
Answers
Replace
song.loop()
withsong.play()
as a first step.Try figuring out the rest.