metaParameter Loop problem with Lambda expressions

Hey Juce People, So I’m having some issues with some plugins I’m working with.
I’m using some parameters that set each other and therefore are causing a callback loop that I’m unsure about how to address…

The params are basically a cartesian system that transforms into a polar system and viceversa and I want the user to have equal control on either of them.

Within the GUI im using regular setValueNotifiyngHost and a timerCallback to sync the GUI and thats working just fine. The problem comes on the AudioProcessor side.

I’m using a subclass of AudioParameterWithID that nearly copies AudioParameterFloat but includes a Lambda expression for each parameter. Evidently this lambda expressions are supposed to change other parameters as follows:

xParam changes angleParam and radiusParam
yParam changes angleParam and radiusParam
angleParam changes xParam and yParam
radiusParam changes xParam and yParam.

I’m modifying setValue function to trigger the lambda so that it gets called from the GUI who is calling setValueNotifyingHost which eventually ends up calling setValue (just as in AudioiParameterFloat) and I’m using *Parm = newFloatAfterCalc to setValues from the processor (which eventually ends up calling setValueNotifyingHost) and ends up Calling the Lambda functions of the changed params which in turn calls new *Param = newValue and so on.

I’ve creating a new setValueWithoutLambdaFunction to be called, but then the Host wouldn’t be notified and automating params won’t automate metaParams (however GUI keeps sync as timerCallback reaches real *Param value)

Is this the way to go? When setting metaParams should automation on Params automate metaParams?

I’m kinda lost here. Thank you very much for all your help

Usually you can avoid these kind of loops by simply checking if the parameter value has actually changed. Sometimes conversion errors can cause a endless loop when converting from one representation to another. In this case I tend to add a bit of rounding to the parameter values.

Also, in general, I always try to expose the minimal amount of parameters to the host as possible, i.e. only expose the parameters in a single set of units (polar system for example). Your users will be using your GUI anyway.