This is an addon for openFrameworks.
It allows to easily sync ofParameters (the ones used with OF's default GUI) with MIDI messages, like the ones coming from a MIDI controller. It works with any MIDI controller, although currently it only works propperly with the Korg nanoKontrol. It should work with any other controller but the controller feedback might not be correct.
In your ofApp.h file include the addon.
After the following line:
Add these lines:
Create an instance inside your ofApp class
Now in your ofApp.cpp file put the following inside the
Here, the first argument is the midi device number. you can find out the number of your device by calling
ofxMidiIn::listPorts(); which will print to the console the available midi ports.
The second argument is the ofParameterGroup that you want to sync to. Here we consider the gui object to be an instance of ofxPanel (the default gui for OF).
You can also sync individual ofParameters without syncing a whole group using:
linkMidiToOfParameter(ofxMidiMessage& msg, ofAbstractParameter& param);
ofAbstractParameter is the base class for all ofParameters, so it doesn't matter wich kind of parameter is, the addon will figure it out.
Then just call any of the following when needed.
Follow the example to see how to implement. Once implemented syncing parameters is really easy, you just call the
learn() method and move a parameter in the gui and a slider or knob in your controller and syncing is ready. This settings can be saved and loaded.
If you want to change a ofParameter/MIDIMessage pair just call the
unlearn() method and move either the MIDI controller or the gui param and this will get unsynced.
When syncing with
ofVec2f, ofVec3f, ofVec4f glm::vec2, glm::vec3, glm::vec4 or any ofColor you just need to sync the first parameters of it, the following ones will be automatically assigned to the following MIDI ContinousControl numbers.
- ofxGui (included in OF)
Made to work with OF 0.9
Currently needs OF v0.10 or newer or the newest nightly build.