diff --git a/Processing/Sampler/Sampler.pde b/Processing/Sampler/Sampler.pde index 202e4cd..4728b46 100644 --- a/Processing/Sampler/Sampler.pde +++ b/Processing/Sampler/Sampler.pde @@ -6,16 +6,21 @@ SoundFile[] file; int numSounds = 0; int numTracks = 0; int bpm = 0; +int pattern = 0; +int swing = 0; int divider = 0; int duration = 0; int beat = 0; +String patternLabel = "NO PATTERN"; +String swingLabel = "100%"; + boolean[][] samples; void setup() { size(640, 460); background(255); - loadData(); + setData(); } void draw() { diff --git a/Processing/Sampler/SetBeat.pde b/Processing/Sampler/SetBeat.pde index 51b8f6d..d1f86f2 100644 --- a/Processing/Sampler/SetBeat.pde +++ b/Processing/Sampler/SetBeat.pde @@ -2,33 +2,41 @@ int ereaseRow = 0; boolean doErease = false; boolean doRec = false; boolean chooseBank = false; +boolean choosePattern = false; +boolean chooseBPM = false; void setBeat(int index, int sample) { samples[sample][index] = true; } void keyPressed() { - println(keyCode); + //println(keyCode); if(keyCode >= 64 && keyCode <= 88) { // From A to Z - println(key); + //println(key); //ereaseRow = keyCode-48; - if(key == 'b') { + if(key == 'b') { // BANK chooseBank = true; controller[0] = "STOP"; controller[2] = "CHOOSE..."; } - if(key == 'p') { + if(key == 'p') { // PLAY/STOP controller[0] = controller[0] == "PLAY" ? "STOP" : "PLAY"; beat=0; } - if(key == 'r') { + if(key == 'r') { // REC/OVERDUB controller[1] = controller[1] == "UNSET" ? "REC/OVERDUB" : "UNSET"; doRec = true; } - if(key == 'x') { + if(key == 'o') { // PATTERN + choosePattern = true; + controller[0] = "STOP"; + patternLabel = "CHOOSE..."; + } + if(key == 'x') { // EREASE controller[1] = "EREASE"; } + } else if(keyCode >= 48 && keyCode < 57) { // From 1 to 9 int code = keyCode-49; ereaseRow = controller[1] == "EREASE" ? keyCode-48 : 0; @@ -37,8 +45,13 @@ void keyPressed() { if(code >= 0 && code < numSounds && !doErease) { if(chooseBank) { controller[2] = "BANK" + (code+1); - loadData(); + setData(); chooseBank = false; + } else if(choosePattern) { + pattern = (code+1); + patternLabel = "PATTERN" + (code+1); + setData(); + choosePattern = false; } else if(controller[1] != "EREASE" && controller[1] != "UNSET") { setBeat(beat, code); } diff --git a/Processing/Sampler/controllerStatus.pde b/Processing/Sampler/controllerStatus.pde index 09cc66b..e0a73d1 100644 --- a/Processing/Sampler/controllerStatus.pde +++ b/Processing/Sampler/controllerStatus.pde @@ -1,6 +1,5 @@ String[] controller = {"STOP", "UNSET", "BANK1", "PATTERN"}; - void printControllerStatus() { fill(200); text("PLAY/STOP:", 10, height-75); @@ -13,4 +12,17 @@ void printControllerStatus() { text(controller[1], 180, height-55); text(controller[2], 180, height-35); text(controller[3], 180, height-15); + + fill(200); + text("PATTERN:", (width/2)+20, height-75); + text("BPM:", (width/2)+20, height-55); + text("SWING:",(width/2)+20, height-35); + + fill(240); + text(patternLabel, (width/2)+100, height-75); + text(bpm, (width/2)+100, height-55); + text(swing, (width/2)+100, height-35); + + stroke(200); + line(width/2, height-85, width/2, height-15); } diff --git a/Processing/Sampler/loadData.pde b/Processing/Sampler/setData.pde similarity index 88% rename from Processing/Sampler/loadData.pde rename to Processing/Sampler/setData.pde index a984c86..626a942 100644 --- a/Processing/Sampler/loadData.pde +++ b/Processing/Sampler/setData.pde @@ -1,8 +1,10 @@ -void loadData() { +void setData() { numSounds = 5; numTracks = numSounds; bpm = 280; + pattern = 1; + swing = 50; divider = 16; duration = int((60/float(bpm))*1000); beat = 0; @@ -10,6 +12,7 @@ void loadData() { String bank = controller[2]; println(bank); + println(patternLabel); samples = new boolean[numTracks][divider]; for(int i=0; i