Forum

    • Register
    • Login
    • Search
    • Categories

    Knob value to different ranges for different fx

    General Questions
    3
    4
    59
    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.
    • UrsBollhalder
      UrsBollhalder 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));
      };
         
      

      www.ursbollhalder.com
      www.Instagram.com/urs_bollhalder_composer

      ustk 1 Reply Last reply Reply Quote 0
      • d.healey
        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

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

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

          www.ursbollhalder.com
          www.Instagram.com/urs_bollhalder_composer

          1 Reply Last reply Reply Quote 0
          • ustk
            ustk @UrsBollhalder 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

            I can't help pressing F5 in the forum...

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

            10
            Online

            1.2k
            Users

            7.0k
            Topics

            64.7k
            Posts