I think I’m getting it figured out. The key is that every time I poll POS/BPM, I have to calculate bar/beat position RELATIVE to the previous position. I had been doing absolute calculations, essentially relative to 0, which only works if BPM never changes. Also POS/BPM have to be polled frequently enough that BPM won’t have changed too radically or non-linearly between polls, otherwise the calculated positions could slip out of sync.
Once I get my code stable and tested, I’ll post it.