I have a MIDI controller going through Max into an mxj object which allows the controller to act as a "meta-controller" -- for example, allowing me to switch MIDI channels or have higher level control over CCs. All of the above is in Java without the Processing libraries, developed in Eclipse.
I want to visualize what I'm controlling using a Processing window, so I wrote a PApplet that does that. There are two difficulties I'm having:
- Is there a 'right way' of giving the PApplet a reference to my meta-controller object, so it can visualize it? Right now, instead of saying:
Code:PApplet.main(new String[]{"MyApplet"});
I say:
Code:MyApplet applet = new MyApplet(metaController);
And then call a method that acts like PApplet.main() to setup the window and whatnot. (If PApplet.main() returned PApplet, I would have used that and passed the metaController via a separate method -- it'd be great if the meat of main() was in another method that returned the PApplet, and main() simply called that method).
- The way I have is working for now, except: if I close the Java window before closing Max, CPU usage goes to 99% for Max and it takes a few minutes to stop the Max process. Also, if I close the patch alone, the Java window remains. Do I need to stop() the sketch before closing the window? Any ideas?
I'm very familiar with maxlink and other UDP solutions to Max + Processing communication, but it wouldn't be right for this project -- it would be unwieldy to send all the visualization information across the subnet.