HISE Logo Forum
    • Categories
    • Register
    • Login

    Knob value to different ranges for different fx

    Scheduled Pinned Locked Moved General Questions
    4 Posts 3 Posters 180 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.
    • ?
      A Former User
      last edited by

      Hello

      Is there a way to transform the knob value inside the inline function, so it only has a specific range. I want to have a knob that goes to different fx, but controls them with different ranges. I don't want to change the overall range of the knob... I hope that makes sense... 🤨

      I guess I could add to the min value and subtract from the max value etc... but that seems rather unwieldy. I am sure there's a simpler way to do it!

      Thanks! Appreciate the help with the newbie question!

      u

      I am sure what I wrote here is not really it but it hopefully shows what I am trying to do...

      const var Knob1 = Content.getComponent("Knob1");
      
      inline function onKnob1Control(component, value)
      {
      
      	Degrade1.setAttribute(Degrade1.NonLin, Math.range(value, 0.2, 0.5));
      };
         
      
      ustkU 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        inline function remapRange(value, oldMin, oldMax, newMin, newMax)
        {
                return (((value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin;
        }
        

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

        ? 1 Reply Last reply Reply Quote 1
        • ?
          A Former User @d.healey
          last edited by

          @d-healey Thx David! Food for thought...

          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @A Former User
            last edited by

            @vewilya The general mapping formula is simply derived from a cross-multiplication like so targetMin + ((targetMax - targetMin) x value)
            You can also have use of Engine.getDecibelsForGainFactor(double gainFactor) for gain stuff

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

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

            49

            Online

            1.7k

            Users

            11.7k

            Topics

            102.2k

            Posts