In your processBlock method :
amplitude = 1.0f; // default to full gain here because of all the things that can go wrong in the following code
auto playhead = getPlayHead();
if (playhead!=nullptr) // playhead may not always exist
if (playhead->getCurrentPosition(info)) // even if playhead exists, it may not return valid position info
if (info.isRecording) // note that even this probably can't be trusted to work consistently across plugin formats and hosts
amplitude = 0.0;
Note that you can only use the plugin’s AudioPlayHead and attempt to get the position info in the processBlock method. If you need to pass the information outside the method for example to show it in the GUI, you need to store the information in a member variable of your AudioProcessor subclass.