The algo is the following, in order or priority :
1 . If a voice use the same midi note, the engine uses this voice and retriggers the sound...
2 . If there is a free voice (playing no note) use it.
After this all voices are playing note :
3 . If there is one or more voice that are in "release mode" (midi note off has been receive but the note is still playing), use the older one.
4 . If all voices are currently playing active note, any new midi note on will replace the older one.