In my little bit of spare time I got to thinking about this controller API. I use WebStorm for refactoring and code completetion etc, and thought I don't think I could really maintain a bunch of projects without it.
Then I thought about Trappar's great repo he created for creating stubs for library loading in JavaScript IDE. I then thought about the ridiculous amount of time he would need to keep up to date on that API as things are added in the future, doing diffs of javadoc and then actually adding, plus maybe updating descriptions as Bitwig adds more info would just get out of control, so this project is for you Trappar.
I have quite a bit of experience writting compilers and cross compilers, so basically I wrote a Java application that;
- Reads the HTML javadocs of the current release
- Parses all the interface files within the iface package, creates a intermediary model with interface/function signatures and doc comments. (using jsoup HTML parser and DOM).
- From this model it emits actuall Java source code for each interface basically creating .java source files
- Then I use a nother parse to actually parse real java into AST.
- Once we have the AST for everything, comments and all it then uses a visitor pattern to emit the javascript stub files in the api directory.
Here is the output of the NoteInput parse
Code: Select all
function NoteInput() {}
/**
* Assign polyphonic aftertouch to a specific note expression. By using multiple midi channels multi-dimensional control is possible. When set, the key translation table is also used for polyphonic aftertouch.
*
* @param {int} channel - MIDI channel to map [0 .. 15]
* @param {NoteInput.NoteExpression} expression - the note-expression to map to channel
* @param {int} pitchRange - range of the pitch mapping in semitones. Ignored for non-pitch expressions. [1..24]
* @throws com.bitwig.base.control_surface.ControlSurfaceException
*/
NoteInput.prototype.assignPolyphonicAftertouchToExpression = function(channel, expression, pitchRange) {};
/**
* Send MIDI data directly to the note input. This will bypass both the event filter and translation tables. The MIDI channel of the message will be ignored.
*
* @param {int} status -
* @param {int} data0 -
* @param {int} data1 -
* @throws com.bitwig.base.control_surface.ControlSurfaceException
*/
NoteInput.prototype.sendRawMidiEvent = function(status, data0, data1) {};
/**
* Specify a translation table which defines for each key which key (0-127) should be sent from the NoteInput. This is used for Note-On/Off and polyphonic aftertouch events. Specifying -1 for a key means it will send no event. Useful for providing transposition or scale features through the controller scripts. By default an identity transform table is set.
*
* @param {Object[]} table - an array which should be 128 values in length.
* @throws com.bitwig.base.control_surface.ControlSurfaceException
*/
NoteInput.prototype.setKeyTranslationTable = function(table) {};
/**
* When true (default) the events defined for this note-input will be consumed but the input and will not be sent to the MIDI callback of the port. Set this to false if you want to use the events defined by the mask both for the NoteInput and your callback function, or if you want to change the behaviour dynamically. This setting is true by default.
*
* @throws com.bitwig.base.control_surface.ControlSurfaceException
*/
NoteInput.prototype.setShouldConsumeEvents = function(shouldConsumeEvents) {};
/**
* Specify a translation table which defines for each input velocity which velocity should be sent from the NoteInput. This is used for Note-On events. Useful for providing velocity curves or fixed velocity mappings. By default an identity transform table is set.
*
* @param {Object[]} table - an array which should be 128 values in length.
* @throws com.bitwig.base.control_surface.ControlSurfaceException
*/
NoteInput.prototype.setVelocityTranslationTable = function(table) {};
As you can see, I just saved Tappar the trouble of adding the new Bitwig 1.0.11 NoteInput.prototype.sendRawMidiEvent() function.
I just have the little bit of inheritance to do and its basically ready to start creating these stub files for controller API developers.
@Trappar if you read this, do you want me to use my fork and send pull requests of the new api? Or just create a repo in my github account?
I am going to have a separate repo for the actual Java parser code.
Let me know.
Edited: spelled his name wrong.
Mike
