I am creating some standard biquad filters that I also plot the response curve of in my plugin.
But one question that popped up in my head during my development is where the filter coefficients ideally would be calculated?
Would it be better to have them calculated in the GUI thread and sent as messages to the process thread?
Or would it be better to have them calculated in the process thread and sent as messages to the GUI thread?
Since the filter response curve is dependent on the coefficients for plotting the curve and also in the process function. My initial thought is that they would be calculated in the GUI thread since the process function only should consider the filter processing function?
The filter coefficients in the process could be processed in the process call if this is not too intensive to compute. If it is too much computation you may create a background thread for coefficient computation and sync them to the Audio Thread…
For the UI part (if you want to display the response curve) you could have a separate filter which is updated when parameter change are send to the controller (setParamNormalized)…from this filter you could extract the response curve.
I have a custom control that draws the filter response. So I created my filter both In the process class and my custom view class. (so they are two separate instances so I don’t need to worry about thread synchronization)
In my custom controller I do:
To register parameter changes.
And in the update function I update the filter frequency, gain and Q for example.