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.

72 lines
1.3 KiB

import processing.sound.*;
SoundFile[] file;
5 years ago
// Initialize data
int numSounds = 0;
int numTracks = 0;
int bpm = 0;
int divider = 0;
int duration = 0;
int beat = 0;
5 years ago
boolean[][] samples;
void setup() {
5 years ago
size(640, 460);
background(255);
5 years ago
loadData();
}
void draw() {
5 years ago
background(50);
stroke(255);
5 years ago
fill(200);
5 years ago
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);
}
}
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
beat++;
if(beat>=divider){beat=0;}
// End of beat
if(beat==0) {
if(doRec == false) {
controller[1] = "UNSET";
}
doRec = false;
}
5 years ago
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
delay(duration);
}