I'm building a little utility class on top of promidi, but ran into a problem. The functionality I would like is:
Code:
MSAMidi msaMidi = new MSAMidi(this);
//msaMidi.addController(varName, minValue, maxValue, deviceID, midiChannel);
msaMidi.addController("myVar1", 5, 100, 1, 1);
msaMidi.addController("myVar2", -10, 10, 1, 1);
etc.
So basically a very simple interface for being able to assign midi controllers to my variables, and then the variables get updated automatically as the midi controllers change (a bit like how controlP5 works - but with midi controllers).
I know how to use promidi and have a callback (plug) for controllerIn etc. but my problem is purely a Java syntax problem (i'm more of a C guy). How do I pass my variables to the class to be registered? I know objects are passed by reference, but integers and floats are passed by value.. can I change that? or I send as a string (like in controlP5), how can I access them later?
P.S. I was going to use a HashMap to store all the registered variables and associated midi info using (midiDeviceID<<11 + midiChannelNum<<7 + midiCC) as the key. If there is a better way please lemme know...
P.P.S. I have to pass 'this' to the constructor of MSAMidi because promidi needs access to the PApplet. Is there anyway MSAMidi can know the PApplet without me passing it?
Cheers,