Hi! I'm trying to give to each imagebutton I've created, one specific sound, how can I? For now I've just imported one file, because more file seem to overlap eachothers....heeeelp!
void setup()
{
size(500, 313);
background(loadImage("fusion.jpg"));
minim = new Minim(this);
// Costruttore primo pulsante
PImage b = loadImage("fusion1_base.jpg");
PImage r = loadImage("fusion1_ste.jpg");
PImage d = loadImage("fusion2_ste.jpg");
int x = 28;
int y = 90;
int w = b.width;
int h = b.height;
button = new ImageButtons(x, y, w, h, b, r, d);
// load a file, default sample buffer size is 1024
in = minim.loadFile("0065.mp3");
// Costruttore secondo pulsante
PImage c = loadImage("fusion2_base.jpg");
PImage e = loadImage("fusion3_ste.jpg");
PImage f = loadImage("fusion4_ste.jpg");
int x2 = 70;
int y2 = 100;
int w2 = c.width;
int h2 = c.height;
button1 = new ImageButtons(x2, y2, w2, h2, c, e, f);
// Costruttore terzo pulsante
PImage m = loadImage("fusion11_base.jpg");
PImage n = loadImage("fusion11a_ste.jpg");
PImage o = loadImage("fusion11_ste.jpg");
int x3 = 135;
int y3 = 85;
int w3 = d.width;
int h3 = d.height;
button2 = new ImageButtons(x3, y3, w3, h3, m, n, o);
// Costruttore quarto pulsante
PImage p = loadImage("fusion22_base.jpg");
PImage q = loadImage("fusion22a_ste.jpg");
PImage s = loadImage("fusion22_ste.jpg");
int x4 = 170;
int y4 = 80;
int w4 = e.width;
int h4 = e.height;
button3 = new ImageButtons(x4, y4, w4, h4, p, q, s);
// Costruttore quinto pulsante
PImage l = loadImage("fusion33_base.jpg");
PImage z = loadImage("fusion33a_ste.jpg");
PImage a = loadImage("fusion33_ste.jpg");
int x5 = 200;
int y5 = 70;
int w5 = f.width;
int h5 = f.height;
button4 = new ImageButtons(x5, y5, w5, h5, l, z, a);
// Costruttore secondo pulsante
PImage g = loadImage("fusion4_base.jpg");
PImage t = loadImage("fusion4a_ste.jpg");
PImage i = loadImage("fusion44_ste.jpg");
int x6 = 235;
int y6 = 120;
int w6 = e.width;
int h6 = e.height;
button5 = new ImageButtons(x6, y6, w6, h6, g, t, i);
// Costruttore secondo pulsante
PImage v = loadImage("fusion5_base.jpg");
PImage wa = loadImage("fusion5a_ste.jpg");
PImage j = loadImage("fusion5_ste.jpg");
int x7 = 285;
int y7 = 110;
int w7 = f.width;
int h7 = f.height;
button6 = new ImageButtons(x7, y7, w7, h7, v, wa, j);
// Costruttore secondo pulsante
PImage ma = loadImage("fusion6_base.jpg");
PImage na = loadImage("fusion6a_ste.jpg");
PImage sa = loadImage("fusion6_ste.jpg");
int x8 = 310;
int y8 = 110;
int w8 = g.width;
int h8 = g.height;
button7 = new ImageButtons(x8, y8, w8, h8, ma, na, sa);
// Costruttore secondo pulsante
PImage la = loadImage("fusion7_base.jpg");
PImage ga = loadImage("fusion7a_ste.jpg");
PImage ta = loadImage("fusion7_ste.jpg");
int x9 = 350;
int y9 = 85;
int w9 = f.width;
int h9 = f.height;
button8 = new ImageButtons(x9, y9, w9, h9, la, ga, ta);
// Costruttore secondo pulsante
PImage ba = loadImage("fusion8_base.jpg");
PImage ra = loadImage("fusion8a_ste.jpg");
PImage da = loadImage("fusion8_ste.jpg");
int x10 = 375;
int y10 = 75;
int w10 = g.width;
int h10 = g.height;
button9 = new ImageButtons(x10, y10, w10, h10, ba, ra, da);
// Costruttore secondo pulsante
PImage pa = loadImage("fusion9_base.jpg");
PImage qa = loadImage("fusion9a_ste.jpg");
PImage xa = loadImage("fusion9_ste.jpg");
int x11 = 285;
int y11 = 110;
int w11 = m.width;
int h11 = m.height;
button10 = new ImageButtons(x11, y11, w11, h11, pa, qa, xa);
// Costruttore secondo pulsante
PImage ca = loadImage("fusion10_base.jpg");
PImage fa = loadImage("fusion10a_ste.jpg");
PImage ha = loadImage("fusion10_ste.jpg");
int x12 = 430;
int y12 = 100;
int w12 = i.width;
int h12 = i.height;
button11 = new ImageButtons(x12, y12, w12, h12, ca, fa, ha);
// Costruttore secondo pulsante
PImage mi = loadImage("fusion10_base.jpg");
PImage ni = loadImage("fusion10a_ste.jpg");
PImage si = loadImage("fusion10_ste.jpg");
int x13 = 455;
int y13 = 115;
int w13 = n.width;
int h13 = n.height;
button12 = new ImageButtons(x13, y13, w13, h13, mi, ni, si);
class button
{
int x, y;
int w, h;
int x2, y2;
int w2, h2;
int x3, y3;
int w3, h3;
int x4, y4;
int w4, h4;
int x5, y5;
int w5, h5;
int x6, y6;
int w6, h6;
int x7, y7;
int w7, h7;
int x8, y8;
int w8, h8;
int x9, y9;
int w9, h9;
int x10, y10;
int w10, h10;
int x11, y11;
int w11, h11;
int x12, y12;
int w12, h12;
int x13, y13;
int w13, h13;
color basecolor, highlightcolor;
color currentcolor;
boolean over = false;
boolean pressed = false;
ImageButtons(int ix, int iy, int iw, int ih, PImage ibase, PImage iroll, PImage idown)
{
x = ix;
y = iy;
w = iw;
h = ih;
base = ibase;
roll = iroll;
down = idown;
currentimage = base;
}
void update()
{
over();
pressed();
if(pressed) {
currentimage = down;
// play the file
in.play();