HISE Logo Forum
    • Categories
    • Register
    • Login

    Table Index Stepsize

    Scheduled Pinned Locked Moved Unsolved Scripting
    2 Posts 2 Posters 98 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
      meto396
      last edited by meto396

      Hello, I tried to change the stepsize of my UI knob of the Wavetable TableIndex. For the Knob it works but not for the function. here is my code:

      const var knobValues = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0];
      
      inline function onWaveMix1Control(component, value)
      {
          WavetableSynthesiser1.setAttribute(WavetableSynthesiser1.TableIndexValue, knobValues[value]);
      }
      
      Content.getComponent("WaveMix1").setControlCallback(onWaveMix1Control);
      
      inline function onWaveMix2Control(component, value)
      {
          WavetableSynthesiser2.setAttribute(WavetableSynthesiser2.TableIndexValue, knobValues[value]);
      }
      
      Content.getComponent("WaveMix2").setControlCallback(onWaveMix2Control);
      
      ustkU 1 Reply Last reply Reply Quote 0
      • M meto396 marked this topic as a question on
      • ustkU
        ustk @meto396
        last edited by ustk

        @meto396 what is the range of the knob? seeing your array length is 5, the knob has to be 0-4 with stepSize=1

        If you intend to use different step values, there are other ways to do this without an array.

        const var NB_STEPS = 5;
        
        // later in your functions
        local index = Math.round(value * NB_STEPS) / NB_STEPS; // output -> 0.0, 0.2, 0.4...
        

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

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

        42

        Online

        1.7k

        Users

        11.7k

        Topics

        102.3k

        Posts