User defined array of values returned by slider
-
OK I'd like to propose this:
That along side Linear, TempoSync, Frequency etc. in the Mode of a Slider we add one more mode "UserDefined" - this would return a value from an array defined in the HISE UI by the user, like this:
Why would we need this?
Well if we have a slider that represents some set of values that are not evenly ordered, like say we were building a Pulteq EQ where there is a knob for CPS and one for KPS whos values are 20,30,60,100 and 3,4,5,8,10,12,16 respectively we have no simple way to get these values to show up in the value pop up when the user turns the dial....
Yes Im sure there is a way to do this with a dedicated local LAF approach, but that ties our slider to a single use scenario - and where we have sliders taking on different roles dependent upon the effect they are managing ( so slot based effects) then this isnt really workable... not to mention the whole timer finagling we have to do to get a popup emulation.
So if we have a new "mode" called "UserDefined" we can define the array of returned values that we want to see in the popup - and sent back to our callback and this allows us to "set" these dynamically like other slider properties.
Its up to the developer to define the array and to include all the values correctly - if there are more slider steps than the number of array entries it should just return the last value in the array.
-
@Lindon said in User defined array of values returned by slider:
not to mention the whole timer finagling we have to do to get a popup emulation.
You can customise the stock popup, no need to roll your own.
I think it's a good feature request though.
@Lindon said in User defined array of values returned by slider:
if there are more slider steps than the number of array entries it should just return the last value in the array.
If you select user defined as the mode, just hide the min/max and use only the user defined values.
-
@d-healey said in User defined array of values returned by slider:
@Lindon said in User defined array of values returned by slider:
not to mention the whole timer finagling we have to do to get a popup emulation.
You can customise the stock popup, no need to roll your own.
Customise with LAF? (for more than just the look of it) if so then as I explained its a non starter...
I think it's a good feature request though.
@Lindon said in User defined array of values returned by slider:
if there are more slider steps than the number of array entries it should just return the last value in the array.
If you select user defined as the mode, just hide the min/max and use only the user defined values.
Yes I hadn't thought of that - but yeah good addition. Also default the stepSize to always be = 1
I used to use this feature in KnobMan all the time - it was a massive time saver.
-
-
@Lindon Yes! I was thinking the same exact thing just yesterday. I would like the ability to pass in user defined values to the script slider using an array, similar to items for a comboBox.
-
@d-healey said in User defined array of values returned by slider:
@Lindon said in User defined array of values returned by slider:
Customise with LAF?
hmm, is this re-settable - back to the default?
-
@Lindon Maybe, can you give me an example use case?
-
@d-healey said in User defined array of values returned by slider:
@Lindon Maybe, can you give me an example use case?
OK
we have a panel in the UI with 10 sliders in it. This panel manages an FX slot....
There's a combo box in the panel to select the effect required.
Currently the FX is a compressor, and Slider 3 is managing the Threshold, so its set up to mode= decibels, max= 0 and min = -100 etc.....
The user swaps the FX to our Pulteq EQ, now slider 3 must manage the CPS, so the slider must change, Im guessing as follows:
Mode = linear
min = 0
max = 3..and now we need to add a setValuePopupFunction for this slider so the function transfers the input value as follows:
0.0 = "20"
1.0 = "30"
2.0 = "60"
3.0 = "100"..so all good so far.
Now the user changes the FX yet again, this time to a Delay, and Slider 3 is managing Tempo Sync, so we change:
mode = TempoSync
min = 0
max = 18..hmm now we have a problem....the slider is still using this setValuePopupFunction ... so tempo 0 (1/1) would show up in the pop up as "20" etc...
Of course I could write yet another setValuePopupFunction to account for this type of mode and the value set, but then I will have to write dozens of functions to manage all the scenarios for what Slider 3 is controlling.... so unless theres a way to tell Slider 3 to "stop using the setValuePopupFunction, and go back to using the normal values" then this function call is only really useful for non-dynamically assigned sliders...
Just to be clear here - I have a product in development with over 50 fx in it...yes its a monster but hey...
-
@Lindon I see. So what I would do is in the function I would check the mode of the slider, if it's one of the special modes then I would show the special values, if it's a mode where you want the default behaviour, you can just return the input value without modification.
-
@d-healey said in User defined array of values returned by slider:
@Lindon I see. So what I would do is in the function I would check the mode of the slider, if it's one of the special modes then I would show the special values, if it's a mode where you want the default behaviour, you can just return the input value without modification.
Well sadly that doesnt work on at least a couple of levels:
- There are no "special modes" there's only the std modes ....
- And if I want the default behaviour, i.e. input = a value, output = that value as a string Then this doesnt work when its tempoSync: so input = 1.0 output = "1.0" - is wrong as output would need to be "1/1" (for one bar sync).
-
@Lindon said in User defined array of values returned by slider:
There are no "special modes" there's only the std modes ....
By special modes I meant the one's you want to create with your arrays of values. I don't see it being any extra work to create the array in the script rather than in the property editor.
For tempo sync there is a built in function to convert the index of the tempo,
Engine.getTempoName();
-
@d-healey said in User defined array of values returned by slider:
@Lindon said in User defined array of values returned by slider:
There are no "special modes" there's only the std modes ....
By special modes I meant the one's you want to create with your arrays of values. I don't see it being any extra work to create the array in the script rather than in the property editor.
For tempo sync there is a built in function to convert the index of the tempo,
Engine.getTempoName();
okaaaay, Im not sure Im getting the first part - are you saying we need this "new mode"? or are you somehow working out what to do based on some other value? For instance in our example Slider 3 is set to Linear mode - in a number of scenarios, but only in one of those scenarios(PultecEQ) do we want to have anything other than the default returned...how is the function to know we are in PultecEQ "mode" .....I guess it could look at the combobox text....
Actually this is getting very messy very fast. Some sliders need to look up what the FX is , some dont, different ones at differnt times hmm.... its gonna be ugly, none scalable and not DRY
if(FX = "Pulteq and Im Slider 3)
do this
if(FX=Pulteq and Im slider 7)
do something else
if(Mode= tempoSync)
do that..and all we have done is handle one of the "slightly different" FX options...
Edit:::: actually I have to do some work to get Frequency mode to display properly too... I dont want to see "10,000" as a value when now Im seeing "10Khz"..
Damn it...... and normalised Percentage, and Pan
Basically Im just reinventing the current default behaviours....
-
@Lindon said in User defined array of values returned by slider:
if(FX = "Pulteq and Im Slider 3)
do this
if(FX=Pulteq and Im slider 7)
do something else
if(Mode= tempoSync)
do thatWouldn't you have to do this even with the user defined mode? Because you still only have one slider.
-
@d-healey said in User defined array of values returned by slider:
@Lindon said in User defined array of values returned by slider:
if(FX = "Pulteq and Im Slider 3)
do this
if(FX=Pulteq and Im slider 7)
do something else
if(Mode= tempoSync)
do thatWouldn't you have to do this even with the user defined mode? Because you still only have one slider.
no... Im keeping an array of properties that every slider needs to use, like this:
{ EffectName:"SOMEFX", EffectHardCodedName:"myFX", NumControls: 4, ControlText: ["Rate","Depth","Feedback","Mix"], ControlTargetNumber: [0,1,2,4], ControlMinimums: [4000,0,0,0], ControlMaximums: [15000,1,.98,1], ControlMultipliers: [1,1,1,1], ControlModes: ["Linear", "NormalizedPercentage","NormalizedPercentage","NormalizedPercentage"], ControlStepSize:[1,0.01,0.01,0.01], ControlSuffix:[" ms"," %"," %"," %"], ControlMiddlePosition:[10000,.5,.5,.5], ControlDefaultValue:[8000,.7,.8,.8], ControlsRow1:4, ControlsRow2:0 },
all I need do is add one more attribute for the Array values I want to use...and its all done for me.. by the default code(lets set up Slider 3 to be "userDefined":
{ EffectName:"SOMEFX", EffectHardCodedName:"myFX", NumControls: 4, ControlText: ["Rate","Depth","CPS","Mix"], ControlTargetNumber: [0,1,2,4], ControlMinimums: [4000,0,0,0], ControlMaximums: [15000,1,3,1], ControlMultipliers: [1,1,1,1], ControlModes: ["Linear", "NormalizedPercentage","UserDefined","NormalizedPercentage"], ControlUserArray: [[],[],[20,30,60,100],[]], ControlStepSize:[1,0.01,0.01,0.01], ControlSuffix:[" ms"," %"," "," %"], ControlMiddlePosition:[10000,.5,2,.5], ControlDefaultValue:[8000,.7,0,.8], ControlsRow1:4, ControlsRow2:0 },
-
@Lindon You could use that same data in the popup function.
Use Linear instead of UserDefined.
In the popup function you check if the ControlUserArray is populated, if it is you use its value, if it isn't you use the default values.
-
@d-healey said in User defined array of values returned by slider:
@Lindon You could use that same data in the popup function.
Use Linear instead of UserDefined.
In the popup function you check if the ControlUserArray is populated, if it is you use its value, if it isn't you use the default values.
Yes so one question and one objection....
Q: so in the function for setValuePopupFunction(f) can I even reference "this"? So I can find out if its ControlUSerArray is set?
Objection: see above: I cant use the "default" - well I can if I want it to look naff - its value in - string out, so Pan Mode will need some processing, as will normailzedPrecentage and Frequency, so in the end this function is just duplicating the existing functionality in the default processing.... so its getting silly I think.
-
@Lindon said in User defined array of values returned by slider:
so in the function for setValuePopupFunction(f) can I even reference "this"? So I can find out if its ControlUSerArray is set?
I don't see why not.
@Lindon said in User defined array of values returned by slider:
Objection: see above: I cant use the "default" - well I can if I want it to look naff - its value in - string out, so Pan Mode will need some processing, as will normailzedPrecentage and Frequency, so in the end this function is just duplicating the existing functionality in the default processing.... so its getting silly I think.
Yeah it's a bit annoying, but you just write a function once to format the result, so not too painful.
HiseSnippet 1132.3ocsV0kbaaCDFT1zMRoMSSmb.vvmja83Jp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Y8M1uEpOxushki.GA09in9mHLCszk0HKaan.BIgS2hdN58zKGHNmpS524LPyRYfOO59kArzlE+6st0LvZsJmA9s+bZFv1FZqLm4fGZOsi1+dl35C0fwoB+zPh5xyX0u9HWgd2Udvld3EG10iKu+tGCdabiCduqT7w18zM1mMGqLCNpKc+efi4OW4qr2OHf5oJH3h1c9448sI2R3OVjpfIKPu+DysliRi5COqyiBQmyogfysspn61jstgdsNCzmx8MK9a3WtRW8ZqbktSThhHdIh26k0tR+fnGXj.bhadvXU3kqvZ7LZxAUFr2qeeXYWcMfMmWfOcdAt17B7YyKv0mWfaLu.271Ape97KSUhnrxFD5vd6alqXYsOm.2.M2VQ+CQjqfv.
-
@d-healey said in User defined array of values returned by slider:
Yeah it's a bit annoying, but you just write a function once to format the result, so not too painful.
Yeah its not very DRY