I built a simple gain plug-in and managed to modulate the gain value in sync with the host. For example every beat change the gain to a random value. I used currentPositionInfo and did some math. Everything is fine but it works only when the host is playing. I would like to have it always changing value (in sync) and when I hit play on my DAW should resets/sync to it. What's the best way of doing it?
I was thinking perhaps to code some kind of LFO with a square wave and sync it with the host tempo, then resetting the phase everytime I hit play. Problem is, I don't know how to do it :) I know the theory of LFO and waves but I'm not sure how can I code it and making it always running. Any suggestions?