HISE Logo Forum
    • Categories
    • Register
    • Login

    Knob that controls step modulator in increments of 1, 2 ,4 ,8 ,16, 32?

    Scheduled Pinned Locked Moved Scripting
    3 Posts 3 Posters 38 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.
    • M
      mjc123
      last edited by

      Any suggestions on best method for creating a knob that controls 'NumSteps' on the step modulator, that works in a non-linear fashion? So rather than 1,2,3,4,5,6 etc, the options are 1, 2, 4, 8, 16, 32

      Thank you

      d.healeyD ustkU 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @mjc123
        last edited by

        @mjc123 You can use an array that contains your steps, and use the knob as the array index to grab the values.

        const steps = [1, 3, 5, 7, 9];
        
        inline function onKnobControl(component, value)
        {
            local stepValue = steps[value];
        }
        
        

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

        1 Reply Last reply Reply Quote 4
        • ustkU
          ustk @mjc123
          last edited by

          @mjc123 as Dave said, or if the mathematical relation is always 2^n−1, then

          local step = Math.pow(2, value-1);
          

          Can't help pressing F5 in the forum...

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

          25

          Online

          1.9k

          Users

          12.2k

          Topics

          106.6k

          Posts