Sampler Playhead UI

Hi all,

I need a simple play-head that shows the playback position of a triggered sample across a waveform drawing in my sampler plug-in.
I have already implemented this by updating an atomic samplePos variable from my samplerVoice object. The play-head UI component is on a 20 ms timer that gets the samplePos variable from the sampler’s processor and updates the UI/repaints. Though this works, it is very sluggish and does not always update correctly. Do you guys have any suggestions?
I use a FIFO for my meters, should I be using a similar system for the play-head animation?

Thanks a bunch!

Make the play-head its own opaque component; this will prevent the parent component from repainting when the play-head element moves.

Use linear interpolation to smooth the pixel position of your play-head component over time; you can use the known Timer frequency to create a smooth motion.