I am trying to make a sketch that visualizes midi data sent from Ableton Live, using the proMidi library. Every midi note is represented by a little ball that moves across the screen. However, I can't seem to write it in a way as to have it deal well with the real-time and potentially infinite nature of the incoming midi data. I've been trying to do this by using ArrayList and adding objects on the fly, but I keep getting an "IndexOutOfBoundsException" error. Any ideas?
My code:
import promidi.*;
MidiIO midiIO;
int notecount = 0;
List<Ball> balls;
void noteOn( Note note, int deviceNumber, int midiChannel ){ pitch = note.getPitch();