Sliderpack always returns last changed index
-
@d-healey said in Sliderpack always returns last changed index:
It doesn't return the slider's value, it returns the index of the slider that was changed.
That, I understood from the start, sorry if I'm not clear...
Then I can do
component.getSliderValueAt(value)
to get the value of the slider.Maybe you expected it to give you the last slider's value that has changed directly instead of the index?
@ustk said in Sliderpack always returns last changed index:
@d-healey do you have a specific use case for this?
Yes, see first post :)
I re-read it and don't see where the problem is. It's not clear if you want to change and track all sliders, or only one of them. In the first case
value
isn't your friend so you have to track the sliders indexes with another method to get the associated values, in the second it gives you the index of the last slider (so here the unique) that was changed so all is good. with thecomponent.getSliderValueAt(value)
method -
The project I'm working on is complex.
We have 35 effects, each with 3 knobs (so 105 knobs in total), but only 3 knobs are visible on the UI at a time. When the user changes which effect they want to edit the knobs are re-linked to the correct effect (what we actually do is change the sliderpack slider index we are changing). In order to store the values for all 35 effects in the preset we use a sliderpack.
So the user moves one of the 3 knobs on the interface, this changes one of the sliderpack's sliders. The sliderpack callback triggers and changes the knob of the effect. To find out which slider was triggered we use the callback's value parameter. This works fine.
The problem is when the user is using MIDI learn they can change all 3 knobs at the same time, but only the index changed by the last knob is being returned by the sliderpack's value parameter.
It's as if there is an internal timer that groups events together (like for the undo system) but the sliderpack is not using the undo manager.
-
@d-healey Now I see the issue.
Is there too much overhead just doing this:
local params = [param1, param2, param3]; for (i=0;i<component.getNumSliders();i++) myModule.setAttribute(params[i], component.getSliderValueAt(i));
So you always set all parameters even if only 1 or 2 actually changed.
-
@ustk I'm aware of the workaround, loop 105 x 3 each time a knob is moved. There are other workarounds too that aren't quite as extreme.
But the point of this thread is to figure out why this works as expected:
inline function onKnob1Control(component, value) { SliderPack1.setSliderAtIndex(0, value); };
But this doesn't
inline function onKnob1Control(component, value) { SliderPack1.setSliderAtIndex(0, value); SliderPack1.setSliderAtIndex(1, value); SliderPack1.setSliderAtIndex(2, value); };
-
@d-healey You're right in assuming there's a timer that coallescates the events - this is the general system that prevents multiple calls from clogging the UI.
I've fixed the other slider pack issue so that it behaves like any other control and I think this will also help with this problem, because now you have to call
changed()
between the calls.inline function onKnob1Control(component, value) { SliderPack1.setSliderAtIndex(0, value); SliderPack1.changed(); SliderPack1.setSliderAtIndex(1, value); SliderPack1.changed(); SliderPack1.setSliderAtIndex(2, value); SliderPack1.changed(); };
But this should fire the SliderPack callback with the three different indexes.
-
@Christoph-Hart Yey, thank you!
-
@d-healey this doesn't look scary at all! Will this mean that old projects will need updating?
-
@DanH I don't think so.
-
@Christoph-Hart Still not quite working. This simple snippet will demonstrate the issue better than I can explain it.
HiseSnippet 884.3ocsV0sSSDDEdlBC5VEhX7JuZCWsMTIsJhlfFKzBlFEnwhDuiLL6ztSX2YZlcVfpgWDeZ7Qx2.8L6tvt.MHzDaHjd94aN+Lmy2zdZEiGGqzHry9iGwQ3GS5OVZBZGPERT2NH7BjcnwFt1MS0liGQii49HLdlOZUfclEk942eXSZHUx3EpPnCTBF+yhHgoPauVeRDFtM0muuHpj2q1pKSIaqBUIP9LCoAZDkcLcHeWp0sJDDdts7EFktugZ3wfOap7G2OPcpLy+CDwhiB4Vgln9vAkoF0NPD526hZMFgvy1qnxmIqxeFYGgu3R8EcfmjZvs.Q4d.txskRMuGoDtTJMaVJsHoOSKFYJrXymGQ5JgKjATnUWNUx7EU44UHsUfGRyJQzi4aqAgKQ3sViF0cg+Ua8pUg1crw8Dp1senvmq6A86ltu28B3C4l1pnQJIH3sTIeVxhVHCERt6fDIyHTRWkbyDiQIaZgqUgdrKvVGhQXBuV0eT0QLv0KWxADcFnztdBHnMV2U39txYhM96lDkoI1qF3vxKCvRw4T1wXtISbCnR84m4Ip6tC0DrhlJ8UQd0f78ZPXAT4PtuWpkyqB+cNTSStxyqqkpYCTd00lFFdDbRdWurgCrTKYWkgumzKszqddU2qaZvfIZK+rB45IZ1t3nuMfdxjni35xMdqivj0UGWm6tMtxxZKkbTI6JEl8Fwyk2VE5aGCse+lC2n79J7su1sC0Psy645.+Fw0FgMcvc3m.DFYS+NjN73iMpQvt+kWFH7CLoVeZ9tQwcJR.wedRoKYzYErK62ZbYgSE9l.Dlf+IFgB3hgAFqTcPJldBuqrmlCW118JTofOWVvWHO3Y27oA1gjOFTJn+ZXof156st9IKh2QEAmKUCtgqftIC.v8n7SBolqRHYYdyM.W6WgEvtoKiElwkYluGrTMtUVp6ZJtHomvvBlbNVYB4HLP7+HGy41mmr0fAbloHAmkr82lVh7+Q3+hJwHjCA9Gs.lEHVJL3IMFGhtTxCisCZUrKEYxMrx1NPetzOU3OvmbiMsx3biMuvHJhxzpCYYK61WOdXpFHmjoOV5.uZCxtMQoD..NRiUZfhfGxNjwrk+Kf8zIi4kSAlWMEXVcJv75o.yZSAl2LEXd6shw9aH1HwnhxVG.E81JkIDi2RRgIqzoPzesx9d9I
-
Bump bump - SliderPacks have a new and fun problem :)
-
@Christoph-Hart @d-healey and if you read the value it is indeed here and updates:
HiseSnippet 1044.3ocsV0saaaCElxILa1qsXcXWtKDxUxnYF1acsEnaXNwIYvnKoFyoA6tBFIJaBSQJPRkF2grmk9lrd+dY1av1gTxVzoNYCFqFAA37+24nyObjRFS0ZoBEz7r44TTv8vimKLSGLkvDngGhBd.9Dh1PUgkrNXdNQqoInffs9IKiflaib+9qe7.BmHho0rPnykrX5OyxXlZti5+BFmeLIgdFKyS6G2eXrTLPxkE.d1B2EkShmQlPOkXUqAFEryQILiTM1PLTMJX6CjIyGOU9FQo9myzrK3TKQOzXvQkrOVxSrH1xEMXJimLZQdqQfWFUWE1prJ7k3SXIrk7qqFetSPXsE90ifFqBusVAd87gWWO3sFHE3AosKgzCwiiUrbSsDKd9L7PA7wIk.kcenTpKpwe1.OPBZHLcxHynGq.hkVD8jtc2KD9W6m2pET50lvKIpvwbVBUMBp88B+gvElOgZFHyxkBfHZWOc10ZMSvYBZXZgH1vjhPo3fBiQJ5YMWI4QwKrcOHF7BZ6V+VqlrzvnJpl.YyToJLhAAs6yCYgeuORrw+zhrRN5n1fBO5QfYN6Z5qnlZJI2GxzD5UQr8BOgXl1QQDIxrn1.dugIwSIhIzjHmjqaA+cMjSqOyqxqcaaCTU1Mfv4W.dJ5losszzZcUmWHjWb20FPnVxocxULHr2nRTRdtU48MUkPHV.pWOncg61frOV.m3gxSkF5KEQN7z55Vg2TTZ5ZkU4KNUsVw1od0cYXjnH6BpxuZXUDFEVc9Be6yW9i+wkkDOEkhgBl4k4TwssT.UUGsyhUnBT03lDeP0jX4GADCF39DrqHhb.tdi1W0G8pgGRLjEtA7HDkbpxvrIPvgzKg8ikC3MwGR0yLxbHPK+zAttLnewJA01H3B78wdcFnqpC8Y8m6S7FVhY5RFuad+oT1jo0KkeupulbIcnXjhBMI1UHHOPrypYdYStC.MwUc7dA+8S7Bd+29AdloOQlA9kn.0BZ3Gn68uVhukv7teuu1L29weGmhnLVRBmNRpY1lKuyT+AbMKeL6sfpXbuNcAME9mrxHdkwN80EoorqbmeRY7LsAv0vL3pj8axqzzvDZJofaB0y.+.y4ynImIc5i9vs3v8CYRAmXV8nh8RZk.KX82ja2VKfjXt+k1+2tz7eEhODOhYhmtdL1XMXD53+Xfwp6y2GeTZJM1TCvswG+qebNFi9EYggIl.2PT1FAr8LD7DkXJDcgfxsahftXqoN5tVZaEXLUj3H9a3WkvdV5fJg8VHDZ5hUxWGWtow9BfO0wAvjv83mlvqv.5vkqXv3ttV2D1qiiso+W2CgVuMeyFXy2tA173MvluaCr4IafMOcCr4Y2oM12AtegQlUNN.LFcjaUePvQBBzY45BQ+CP7MLhM
-
@Christoph-Hart It seems this issue is only in HISE and in the compiled plugin it's working okay
-
Issue has been resolved - https://github.com/christophhart/HISE/commit/1b51f15c36d27419712309b279cfde6e097fcc9e
-
-