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.

79 lines
1.5 KiB

5 years ago
import processing.sound.*;
SoundFile[] file;
// Initialize data
int numSounds = 0;
int numTracks = 0;
int bpm = 0;
5 years ago
int pattern = 0;
5 years ago
int bank = 0;
5 years ago
int swing = 0;
5 years ago
int divider = 0;
int duration = 0;
int beat = 0;
5 years ago
String patternLabel = "NO PATTERN";
5 years ago
String bpmLabel = "UNSET";
5 years ago
String swingLabel = "100%";
5 years ago
boolean[][] samples;
void setup() {
5 years ago
size(640, 460);
5 years ago
background(255);
loadData();
5 years ago
setData();
5 years ago
}
void draw() {
5 years ago
background(50);
5 years ago
stroke(255);
5 years ago
fill(200);
5 years ago
5 years ago
printControllerStatus();
5 years ago
5 years ago
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);
}
}
5 years ago
5 years ago
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);
5 years ago
}
5 years ago
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;
}
5 years ago
}
5 years ago
5 years ago
delay(duration);
}