The challenge with using track number for this use case is that once you insert a track or otherwise reorder them, the track-number-as-index now points to the wrong location in the gmem buffer.
FWIW, I've solved it this way:
https://github.com/jtackaberry/reati...ate.jsfx#L1463
However it does depend on a long-running Lua script to garbage collect deleted JSFX instances:
https://github.com/jtackaberry/reati...p/rfx.lua#L330
A native way to do this without the need for all this rigmarole would definitely be nice.