hi , i use processing 2.2.1 the midibus library and live ableton as a midi output (using loopmidi for the virtual midi connecting)
i want to trigger different image in processing with different instrument of ableton using different midi devices.
my code works for a whyle: (3sec to 3min) and then gives me that error message:
The MidiBus Warning: Disabling noteOff(int channel, int pitch, int velocity) because an unkown exception was thrown and caught java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at themidibus.MidiBus.notifyParent(Unknown Source) at themidibus.MidiBus$MReceiver.send(Unknown Source) at com.sun.media.sound.AbstractMidiDevice$TransmitterList.sendMessage(Unknown Source) at com.sun.media.sound.MidiInDevice.callbackShortMessage(Unknown Source) at com.sun.media.sound.MidiInDevice.nGetMessages(Native Method) at com.sun.media.sound.MidiInDevice.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.RuntimeException: missing a pushMatrix() to go with that popMatrix() at processing.core.PGraphicsJava2D.popMatrix(PGraphicsJava2D.java:1812) at processing.core.PGraphicsJava2D.backgroundImpl(PGraphicsJava2D.java:2280) at processing.core.PGraphics.backgroundFromCalc(PGraphics.java:6983) at processing.core.PGraphics.background(PGraphics.java:6898) at processing.core.PApplet.background(PApplet.java:15122) at sketch_160111a.noteOff(sketch_160111a.java:52) ... 10 more
there is my code:
import themidibus.*;
MidiBus myBus;
void setup() {
background(0);
size(500, 500);
MidiBus.list();
myBus = new MidiBus(this, "loopMIDI Port",-1 );
myBus.addInput("loopMIDI Port 1");
}
void draw() {
int channel;
int pitch ;
int velocity ;
}
void noteOn(int channel, int pitch, int velocity ) {
if (channel == 1) { // kik
background(100, 250, 0);
}
if (channel == 2 ) { // rim
ellipse(50, 50, 80, 80);
}
}
void noteOff(int channel, int pitch, int velocity) {
background(0);
}
void delay(int time) {
int current = millis();
while (millis () < current+time) Thread.yield();
}
the same code works fine if i stay one the same device input but i need to have mutiple input devices to trigger diferrent image at the same time in processing.
i tried different things but i don't understand what's wrong and have always the same message error ..
hope someone can help me..