Have you considered making your own encoder?
Yes, I had thought about this, and for a long time until I knew about the $30 encoder mentioned above, I thought it was my only solution. But $30 kind of changes things - the only thing I hate worse than wasting money is wasting time, and it would take me a fair bit of time to construct my own encoder for this project (although I'm sure it would be more satisfying in its own way!).
The problem is, I'm really going for as good as one millimetre resolution over the length of the slide, which the $30 encoder can do as long as some PID adjustments for the velocity of the slide are made. If I wanted to do that with my own encoder, I'd have to have very fine intervals in the encoder wheel, and trust that vibration would not interfere, and that the hardware hacked from a mouse would be up to the job (i.e. max rpm of the wheel).
Your idea of making intervals in the encoder wheel specific to the slide positions is interesting, but I'm aiming for the next level beyond that even with the first prototype. In practice, trombone players can make small adjustments to fine-tune the slide from note-to-note, depending on the musical context (much like vocalists in a choir), which is why a trombone ensemble can be the most beautiful of all homogeneous brass ensembles. Moreover, having the better-than-one-millimetre feedback resolution will allow programming for that most tromboney of trombone sounds, the glissando! Even in a single tune of constant tempo, the rhythm (i.e. how fast) and the pitch (i.e. how far) between two notes in the trombone part will be quite various, and presuming that there might be glissandos between some of them, then quite fine (in time and space) measurements of the slide are necessary.
If I just wanted to clumsily snap the slide between seven different positions, I might as well just build something simple like an autonomous recorder player. Which I am doing.