help with solo
in
Core Library Questions
•
2 years ago
hi,
want to get functionality on attached sketch where user can mouse -over a sphere, press 'S' and it mutes the other sound file leaving only the selected sphere sound playing. Also would be great if the other spheres greyed out..any help, code etc would be greatly appreciated,
cheers,
j
- import ddf.minim.*;
- import ddf.minim.signals.*;
- AudioPlayer player,player1,player2;
- Minim minim;
- boolean over1 = false;
- boolean selected1 = false;
- boolean over2 = false;
- boolean selected2 = false;
- boolean over3 = false;
- boolean selected3 = false;
- int pos1X, pos1Y,pos2X,pos2Y,pos3X,pos3Y;
- int offset1X, offset1Y,offset2X,offset2Y,offset3X,offset3Y;
- float radius = 23.0f;
- void setup()
- {
- size(512, 512,P3D);
- textFont (createFont ("SanSerif",18));
- minim = new Minim(this);
- player = minim.loadFile("drumloop 2.mp3");
- player.play();
- player1 =minim.loadFile ("guitar.mp3");
- player1.play();
- player2 =minim.loadFile ("beep beep.mp3");
- player2.play();
- pos1X = width/2-60;
- pos1Y = height/2;
- pos2X = width/2+60;
- pos2Y = height/2;
- pos3X = width/2-10;
- pos3Y = height/2;
- smooth();
- noStroke();
- lights();
- textAlign (CENTER,CENTER);
- }
- void draw()
- {
- background(40);
- ambientLight(20, 20, 20);
- directionalLight(255,155,40, -1, 0.5, -0.8);
- {
- pushMatrix();
- translate (pos1X,pos1Y,0);
- sphere (radius);
- fill (255,30,80);
- popMatrix ();
- pushMatrix();
- translate (pos2X,pos2Y,0);
- sphere (radius);
- fill (255,129,100);
- popMatrix();
- pushMatrix();
- translate (pos3X,pos3Y,0);
- sphere (radius);
- fill (155,129,100);
- popMatrix();
- }
- {
- }
- }
- void stop()
- {
- player.close();
- player1.close();
- player2.close();
- minim.stop();
- }
1