(VST) setParameter called twice at setParameterNotifyingHost


#1

Hi everybody,

I found out that setParameter is called twice in a VST everytime that the host is notified with AudioProcessor::setParameterNotifyingHost…
juce_2.0\modules\juce_audio_processors\processors\juce_AudioProcessor.cpp : 111 (1st call)
vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp : 266 (2nd call)

So it might be a good idea to remove juce_2.0\modules\juce_audio_processors\processors\juce_AudioProcessor.cpp : 111
and add if needed an extra setParameter call in the AU or RTAS wrappers (in method void audioProcessorParameterChanged())
(I don’t have access to both libraries now so I can’t confirm if there is such a need. Anybody can help with this?)

Also, Jules, what do you think about adding a AudioProcessor::notifyHost() function?
I found myself in cases where I didn’t need to call setParameter when I was notifying the host and I got around it by inheriting AudioProcessor and calling protected method sendParamChangeMessageToListeners (index, newValue) but it looks a bit nasty…

Thanks much


#3

+1 - I don’t think setParameter should be called twice and I’m calling sendParamChangeMessageToListeners from my code too, for the same reason.


#4

Sorry, I didn’t see this thread…

Hmm. Might be better to just fix the VST rather than change the base class. How about this, in juce_VST_Wrapper.cpp:

void audioProcessorParameterChanged (AudioProcessor*, int index, float newValue) { if (audioMaster) audioMaster (&cEffect, audioMasterAutomate, index, 0, 0, newValue); }


#6

Well, there isn’t really an concept of a “host” in the base class, there are just listeners, so calling that method to send a change to the listeners is exactly the right thing to do, isn’t it?