You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.5 KiB
78 lines
1.5 KiB
import processing.sound.*;
|
|
|
|
SoundFile[] file;
|
|
|
|
// Initialize data
|
|
int numSounds = 0;
|
|
int numTracks = 0;
|
|
int bpm = 0;
|
|
int pattern = 0;
|
|
int bank = 0;
|
|
int swing = 0;
|
|
int divider = 0;
|
|
int duration = 0;
|
|
int beat = 0;
|
|
|
|
String patternLabel = "NO PATTERN";
|
|
String bpmLabel = "UNSET";
|
|
String swingLabel = "100%";
|
|
|
|
boolean[][] samples;
|
|
|
|
void setup() {
|
|
size(640, 460);
|
|
background(255);
|
|
loadData();
|
|
setData();
|
|
}
|
|
|
|
void draw() {
|
|
background(50);
|
|
stroke(255);
|
|
fill(200);
|
|
|
|
printControllerStatus();
|
|
|
|
if(controller[0] == "PLAY") {
|
|
for(int i=0; i<numSounds; i++) {
|
|
for(int y=0; y<divider; y++) {
|
|
fill(samples[i][y] ? 120: 90);
|
|
rect((width/divider)*y,((height-100)/numSounds)*i, width/divider, (height-100)/numSounds);
|
|
}
|
|
}
|
|
|
|
for(int i=0; i<numSounds; i++) {
|
|
fill(150);
|
|
if(samples[i][beat]) {
|
|
fill(0, 200, 0);
|
|
file[i].stop();
|
|
file[i].play();
|
|
}
|
|
rect((width/divider)*beat,((height-100)/numSounds)*i, width/divider, (height-100)/numSounds);
|
|
}
|
|
|
|
beat++;
|
|
if(beat>=divider){beat=0;}
|
|
|
|
|
|
// ################################## End of beat
|
|
if(beat==0) {
|
|
if(doRec == false) {
|
|
controller[1] = "UNSET";
|
|
}
|
|
doRec = false;
|
|
}
|
|
|
|
|
|
if(ereaseRow>0 && doErease && beat==0) {
|
|
for(int x=0; x<divider; x++) {
|
|
samples[ereaseRow-1][x] = false;
|
|
}
|
|
ereaseRow = 0;
|
|
doErease = false;
|
|
}
|
|
}
|
|
|
|
delay(duration);
|
|
|
|
}
|