Skip to content

Commit

Permalink
load mapping from json file
Browse files Browse the repository at this point in the history
  • Loading branch information
sojamo committed Mar 14, 2016
1 parent 27c8d86 commit 5af62c6
Show file tree
Hide file tree
Showing 3 changed files with 453 additions and 411 deletions.
26 changes: 26 additions & 0 deletions examples/MidiMapperJSON/MidiMapperJSON.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sojamo.midimapper.*;
MidiMapper midi;
float a;
float b;
void setup() {
midi = new MidiMapper(this);
midi.load("midi.json");
}

void draw() {
background(frameCount%255);
fill(255);
pushMatrix();
translate(width/2, height/4);
rotate(map(a, 0, 127, -PI, PI));
translate(-20, -20);
rect(0, 0, 40, 40);
popMatrix();

pushMatrix();
translate(width/2, height/1.5);
rotate(map(b, 0, 127, -PI, PI));
translate(-20, -20);
rect(0, 0, 40, 40);
popMatrix();
}
7 changes: 7 additions & 0 deletions examples/MidiMapperJSON/midi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[{
"device": "SLIDER/KNOB",
"mapping": {
"a":16,
"b":17
}
}]
Loading

0 comments on commit 5af62c6

Please sign in to comment.