Skip to content

Commit

Permalink
Added midibus trigger option
Browse files Browse the repository at this point in the history
  • Loading branch information
dcheesman committed Feb 16, 2014
1 parent 2fea865 commit de14b88
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ColorPicker.pde
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ColorPicker{
if(mouseY > y && mouseY < x+h){
result = colorGrid.get(mouseX-x, mouseY-y);
}
}
}
return result;
}
}
17 changes: 13 additions & 4 deletions LEDStripController.pde
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
import processing.serial.*;
Serial port;

/*libraries to talk to midi devices
to make this work go to the Sketch->Import Library->Add Library
and add the MidiBus library*/

import themidibus.*;
MidiBus myBus;

// set the size and configuration of your LEDs (never less that 1 on either)
int cols = 40;
int rows = 20;
Expand Down Expand Up @@ -42,6 +49,8 @@ void setup() {

colorPicker = new ColorPicker(0,0,50,50);
selectedColor = color(255,255,255);

myBus = new MidiBus(this, "USB Keystation 49e", -1);
}

void draw() {
Expand Down Expand Up @@ -143,11 +152,11 @@ void keyPressed(){
Plasma plasma = new Plasma(12000, 35, 200, 200, 8);
effects.add(plasma);
} else if (key == 'l') {
GameOfLife gameOfLife = new GameOfLife(3000, selectedColor);
effects.add(gameOfLife);
GameOfLife gameOfLife = new GameOfLife(3000, selectedColor);
effects.add(gameOfLife);
} else if (key == 'v'){
Flock flock = new Flock(4000, selectedColor);
effects.add(flock);
Flock flock = new Flock(4000, selectedColor);
effects.add(flock);
}

}
Expand Down
29 changes: 29 additions & 0 deletions MidiControls.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//midi triggers

void noteOn(int channel, int pitch, int velocity) {
// Receive a noteOn
println();
println("Note On:");
println("--------");
println("Channel:"+channel);
println("Pitch:"+pitch);
println("Velocity:"+velocity);

// simple proof of concept for midi trigger
CircleBurst circleBurst = new CircleBurst(2000, selectedColor);
effects.add(circleBurst);
}

void noteOff(int channel, int pitch, int velocity) {
// Receive a noteOff
}

void controllerChange(int channel, int number, int value) {
// Receive a controllerChange
println();
println("Controller Change:");
println("--------");
println("Channel:"+channel);
println("Number:"+number);
println("Value:"+value);
}

0 comments on commit de14b88

Please sign in to comment.