Hi thank you for responding! This is my code ( I know you won't be able to hear the songs) and I understand that I need to make it so for each different ellipse it detects a different mouse click...but I honestly don't know how to do that. Ideally I would want a different set of numbers under each ellipse that counts how many times that ellipse was played.
Code:
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.*; //import the library
Minim minim;
AudioPlayer song;
AudioPlayer song2;
AudioPlayer song3;
String[] audioFiles = {"Phillip Phillips - Volcano - Studio Version - American Idol 11 Top 4.mp3", "The Smiths Please, please, please, let me get what I want.mp3"};
String[] audioFiles2 = {"Jay Z - Im A Hustler Baby.mp3","Nicki Minaj - Starships.mp3", "Tyga - Make It Nasty Lyrics.mp3" };
String[] audioFiles3 = {"05 Summertime.mp3", "Boot Scootin' Boogie.mp3", "Old Crow Medicine Show- Wagon Wheel with lyrics.mp3" };
int randomAudioIndex = 0;
int randomAudioIndex2 = 0;
int randomAudioIndex3 = 0;
int playPause = -1;
int cs = 100;
int css = 200;
int bs = 100;
int bss = 200;
int as = 100;
int ass = 200;
int mouseClicks;
float cx;
float cy;
float bx;
float by;
float ax;
float ay;
boolean cover = false;
boolean hiphop = false;
boolean country = false;
void setup() {
size (930,360);
cx = width/4;
cy = height/2;
bx = width/2*1.5;
by = height/2;
ax = width/2;
ay = height/2;
minim = new Minim(this);
song = minim.loadFile("audio/"+audioFiles[randomAudioIndex]);
song2 = minim.loadFile("audio2/"+audioFiles2[randomAudioIndex2]);
song3 = minim.loadFile("audio3/"+audioFiles3[randomAudioIndex3]);
}
void draw() {
background(0);
ellipseMode(CENTER);
stroke (255);
fill (0);
ellipse (cx,cy,css,css);
fill(0,0,100);
ellipse (bx,by,bss,bss);
fill(200,100,100);
ellipse (ax,ay,ass,ass);
fill(255);
PFont font;
font = loadFont("ACaslonPro-BoldItalic-48.vlw");
textFont(font);
text("Alt.", cx-40,cy);
text("Hip Hop", bx-70,cy);
text("Country", ax-80,cy);
text(mouseClicks+"",
0,0,cx,cy);
}
void mousePressed() {
if (mouseX > cx-cs && mouseX < cx+cs && mouseY > cy-cs && mouseY < cy+cs) {
cover = true;
if (cover) {
playPause *= -1;
if (playPause == 1) {
randomAudioIndex = int(random(audioFiles.length));
println(randomAudioIndex);
song = minim.loadFile("audio/"+audioFiles[randomAudioIndex]);
song.play();
} else {
song.pause();
song.rewind();
} }
else {
cover = false;
hiphop = false;
fill (0);
}
}
if (mouseX > bx-bs && mouseX < bx+bs && mouseY > by-bs && mouseY < by+bs) {
hiphop = true;
if (hiphop) {
playPause *= -1;
if (playPause == 1) {
randomAudioIndex2 = int(random(audioFiles2.length));
println(randomAudioIndex2);
song2 = minim.loadFile("audio2/"+audioFiles2[randomAudioIndex2]);
song2.play();
} else {
song2.pause();
song2.rewind();
}
}
}
if (mouseX > ax-as && mouseX < ax+as && mouseY > ay-as && mouseY < ay+as) {
country = true;
if (country) {
playPause *= -1;
if (playPause == 1) {
randomAudioIndex3 = int(random(audioFiles3.length));
println(randomAudioIndex3);
song3 = minim.loadFile("audio3/"+audioFiles3[randomAudioIndex3]);
song3.play();
} else {
song3.pause();
song3.rewind();
}
}
}
if (mouseButton == LEFT) {
mouseClicks++;} else {mouseClicks =
0;}
}