HISE Logo Forum
    • Categories
    • Register
    • Login

    Randomizer on 3 Grouped buttons, How?

    Scheduled Pinned Locked Moved Scripting
    97 Posts 4 Posters 4.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey @DanH
      last edited by

      @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?

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      DanHD NatanN 2 Replies Last reply Reply Quote 0
      • DanHD
        DanH @d.healey
        last edited by

        @d-healey Then the buttons will never be able to be saved in presets... :/

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        d.healeyD 1 Reply Last reply Reply Quote 1
        • NatanN
          Natan @d.healey
          last edited by Natan

          @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?

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @DanH
            last edited by

            I think in that case you'd need to use a sliderpack to save their values and restore them in the sliderpack's callback.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            DanHD 1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @d.healey
              last edited by

              @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 😆

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @DanH
                last edited by

                @DanH

                Peek 2021-03-28 17-48.gif

                HiseSnippet 1070.3oc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X+VdOT0uuJ0Zq99AjjoGBcsynJXj.cVYeEc9LZb.YdFzt6CavyqBuz.hb42bUKWjK.9JXoG2TOfwSXx4UW93A7PrSsODWaO98DtOwbLS5Nsd7tQM3E5i++Fu4q0zx7XeepqrDrMLO4mW2cXd.P4GDoRF+pSIxXlpm8rzvIvlctT.IbNMHQ09tgZNhl1onudBk6kQ72vIWXOEsQtvdEBQgD2Xw6b0SeTKNsUFG.S7rcFaBKuBz3ECaLMc55fBg84dmqq5p3KArWuM6tF1r2ZXyyWCadwZXyKWCa9p0vlW8QsQsJ8goRQn9yDfw3iyFraXbLm.cYYcjn+AvQTwQF
                

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                DanHD 1 Reply Last reply Reply Quote 0
                • DanHD
                  DanH @d.healey
                  last edited by

                  @d-healey Thanks :) Is it possible to combine this with the random snippet above?

                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                  https://dhplugins.com/ | https://dcbreaks.com/
                  London, UK

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @DanH
                    last edited by

                    @DanH Sure, just edit the button callback

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    DanHD 2 Replies Last reply Reply Quote 0
                    • DanHD
                      DanH @d.healey
                      last edited by

                      @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!

                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                      https://dhplugins.com/ | https://dcbreaks.com/
                      London, UK

                      1 Reply Last reply Reply Quote 0
                      • DanHD
                        DanH @d.healey
                        last edited by DanH

                        @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.3oc0YssaajaFdjSlh0dWuM61E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0WtGLA47mppAl8cSdhMzj6HerXxmzQ9NVQD.u1Duch78Q.eo3Zy76OJuyy8Etekcapvs+7w6JyAuvw2erwazqlsts9sgR.6isa98+O9IxhdLyu1tM2+5g84LpqdmREfVMZuZmE8Pl29ud4SqzLf79QDl6XuXkhW99JuzLEPdYojwnJubD1Owqe6O9O+6UqQGx8wA2qHxitecO9K73k2UZyu0NdQg9DJWWFY9zAu+N6nfNR5r+zA2eo8K++.vdBej7X4Cwh.JbprMb1QG3vPWB.TFi3KukUpUj2GRONubr5lBDlmZv+F9hH5HGmJhnyXhVCvtA725puEkr94yTy.Xho9OYXU6CkiQwWZx1N+F4sF.cf7VWW4FZOCv97kovRHSwkPlRKgLkWBY1ZIjY6kPlctSYjM+UcjfOPmaBSztgtu3TMTcGpRSs9O.5ywCt
                        

                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                        https://dhplugins.com/ | https://dcbreaks.com/
                        London, UK

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @DanH
                          last edited by

                          @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.

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          DanHD 1 Reply Last reply Reply Quote 0
                          • DanHD
                            DanH @d.healey
                            last edited by

                            @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)

                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                            https://dhplugins.com/ | https://dcbreaks.com/
                            London, UK

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @DanH
                              last edited by

                              @DanH The button callback contains some code that randomizes the filter. Take that code and put it in the sliderpack callback.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              DanHD 1 Reply Last reply Reply Quote 0
                              • DanHD
                                DanH @d.healey
                                last edited by

                                @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);
                                

                                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                https://dhplugins.com/ | https://dcbreaks.com/
                                London, UK

                                d.healeyD 1 Reply Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey @DanH
                                  last edited by d.healey

                                  @DanH No, I'm talking about the code that randomizes the filter. The part that sets the attributes.

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  DanHD 1 Reply Last reply Reply Quote 0
                                  • DanHD
                                    DanH @d.healey
                                    last edited by

                                    @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

                                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                    https://dhplugins.com/ | https://dcbreaks.com/
                                    London, UK

                                    d.healeyD 1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey @DanH
                                      last edited by

                                      @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.

                                      Libre Wave - Freedom respecting instruments and effects
                                      My Patreon - HISE tutorials
                                      YouTube Channel - Public HISE tutorials

                                      DanHD 1 Reply Last reply Reply Quote 0
                                      • DanHD
                                        DanH @d.healey
                                        last edited by

                                        @d-healey I still need the 'Tabbed Interface' script though don't I?

                                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                        https://dhplugins.com/ | https://dcbreaks.com/
                                        London, UK

                                        d.healeyD 1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey @DanH
                                          last edited by

                                          @DanH I'm not seeing a tabbed interface in your snippet

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          DanHD 1 Reply Last reply Reply Quote 0
                                          • DanHD
                                            DanH @d.healey
                                            last edited by

                                            @d-healey So the buttons are the 'tabs' if you like. In order that they behave like a radio group.

                                            //// TABBED INTERFACE SCRIPT
                                            
                                            const var NUM_TABS = 5;
                                            
                                            for (i = 0; i < NUM_TABS; i++)
                                            {
                                                btnRandom[i].setControlCallback(changeTab);
                                            }
                                            
                                            //Tab button callback function
                                            inline function changeTab(component, value)
                                            {
                                                //Get index of clicked button
                                                local idx = btnRandom.indexOf(component);
                                                //Toggle buttons
                                                for (i = 0; i < btnRandom.length; i++)
                                                {
                                                    
                                                    if (i == idx)
                                                    {
                                                        btnRandom[i].setValue(btnRandom[i] == component);
                                                        SliderPack1.setSliderAtIndex(idx, btnRandom[idx] == component);
                                                        Filter1.setAttribute(3, FilterModes[idx]);
                                                        Label1.set("text", FilterNames[idx]);
                                                    }
                                                    
                                                    else
                                                    
                                                    {
                                                        btnRandom[i].setValue(0);
                                                        SliderPack1.setSliderAtIndex(i, btnRandom[i] == component);
                                                    }
                                                }
                                            
                                            }
                                            

                                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                            https://dhplugins.com/ | https://dcbreaks.com/
                                            London, UK

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            29

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.7k

                                            Posts