HISE Logo Forum
    • Categories
    • Register
    • Login

    Random values to modules

    Scheduled Pinned Locked Moved General Questions
    7 Posts 2 Posters 460 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.
    • hisefiloH
      hisefilo
      last edited by

      Hi there, doing a random button for some values (Delay time in SimpleGain module).
      It works when I hi compile, but if I click the button1, modules wont update, just the UI does.
      What Im doing wrong??
      Thanksss!!

      
      // Offset ramdomizer
      
      
      inline function onButton1Control(component, value)
      {   
          Content.getComponent("Offset30").setValue(Math.randInt(0,400));
          Content.getComponent("Offset31").setValue(Math.randInt(0,400));
          Content.getComponent("Offset32").setValue(Math.randInt(0,400));
          Content.getComponent("Offset33").setValue(Math.randInt(0,400));
          Content.getComponent("Offset34").setValue(Math.randInt(0,400));
          Content.getComponent("Offset35").setValue(Math.randInt(0,400));
          Content.getComponent("Offset36").setValue(Math.randInt(0,400));
      };
      
      Content.getComponent("Button1").setControlCallback(onButton1Control);
      
      
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @hisefilo
        last edited by d.healey

        @hisefilo I'm assuming that your "badly named :p " controls Offset30, Offset31, etc. are knobs on the interface that are linked to modules? Could you post a snippet?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        hisefiloH 1 Reply Last reply Reply Quote 0
        • hisefiloH
          hisefilo @d.healey
          last edited by

          @d-healey here you go! Not a name issue I guess (despite my ugly naming practices)

          HiseSnippet 1229.3oc2X0saaaCElx1pq1YInsnXnWJTrKb.xBraZ55vtHNwIovX0IFwooq6hUvHQGSDJRMJpr5Ez62cC8MZOBCXuH4IXaGRIYImpk4o0gsDmKh44GpuygemiNzCjBWRXnPhrpe3j.Bx5isGNgqF2cLlxQ81FYsjcebnhHchEs0j.bXHwCYYU8YZAV0qgLetXisvLL2kjIBgNRPcIOm5SUYRGz4qn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1KLf1TofIVxjb+NGPXDbd17m144.KDK6aZqWpbQ64OWbUmWOvNFtN5JSmaFc3qdCpCeIuPwsmdqOC8+YY25alYM9y6siPwCdLUvWz4kTO3MESE7pNEz8uGTQIUCDLr7xo+penn10laNhNjt9vouW7rdWm.rgRb8Av2wd.9+CDhCDQJJ+D3NxRycB1KxeHLBjKAfJmSXg5qbTQOFS75V50wy.w8LKzW7HQYa8ZqDksSUdi4Y3ickhW6FekQc4+sMRfbK27yGU2tudsyzaJZa2Z0V5KqQesqqt46mAmAE6yiJgOqUBedbI7Y8R3ySJgOedI74oWoO5QS2LRI7iqw.AC1wbicKqc3XnZwTtg9C7w7DdJ
          
          1 Reply Last reply Reply Quote 1
          • d.healeyD
            d.healey
            last edited by

            Perfect snippet :)

            So the solution is to add this line after you change the control's value
            Content.getComponent("Offset30").changed();

            and you should replace this

                Content.getComponent("Offset30").setValue(Math.randInt(0,400));
                Content.getComponent("Offset31").setValue(Math.randInt(0,400));
                Content.getComponent("Offset32").setValue(Math.randInt(0,400));
                Content.getComponent("Offset33").setValue(Math.randInt(0,400));
                Content.getComponent("Offset34").setValue(Math.randInt(0,400));
                Content.getComponent("Offset35").setValue(Math.randInt(0,400));
                Content.getComponent("Offset36").setValue(Math.randInt(0,400));
            

            With a loop.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            hisefiloH 1 Reply Last reply Reply Quote 2
            • hisefiloH
              hisefilo @d.healey
              last edited by

              @d-healey yeah!!! worked! Loop will be good, but I need custom ranges for each randomized value

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

                custom ranges for each randomized value

                Put the ranges in an array or an object and you can access them in the same loop.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                hisefiloH 1 Reply Last reply Reply Quote 0
                • hisefiloH
                  hisefilo @d.healey
                  last edited by

                  @d-healey Cool! will do it that way!

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

                  30

                  Online

                  2.0k

                  Users

                  12.8k

                  Topics

                  111.1k

                  Posts