Controlling bands on Parametric EQ.
-
@lalalandsynth
component.get("max") - value
-
Hmm, not sure where to place that in the code to be honest.
I am such a noob , i hit a wall at every turn :)I am setting the ranges with the property editor , do I need to set the ranges in the scripteditor to implement any inversion ?
-
@lalalandsynth Yes you need to script it:
const var Knob1 = Content.getComponent("Knob1"); var invertedValue; inline function onKnob1Control(component, value) { invertedValue = component.get("max") - value; Console.print(invertedValue); }; Knob1.setControlCallback(onKnob1Control);
-
@ustk You cannot invert min and max in the property editor. min always need to be smaller than max, hence the solution above
-
This post is deleted! -
This works to invert the knob value.
// Invert loPass Knob; const var loPassKnob = Content.getComponent("loPassKnob"); var invertedValue; inline function onloPassKnobControl(component, value) { invertedValue = component.get("max") - value; Console.print(invertedValue); }; loPassKnob.setControlCallback(onloPassKnobControl);; ;
But has no impact on the control part , where its still un-inverted..I would assume that if the knob is declared as const var it would apply the inversion where the knob is called later in the code ?
// Invert loPass Knob; const var loPassKnob = Content.getComponent("loPassKnob"); var invertedValue; inline function onloPassKnobControl(component, value) { invertedValue = component.get("max") - value; Console.print(invertedValue); }; loPassKnob.setControlCallback(onloPassKnobControl);; ; // Control - Lopass; inline function onloPassKnobControl(component, value) { local index = ParametriqEQ.Freq + 1 * ParametriqEQ.BandOffset; ParametriqEQ.setAttribute(index, value); }; Content.getComponent("loPassKnob").setControlCallback(onloPassKnobControl);
-
@lalalandsynth A mix of the two ;)
// Invert loPass Knob; const var loPassKnob = Content.getComponent("loPassKnob"); inline function onloPassKnobControl(component, value) { local index = ParametriqEQ.Freq + 1 * ParametriqEQ.BandOffset; ParametriqEQ.setAttribute(index, component.get("max") - value); }; Content.getComponent("loPassKnob").setControlCallback(onloPassKnobControl);
-
@lalalandsynth you didnt set the eq to the inverted value...
inline function onloPassKnobControl(component, value) { local index = ParametriqEQ.Freq + 1 * ParametriqEQ.BandOffset; ParametriqEQ.setAttribute(index, component.get("max") - value); };
-
Ah, thanks ! Works now !
One more thing , in the property editor i set this lopass to max 20000 and min 400 , it seems to respect the max setting but it goes down to 20 hz , any thoughts on that ? When I start scripting a knob at all is it expected that i set the min and max via scripting as well or should I be able to combine ?
Also , the show value popup still shows the non inverted value .
Must say , flipping the values in the min max would be simpler ;) -
@lalalandsynth You can combine with the property editor for min/max, but NOT for processorId/parameterId. You must remove them if using script callbacks. And everything that is set by script overwrite the parameter in the propety editor
In your case (because min is not 0) you need to add it to the total:
// Invert loPass Knob; const var loPassKnob = Content.getComponent("loPassKnob"); inline function onloPassKnobControl(component, value) { local index = ParametriqEQ.Freq + 1 * ParametriqEQ.BandOffset; ParametriqEQ.setAttribute(index, component.get("max") - value + component.get("min")); }; Content.getComponent("loPassKnob").setControlCallback(onloPassKnobControl);
Of course, the popup still displays the original
Value
of the knob, not the inverted one you made by script... For this, you have to create your own popup label.Flipping the min/max would create some weird edge cases because it's checked in the Juce core.
Although, adding a button in the property editor to invert the value might be do-able, but I'm not Christoph :)