Im using minim for an audio player and can make the audio files loop with the loop() command. However i want to set the loop to start when a cyclying radiating shape refreshes. I have a loop with the size++ then it starts again (like sonar) I want to make the audio play once and only start again when the shape refreshes when the size hits 0).
The problem is im not too familiar withminum and am having trouble using if/else statements due to the audio class not working with int of many other codes that I would usuallu use. Is there a specific minim code to trigger the start of a loop based off of an animation like the one i mentioned above. If anyone has a link to a detailed library of minim code for processing?
I've attached my circles loop and apply to a counter. When you make the 21st click the 1st circle becomes the the new circle, always having no more than 20 onscreen. I want to avoid getting ("ArrayIndexOutOfBoundsException: 20)This works the way i want it to with the visuals. Here are my problems. I want the audio to follow the C counter class so that it will recycle sounds like it does circles. I also have been trying to find out how to make the audio trigger within the circle when the circle refreshes itself and grows big (I tried an "if/else" statement but it didn't seem to work.) Does anyone have some minum advice on how to do either of these?
import ddf.minim.*;
Minim minim;
Blob[] b; //sets amount limit
AudioPlayer[ ] a;
int c = 0;
void setup() {
size (300, 500);
minim = new Minim(this);
a = new AudioPlayer[18];
a[0] = minim.loadFile("Hobbits.wav");
a[1] = minim.loadFile("Howard Dean.wav");
a[2] = minim.loadFile("bigstick.wav");
a[3] = minim.loadFile("bullshit.wav");
a[4] = minim.loadFile("Bush.wav");
a[5] = minim.loadFile("fac.wav");
a[6] = minim.loadFile("fuck it.wav");
a[7] = minim.loadFile("gotchya.wav");
a[8] = minim.loadFile("ilikelakes.wav");
a[9] = minim.loadFile("jackass.wav");
a[10] = minim.loadFile("lefthand.wav");
a[11] = minim.loadFile("lovewithyou.wav");
a[12] = minim.loadFile("mama.wav");
a[13] = minim.loadFile("maverick.wav");
a[14] = minim.loadFile("moon.wav");
a[15] = minim.loadFile("rouge.wav");
a[16] = minim.loadFile("sexual.wav");
a[17] = minim.loadFile("zen.wav");
b = new Blob[21];//how many appear at once
for ( int i=0; i < b.length; i ++ ) {
b[i] = new Blob( random(width), random(height),
1, false, i, random (0, 255), random (0, 255), random (0, 255));
}
}
void draw() {
//frame
fill( 90, 50 ); // black out last frame
rect(0, 0, width, height);
//body
fill(0);
beginShape();
vertex(20, 30);
bezierVertex( 22, 22, 26, 22, 30, 20);
vertex(30, 20);//corner1
vertex(270, 20);
bezierVertex( 272, 22, 276, 20, 280, 30);
vertex(280, 30);//corner2
vertex(280, 470);
bezierVertex( 279, 472, 275, 479, 270, 480);
vertex(270, 480);//corner3
vertex(30, 480);
vertex(20, 470);//corner4
endShape(CLOSE);
for ( int i=0; i < b.length; i ++ ) {//loop for black .function references array from outside local?
Im having issues trying to make the animation start in my code. I can establish a global variable with a boolean and void mousePressed trigger but I plan on being able to activate multiples of these animation on one screen and need to make it local. I have been beating my brain against the wall (Almost literally) I have some pieces but can't put make them function together. Any tips?
Here are my pieces of code. The first section is a key trigger i plan to us with a class C used as a counter for the amount of animations on screen.
I'm trying to make an animation that is activated by a mouse click and then repeats after you move the mouse away. I figure it has something to do with the circle having mouseX and mouseY coordinates. So my question is; How do i dictate the animation starts at mouseX and mouseY without restricting the animations playtime to when the mouse stays in those positions? Also is there a way to make the circles refresh (disappear and reappear) instead of piling on top of one another. Here is the code so far
Is there any way to take a star with 10 vector points and radiate them from the center without using the scale function? I've been beating my head against the wall with int loops and multiplying each point by float commands to increase all the points in size equally. here is the example I have; (i've been tweaking wit the left star)
size (800,400);
background (255);
noFill();
strokeWeight (13);
line (400,0,400,400);
rect (6.5,6.5,790,390);
for (float p=.9; p<10; p+=.1){//p is stand-in for i
pushMatrix();
translate (-372.5,-433);
noFill();
strokeWeight(13);
beginShape();
vertex(115*p,460*p);//1
vertex(460*p,460*p);//2
vertex(575*p,115*p);//3
vertex(690*p,460*p);//4
vertex(1035*p,460*p);//5
vertex(747.5*p,690*p);//6
vertex(862.5*p,1035*p);//7
vertex(575*p,805*p);//8
vertex(285.5*p,1035*p);//9
vertex(402.5*p,690*p);//10
endShape(CLOSE);
popMatrix();
}
This ends up giving me the desired scaling up of size but no pushMatrix can have me shift the progression of size to radiate from the center of the shape. And that is my issue. Does anyone have any tips/ideas? I can't afford to keep buying plaster to fill the holes in the walls.