I'm making my own MIDI triggered/controlled app myself, it is drawed in OPENGL but the library I'm using is TheMidiBus.
You should use Midi controllers as boolean toggles and parameter control for the sketches.
If you have drawings triggered by a Note you can use a diferent approach, which is using the note to toggle a boolean variable and so toggle on and off the drawing algorithm.
So the drawing algorithm should look something like this:
Code:
void theDrawingAlgorithm() {
if (thisAlgorithmBoolean == true ) {
// Do some drawings
}
}
Then you can call the algorithm from draw() like this.
Code:
void draw() {
theDrawingAlgorithm();
}
your Midi event handler should be linked to the boolean varable. The boolean variable shoud be created before/outside setup(). When you pres the note the asignation should look like this
Code:
void your MidiEventHandler() {
if (aSpecificNoteIsPressed) {
thisAlgorithmBoolean = !thisAlgorithmBoolean;
}
}
This means that the current state in the boolean variable will be inverted and assigned back to the variable.
It's even better if you abstract the code into classes and make those drawings objects, they become more versatile, you can create new objects onscreen and do lots of things with them different from just draw them.
Hope this is useful