Minim

edited December 2016 in Library Questions

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(); } }

Tagged:

Answers

Sign In or Register to comment.