Sliderpack resize "issues"
-
When Sliderpack is set to for example 16 steps, then changed to 8 steps and then back to 16 , the 8 steps that went out of "scope" have lost their values.
Is there a way to retain the values ?
-
You need to store the value of the additional sliders and restore them when the number changes. You can use a data object for this.
-
@d-healey Sweet , what is a data object ?
Invisible sliderpack that holds all the values ? -
@lalalandsynth
Engine.createSliderPackDataObject()
I think... you could also just use another slider pack. -
@d-healey ah , ok , Engine.createSliderPackDataObject() is not in the API as far as I can tell.
-
-
@d-healey AH I was searching for the "object" part.
Thanks ! -
@d-healey Could this method be used for copy/paste shapes with the slider pack and table ?
Or even undo /redo ?
Undo/Redo manager does not work for Scriptnode sliderpacks and tables.HiseSnippet 1987.3ocuY0sbaiaEFzVvwhab5l1z64r2T4ooZDkrjkZlo0Qx16pcWaqtxwM6zYZJDIrDpIIXHgjs1LYldYeL1Gk9HzGgbUutuAsGveDgr0Oz1aK0LZHN.378gCNmCvQpW.2hFFxCPZEOepOEo8Tb+odhQcFQXdntGhzdF9DRnfFXDKp8TeRXH0Foos4WJEnUr.J54e+6aSbHdVzLQHzEblE8aYtLQlzdG7MLGmiI1zyYtJiduC5Zw85vc3iA9rItBxmXcEYH8ThbXafQZacjMSvC5KHBZHRC2laOs+H90dwi+BVHafCU1vD0GTTr3i4N1RFKe+rIzfIL50pxPcFwbr6kZKBQHsB8xrLaFaYdA9DlMal7LKzmG0gQ1LTsQZaLOk2bNJapR4JJTdATRSgREhozyw8sBX9hrdj74yvc8fMrKIvVgBU1HdrnM9Uaf6vgQ3IJ6Rthdb.zX1LJ0nRkWZTuRkce0N5weXdNLOpwki8rDLtmA2armMusvSpk.tSIKtqO2Cz2KMlPbFS2cG8OritA7vtznTrHPPQoji7FBJqrTCkjPHk8wcz+H7ZJoFREcR0XouHAquX2xgR4QH1g33L.7MJcaprJRGPyAoKtTFKmd9XbBPKiwyyicekBEOkKnm4UZW8OnWT+i5F2tqKubg8knJGZvB6VFkErpIVxar6.ZPpgHcffa1pB2LWV3lUrUQYfbutdLwY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5zblAC5zLsyrRuPmREIgmZZIuCqk3snCC8SEcAMHT5aCmyVoL7A8ZGG90xLJrDudXuKRVOtyT+QbOlkTT7HRo9qc4iiNFOh+eEI7bByQFlnswovAGf1OlXAFwo8HxjMOGKqqD7coAksl4COGuxbchhU.6cOR.wkJ.9FaqkJN8GXJ1NAbxMJKHbc5TGYHRXS4HisCQbYq3eJLKo236DwI+mid+xH5A9DkUFysXTtQuPVBjyIACohvjSMbn2jdg+j.iz2PxzK1zaR07QfioMnungq8FbiJYUozZVoI+v9Jkt.eUa+xSNp1jY8Op47i+VkxnXdkw4osfLGmv7tHtrErzGAcB4lYsMg1Ry4Svwhd8XA2EBThV6HkJXtE.OUA.brBfqV4yQKGL3Tzlff45suf5KC+i8HhpbxiFEXOGhyvvcrifMGFl2BiZUUwvbNLjXtRTJDiRnEA1DWmYKogNzYql62nZ8bn4gDWWRd07NPm60Z+562zb0JOx3rMNzkyA2+Ls+B45sR7i4dspXZ1vTArswxNyv6oRxTuR8ZR3xrZKTKqaopG6N3xsy6p8oQq1l60n49qewVDCZFRJHVs+ViEr8O2nWGNaEWWy5VBy6FOWWqCAL1lE7PAXMKgshMUWQmFN0yZ0lpVqNzr+Uzqiywt1P0n8eHGZN22ymYZaLHeDW7S5VgR1snaFIaMUl7N5vrtgWH6ExEjpF3vw1b9UtjnikeP+fO+e4RDtDq.96RNCTt31NRBXR7h92aJhOQ11X1ulVrozkYydmkk7xn+F3hrKdNUe.yo1CXN68.lS8GvbZ7.ly9Of4zbkyQ9mVkbzq7JaffdGEeaAsi7jWoH973+Kn.wSbC
-
@d-healey said in Sliderpack resize "issues":
You need to store the value of the additional sliders and restore them when the number changes. You can use a data object for this.
That‘s actually pretty hacky. A clean solution would be the possibility of defining a fixed upper limit and then the resizing would just change the pointer instead of reallocating new memory when you resize a slider pack.
This should be rather easy to implement, I‘ll see what I can do later.
-
@lalalandsynth here's what I'm using...
inline function onARPSLIDERSNUMBERControl(component, value) { local lastAmount = SliderPack5.get("sliderAmount"); for (i = 0; i < SliderPack4.get("sliderAmount"); i++) { SliderPack4Data[i] = SliderPack4.getSliderValueAt(i); } for (i = 0; i < SliderPack5.get("sliderAmount"); i++) { SliderPack5Data[i] = SliderPack5.getSliderValueAt(i); } SliderPack4.set("sliderAmount", value); SliderPack5.set("sliderAmount", value); Arpeggiator1.setAttribute(Arpeggiator1.NumStepSlider,value); if (lastAmount < value) { for (i = 0; i < SliderPack4.get("sliderAmount"); i++) { SliderPack4.setSliderAtIndex(i, SliderPack4Data[i]); } for (i = 0; i < SliderPack5.get("sliderAmount"); i++) { SliderPack5.setSliderAtIndex(i, SliderPack5Data[i]); } } NOTEAMOUNTLABEL.set("text", Math.round(value)); }; Content.getComponent("ARPSLIDERSNUMBER").setControlCallback(onARPSLIDERSNUMBERControl);
This was for two sliderpacks btw.
Would much prefer @Christoph-Hart's permanent solution however
-
Looks like Christoph's solution is ready :)
https://github.com/christophhart/HISE/commit/2b7471a257b3814949fcd8c5f855ca2ae29d4bfc
-
@d-healey Awesome!
-
@lalalandsynth so how do we implement this?
-
@DanH is it something like
Sliderpack1.setUsePreallocatedLength(16);
Assuming that our max limit of sliders is going to be 16?
-
Basically yes, but I haven't pushed the autocomplete yet (I did just now). I also made it accesible through the SliderPack class, not just the SliderPackData class like before.
-
@Christoph-Hart Thanks. I'm getting 'Unknown Function' error...
HiseSnippet 1158.3ocuW0sSiaDEdbHCcSnvBaWodazdEqJMJdWJcWUUUHPnMkEvByhVo8hsC1mjLBmYbsGSIspR8coOU8snuAsmw1I1ALYchn0WDk4727Mm+lyXEHcfvPY.wn14i7AhwmRsGITC1e.iKHcOfXrF8XVnBBZjPp8HeVXH3RLLV560DLpUkD+82eWalGS3.YjHjKjbG3M7gbUFUqcOh64cHyENmOLmzauaWGoXeomLBwyRzVDelyUr9vILsXUnDik63xUx.aESAgnLsktirGH+EQh7WvC4W5A5ElDazPIjI6Of64ZM9rFRHFUsxN4KkbxeJ8XtKeB8LOv5wLZjoQdefQkogT0of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aNAxO3jjOpeuzihofXRD+TwZ3aVw0MxFtk1ROrG9LtO33ncEeIh8h04EKfNubAzY6EPmuZAzYmEPmudAz4UyTG8Kn2KRIGlTlfDr5D+L.CijKhiyHI+6tvtFm
-
@DanH
SliderPack1
notSliderpack1
-
@d-healey doh!
-
@d-healey also is there a better way of controlling multiple sliderpacks from one SP than the below?
inline function onSliderPack5Control(component, value) { SliderPack12.setSliderAtIndex(value, component.getSliderValueAt(value)); SliderPack13.setSliderAtIndex(value, component.getSliderValueAt(value)); SliderPack14.setSliderAtIndex(value, component.getSliderValueAt(value)); SliderPack16.setSliderAtIndex(value, component.getSliderValueAt(value)); }; SliderPack5.setControlCallback(onSliderPack5Control);
I saw a linkTo API....
-
@DanH If you want them to be completely linked, so that changing one will always change the others, then you can use a data object.
HiseSnippet 879.3ocuVstaSCCE1taFQKWDCwCPz9Um.pZKitMgPqqWFTfsTsNXf3GSdItslkX243LnfPhGEdm3Eg2.33jrlTnL1pDjeT0yU+cN9juS5pjNrf.oBgyu+3QLD95jdiE5gMGR4BTmVH7MI6PCzLkUrpFiGQCBXtHLdgmXTfyuHJ546a1f5QENrTUHzqjbG1K39bcp1t0eN2yaapKaeteFuWsdGGonozSFB3YARYzHpywzArcoF2xQP3qz1kqkpdZplE.9zP5Nt2P46Ew9+Jd.+HOlQnBpGjnX0nlC4dtcOqVCPH7hcSq7Ehq76P1g6xmnOsCbqHCVoQjsGfycdPpxk.R3LPhDCokH8bT7Q5TKF7bMRGAbgzmBs5rPY2P+ddbWlpKz1.nPvXnqFmATtugIMkPbBcIe5wrsUfvj7TrV4x2yB9YkGUn.bIDnsBljpVTM05wVsEC3BVIGECpzsDt6wFvMCF8lxwhYRwoTkUp0JPNNCACX5lR+QRAHTb4L9rLDcFwRJVelZeYTlmFQ+oio5E3XpN8wT8ubL8CENZtTXIE6J0LaQwUJ7oB4K74BV+po98moMCfTROOlZllMuGnNu.KJB8OhotGTqdgrINBywSO8ckK1zmSb+IiiRQGAWaOhkHu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