Overview of functionality:
ROTATE > Incoming note always takes the next available ch.
REUSE > If incoming note is repeated (already assigned to one ch) takes that ch, if not, it takes the next available ch.
RESET > Incoming note always takes the lowest available ch.
REASSIGN > Similar to RESET but when releasing notes they are reassigned continuously from ch 0 (keeping the order)
UNISON > Incoming note takes all 4 ch.
When receiving more than 4 notes "stealing" occurs, always taking the next ch.
When keys are released, still pressed notes that where stolen are recovered.
In modes other than REUSE (or UNISON), repeating a note with sustain pedal rotates it over the channels producing "unison".
When using sustain pedal and playing and releasing many notes, still pressed notes are stolen, but they are recovered when sustain pedal is off.
I tested every possible combination of note(s) on off / sustain on off.
also added a pulseGen for re-triggering notes when necessary
(I also added the MIDI channel if on MidiMessage)