Latency compensation or How to delay automation data?


Ok so this latency compensation issue is starting to get convoluted.
I am making a plug-in with pitch tracking, and so i need to delay my audio to be in sync with the pitch data. so far so good. So ive checked and i found out that i am not only getting the audio earlier, but also the automation data and midi, so ive solved the midi by applying a midi delay (which is not an optimal solution of course, but i guess it isnt possible to ask from the host not to treat midi and automation as usual without the time shift).
Now i also need to apply the same delay to the automation data recieved by the host, what would be the best way to do that?