here is part of my code. when i run it it runs @ 60% of my cpu capacity. can this be a limiting factor.
(running 10 SampleMachines at once)
Quote:
import ddf.minim.*;
import ddf.minim.analysis.*;
import processing.opengl.*;
import controlP5.*;
AudioPlayer[] track;
SampleMachine[] SM;
Slider[] s;
BeatDetect beat;
ControlP5 controlP5;
int beatcount;
int CurrentTrack;
int num;
int rad;
int volzume;
void setup(){
size(800,800);
Minim.start(this);
smooth();
num = 7;
rad = 200;
SM = new SampleMachine[num];
s = new Slider[num];
controlP5 = new ControlP5(this);
SM[0] = new SampleMachine(0,"2.mp3",50,50,SM);
SM[1] = new SampleMachine(1,"1.mp3",600,750,SM);
SM[5].play();
background(0);
Slider s = controlP5.addSlider("volzume",-500,500,0.8,300,700,10,40);
}
void draw()
{
background(0);
for (int i=0;i<SM.length;i++){
SM[i].update();
SM[i].display();
SM[i].processor();
}
}
void mouseReleased()
{
for (int i=0 ; i< SM.length; i++){
SM[i].mouseRelease();
}
}
class SampleMachine{
int ID;
int x, y;
int vol;
int volume;
int myColorRect;
int myColorBackground;
String name;
boolean mouseOver;
boolean mousePress;
boolean locked = false;
boolean otherslocked = false;
boolean othersplayed = false;
boolean play = false;
boolean pause = false;
boolean optionized;
SampleMachine[] others;
AudioPlayer song;
BeatDetect beat;
int beats = 0;
int startCut;
int endCut;
SampleMachine(int id, String n, int ix, int iy, SampleMachine[] o){
ID = id;
name = n;
x = ix;
y = iy;
others = o;
song = Minim.loadFile(name);
startCut = 0;
endCut = song.length();
beat = new BeatDetect();
beat.detectMode(BeatDetect.FREQ_ENERGY);
beat.setSensitivity(500);
s[ID] = controlP5.addSlider("vol",-800,10,9,100,700,10,40);
size = 25;
}