Hello all,
EDIT: I will say that I am on Windows first and foremost, and it is a VST3. Just to put that out there.
Essentially my VST plugin is for storing presets for rigs of other plugins. So each patch has a bunch of parameter values, that when changed between patches will update the parameters in the apvts, which I can then link to parameters in the other plugins, in the host - REAPER. I have a bunch of on screen buttons to select through 8 different patches, and then buttons for bank up and bank down, just for testing and editing the patches. Then I have exposed parameters in Reaper, that I can midi learn to buttons on my midi controllers to actually toggle them when performing.
I posted another thread entitled Changing a parameter value when another is changed?
Here I talked about how I found a solution in using juce::MessageManager::callAsync in the parameterChanged method. But someone called kamedin replied and told me this was a bad idea because of⊠reasons. The short of it is, kamedin advised me to look at a timer based solution and sent me a link to eyalamirâs posts.
I decided to look into this, and I have now changed my toggle method to set variables (such as what bank / patch should be selected) and then I have a timer in the audio processor which when a boolean variable called âhasToggledâ becomes true, will perform the actual switching. This does seem to work a lot better, and now the parameterChanged() does not directly affect other parameters.
But I noticed that the more banks that I added, the GUI became less and less responsive. It actually hangs sometimes for⊠what feels like a second in the worst case. There are ways I could optimise various things, but there doesnât seem to be anything that jumps out as obvious to me at this point. Apart from maybe some kind of data race between the audio processor and the editor which is causing it to lag.
EDIT: It seems all of my issues relate to calling setValueNotifyingHost(). If I comment these lines out then the problem disappears. Also if I close the editor, the problem disappears. The editor seems to steal GUI updates away from Reaper when it comes to doing anything with notifications. If I go into Reaperâs settings I can set an option to ignore processing notifications. If I select this then pressing the buttons in the GUI do not cause lag anymore, but pressing buttons on my midi controller still will (while the GUI is open).
Now⊠In my editor code I am getting references to data in the audio processor in various methods, such as the banks of patches, for displaying etc. This is basically a 2d vector with 16 banks of 8 patches per bank.
So many questions, not sure how to even begin attacking this problem. I have been looking at lectures , some by David Rowland, about real time audio programming design patterns. These videos:-
and
But at this point it has left me with even more questions about how to begin tracking down exactly what this problem is⊠or could be. So I am now starting to think that I could be going down the completely wrong rabbit hole. Can anyone point me in the right direction? Any help would be appreciated.
Thanks.
EDIT: I have tried to edit this post to reflect what I believe the problem to be or related to, as I have been testing and commenting out functionality. As such, the original title of this post has been changed as well as some of the contents of it.
