setParameterNotifyingHost Question


#1

 

  • I've built a ValueTree which stores my GUI state.  GUI objects which update parameters change a sub-tree containing the relevant information.
  • I've added a listener to the ValueTree. 
  • The listener calls processor.setParameterNotifyingHost(...)
  • That calls setParameter(...)
  • setParameter(...) makes a thread-safe call to update the audio thread. 

However setParameter(...) is also called by the host.  When the host calls it I need to update the GUI, and the ValueTree, which triggers this whole loop off again, notifying the host of the parameter change that it just made.  Is that necesssary?  I get a duplicate update call into setParameter as well. 

I'm thinking that the solution is to call sendParamChangeToListeners directly and then the thread-safe audio thread update call. 

Is that sensible?


#2

Mmm, this whole things seems to have been played out before: 

http://www.juce.com/forum/topic/updating-editor-controls-setparameter

http://www.juce.com/forum/topic/improvements-handle-au-parameter-ranges?page=1

http://www.juce.com/forum/topic/waste-cpu-time-induced-redrawing-everything


#3

Though not with a picture: 


#5

Thank you - I don't think I can easily use it but it's interesting to see what you've done.  Unfortunately i've got existing users with an existing format for the plugins. And I'm building the whole plugin from an XML/ValueTree setup which would need work too.  

But it's good to see how you're doing it.