Randomizer on 3 Grouped buttons, How?
-
@d-healey said in Randomizer on 3 Grouped buttons, How?:
I see, so use the index of the button (which you have in
idx
) to get the number of the mode you want, i.e.filtModes[idx]
How to Do This?
-
HiseSnippet 1586.3oc0XE0aZbDD9NaetAZcRSUUk5aq3gpCEhCXbRSqaTwfgDTMXrgD0pHqzk6VfU9XWxcKNFYY07Oq4+Seo+CRmc2i6NrwNNjDolyOD1Y2uY+1Ylc1YRKetCIHf6aXlpyjQDCyuxp8DlXPkAXJyn9NFl2v5fsatydMLJOYDNHf3ZXZt7ikyZlZEC02+9qkwdXlCIVjgwy3TGxtzgTQrzVk9MpmWMrKoCcXhUuYo5NbVEtGeLvjksxaLB6bDtOoIVtrkrLLWspKUv8aKvBRfg4Jk4tSZOf+Jld8OiFP65QjCJXzFTjVbMtmqjwRoFUFP8baM8DGX.ZoU74eY84+asZPcoQxisCesZBTLhj1CyktJ5UHI8xe8omYB5shld21psiOcjHdFI29Rq5LAwuGFbAIokdsFK82qZUgCqfIVeH9HRMeXPDB6GjOeNz8ymO6VqkFbCABzwXeTMpGrfBnGgTADq2mHp1qGwQXmIbpLyBXWbWhmb8S2J.QE9vQbFLvNidZEF4e2C9PM9CT4m1oydMairYfq1E4iYt7gndbeDii7I3.NKaxcoqfcfdMOB874uS53UXqxsVZz7+tJfarn.Ktn.2LS1CmisWF7GHOlYJSe4XrKZ2VYxM82OQ96c4uB0d.wqGp59vvmP6OHd77TYCtqVkOLG5mxgJ.N9BENbqHGRys6rM3LzzJz2Hmjx7nLBp2XlifxYHtxITui7T4y8rcldjxAal2XR1zmlVYI73NXuPu5yjy.adCLDNIEAgf1.C1L6VoCMQAbOx5i7ovDIvjcKXVs9n8P1Gq0yiPExpjc5TadTrwyS.9v0CHB0urKHC9t505L.y5SbsCozY5EKMAx+M8YakN8k3IU1iLYk6VnUoB1yqKjGy9bVqrw16NaWtb0cP0a1o5A01tRUT6JGTuUG47wttlOswKfE1FLcapfJucXSgg42BQQ+RzBfQ24NvskS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2E397wrwBfo3BfYyE.y8W.LOXAv7iK.lGdkXj0Ks8XAenN1DDzpptl.yppBpTgoF+GnfSLqN
This works, but the problem here is that every time you compile the last button in the array is selected, even when saving presets. @d-healey Do you know a way around this? I know in the Tabbed Interface video you can select which button to default to if none are selected but here it would be preferable to be able to save the state of the buttons.
-
@DanH Sir Thing Happens Here, Also I Made A Video In Other Thread, It Acts Crazy In Scriptnode And Instead Of Allowing One Node, It Unbasses All The Nodes.
Still Waiting For A Little Help Over This, Since This Kind Of Scripting Needs More Experience Or I Will Break My Laptop -
@DanH said in Randomizer on 3 Grouped buttons, How?:
This works, but the problem here is that every time you compile the last button in the array is selected, even when saving presets. @d-healey Do you know a way around this?
What about disabling save in preset and then enabling the one you want as default manually in on init?
-
@d-healey Then the buttons will never be able to be saved in presets... :/
-
@d-healey Not A Good Idea.
But I Guess It Can Possible To Trigger The Buttons Using A Hidden Knob Which Is Saved In Project
Or Vise Versa? -
I think in that case you'd need to use a sliderpack to save their values and restore them in the sliderpack's callback.
-
@d-healey Hmmmm.... sounds a bit much - I might go for a button that cycles through the array instead. I assume that's achievable - no doubt be in touch soon
-
HiseSnippet 1070.3ocsV8taaaCDmJwpHVatXcn66D4SxvYtxIscEHKXNwNYvXKIFycYCnnnfQhJlKRjBRTdwqHuB6YbXOA6MX6nnjkriZWhGF+h88+eGuSGuwwBWZRhHFYz70yinHiO0bxbtb5foDFGMZHx3wlmRRjzXrl0QyiHIITOjgwleqhgQyFnrye8MGQBHbWZIKD5BAyk98rPlrj639eGKH3DhG80rvJZ+79ibE7Ah.QJfmMMcPQD2qIWQOinTaCSjwiN1iIEwSjDIMAz4Hg27ISE+JWq+ErD1kATEQOzDvQZ1nASYAdiKx0DDxnw3xLeScl+TySYdrE7KuA9rLA3RKpdGXrwxPpwRPp2GBRmHB7TN3C.OiJvqgFdOwbhaLKRVJQgsOwbDGJN9D3ZuJrz5h13O2zbf.zfK6FRtldRLPrvB6W53rC9ENNs2ukUKqm8L7QoRofmzxBJDIR7kZR7A3271LU7EwXaFP6rOlg+Z7dvOc5ztk06aYggStAciRSlZWD3qnxAhvHAGHr2VGhswcTNpCtW61pnWw32vda2DkIbYrHX.IH3RnMvVv0xy42deqaUHhwCXbJ1Ok6JYBNdE0rcKh7N3YjfTpBqpfoCIyGamwFevA.TzLyyE0Y07sH+Bn7qjSKR9BsqX3cymKTgwtjmJhK.WwUPwYR.yiFOFx6dJa0jGBUNO5M1rcv2C2bawezrtUecA0XsyvJmWTmmQhqFRHequ1UQmsUwZEXd2RVEEVT2pupcWMqszoSlUKKKzTgW6sSzWWghTtDv4JUo5JKK4.MTxDbnzl0V2pUAqmIjzy41ssduUSqasvqJx2uVY44U.MtVwpggweLCs4ogWRiKtMJTDlPr7HnGc+FA4pKwUTTvGwYxyin4zkCo5UyPJTdOhZbUNBAnHyFV844CqJqpHF3nVlUJynrzn5iEdDIAY7El81sKb76zs7fP+3ngJw4AChKfkHZrjoRYigzYvCM5IkMMGRStVJh.3rn4EYXpg1iygldNTFrZZpI5gtATyPAk4p+fg+jPlQGwGGSgdE0fUzCxi6thG+o+ydbuU73u+u3wsd.EjaVTL9ieo+7xJyv9vB.QSX+VdOT0uuJ0Zq99AjjoGBcsynJXj.cVYeEc9LZb.YdFzt6CavyqBuz.hb42bUKWjK.9JXoG2TOfwSXx4UW93A7PrSsODWaO98DtOwbLS5Nsd7tQM3E5i++Fu4q0zx7XeepqrDrMLO4mW2cXd.P4GDoRF+pSIxXlpm8rzvIvlctT.IbNMHQ09tgZNhl1onudBk6kQ72vIWXOEsQtvdEBQgD2Xw6b0SeTKNsUFG.S7rcFaBKuBz3ECaLMc55fBg84dmqq5p3KArWuM6tF1r2ZXyyWCadwZXyKWCa9p0vlW8QsQsJ8goRQn9yDfw3iyFraXbLm.cYYcjn+AvQTwQF
-
@d-healey Thanks :) Is it possible to combine this with the random snippet above?
-
@DanH Sure, just edit the button callback
-
@d-healey Thanks, I'm thinking cycling through the array may work better for me. Been searching through JS forums but finding it hard to translate into HISE script!
-
@d-healey Had a bash at this and I don't think I'm approaching it in the right way. The sliderpack stores the correct values, but the sliderpack itself doesn't trigger the button callbacks needed to make presets work. In order for this to work the sliderpack itself needs to be controlling the callback functions (I think)...
HiseSnippet 1962.3oc0YssaajaFdjSlh0dWuM61EEn2QnqjPTr0nC9PcCpNXocUiOnXojtKBLRomgxhHiHUlgxGZfAbuaeD5k8QYutuJ8l8Mn8mjilg5jWaglhlI.Fh7+zG+OP9Sl1AbWRXHOvJ0pcudHwJ0WX24Zlne89XJyp09Vo9M1sahNo5Q6e7gnZupa2iOpiUsqGhCCIdVoR8nuUxXpUerk56m+i0v9XlKIYJKqWyotjCnCnhjYaW4ETe+lXORW5.CtKUokKmUm6yGAf5Q14sFhceG9bxQXIaqXak5W0viJ3AcDXAIzJ0iqw8ttSe9kLM+ulFROymHG3X0ATjd5lbeOIhkyZUuO02q83EenEnk1IthGocEei8gTOZ77ItjmnHfRjvzejZk6BdNlvK+8GdoLf2i0v6qr63FPGJRnHw1ma2hIHA8vPHvDVZdsV4EqZWmCbvDaL.+NRy.XPrDY1Je9bncxmO6dquFDFBEnKvAnlTefAGzyQpbiMNmHZzqGwUjIcDozSJvA3yH9R9GaJPh57AC4LXPlzZxJYj+aS3Cc3OLN6BkgAgZOT.l4wGf5wCPLNJffC4rrlV4LA6DMOOG8l4aIcdKXpbquFZ9e2kfEVVAKtrBVZYErb5rmt2Bkb1norbJT53RWi99QXOzAsSmK820BU+UcgebvwQ+ncipuHcNjjRmuqwAMSe5bRMNj6oU1N4P6lC4.IQNN4PEOcu336QU6VEhsSrQhjHk4SYDTuQLWAkyPbULsUW4ZMf6mwc7BMGXO+QDHC3CR4jqJetK1OJO40Rh.DNDCInxofj5L.NJmMxq.JLj6S1XX.EnXHT18TNHT7eiyqdiAWmtQHQn9UFmwpbAL51GyNm3kQmeei5uKHzoVpoyJ0czBtN12+LXGuLS4Hxl3J6VsVsF6iZcT2FmzrZ8FnN0OoU6tR5IAlid0guEXrC3RJq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c1dqcKrcAmoyCTYHkcbbJqyCV4YohRDjmdzAbBZmIDzEAiH4hI03pgXVHbJVX0PPeiFHYoGFZ.KgG0aNDr.EHOOMbV0Bm2oEXVZMwWvC.7Ke.mIHdznAZHHkofdN8D+Yo28DHPvAJuQ2XP9MJN0WtGLA47mppAl8cSdhMzj6HerXxmzQ9NVQD.u1Duch78Q.eo3Zy76OJuyy8Etekcapvs+7w6JyAuvw2erwazqlsts9sgR.6isa98+O9IxhdLyu1tM2+5g84LpqdmREfVMZuZmE8Pl29ud4SqzLf79QDl6XuXkhW99JuzLEPdYojwnJubD1Owqe6O9O+6UqQGx8wA2qHxitecO9K73k2UZyu0NdQg9DJWWFY9zAu+N6nfNR5r+zA2eo8K++.vdBej7X4Cwh.JbprMb1QG3vPWB.TFi3KukUpUj2GRONubr5lBDlmZv+F9hH5HGmJhnyXhVCvtA725puEkr94yTy.Xho9OYXU6CkiQwWZx1N+F4sF.cf7VWW4FZOCv97kovRHSwkPlRKgLkWBY1ZIjY6kPlctSYjM+UcjfOPmaBSztgtu3TMTcGpRSs9O.5ywCt
-
@DanH Why not put the randomizing code you have in your button callbacks inside the sliderpack callback? And then all the buttons need to do is change the sliderpack value and trigger its callback.
-
@d-healey argh making a mess of this lol! I think I've misunderstood your suggestion... (or which bit of the code to switch out into the sliderpack callabck)
-
@DanH The button callback contains some code that randomizes the filter. Take that code and put it in the sliderpack callback.
-
@d-healey do you mean this code?
inline function onRandITControl(component, value) { local randomValue = Math.randInt(0, 5); Console.print(randomValue); btnRandom[randomValue].setValue(1); btnRandom[randomValue].changed(); }; Content.getComponent("RandIT").setControlCallback(onRandITControl);
-
@DanH No, I'm talking about the code that randomizes the filter. The part that sets the attributes.
-
@d-healey so this?
Filter1.setAttribute(3, FilterModes[idx]); Label1.set("text", FilterNames[idx]);
If so I've been trying to figure out how to get the idx value (from the button callback) into the sliderpack callback
-
@DanH Think of it this way: the buttons are only there to provide an interface for the user, you don't need them (except for the randIT button). So write your code so that is uses the sliderpack instead of the buttons, once you have that working you can add the buttons back into the mix.