Implement CC Learn and timing for parameter change


I am currently developing a host software that needs the CC Learn feature. The question I have is about the timing of control messages, and how to set the parameter values at the exact sample position during the rendering/processing of blocks?