HISE Logo Forum
    • Categories
    • Register
    • Login

    Need a math teacher...

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 401 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.
    • ustkU
      ustk
      last edited by

      @Christoph-Hart I borrowed some formulas in the core of Hise for applying a skew factor to my vector knobs...
      Well, I can calculate the skew or the midpoint form skew, but I miserably failed to apply it to my value...
      Sure I'm not far though 🤔

      Would you (or anyone else of course) replace the question marks, please?

      var length = knob.get("max") - knob.get("min");
      var normalizedValue = (value - knob.get("min")) / length;
              
      var skew = Math.log(0.5) / Math.log((knob.data.midPoint - knob.get("min")) / length);
      
      var midPoint = Math.pow(2.0, -1.0 / skew) * length + knob.get("min");
                  
      var proportion = Math.pow(normalizedValue, skew);
                  
      knob.setValue(???); 
      

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

      1 Reply Last reply Reply Quote 0
      • ustkU
        ustk
        last edited by

        @Christoph-Hart bump bump :)

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

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

          This is how I'd solve it knob.setValue(@Christoph-Hart); ;)

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

          1 Reply Last reply Reply Quote 2
          • Christoph HartC
            Christoph Hart
            last edited by

            You don't need a math teacher, you need an invisible knob that does the math for you :)

            1. Add a knob with an empty image as filmstrip
            2. Add the panel that draws your vector knob behind the actual knob.
            3. Implement the paint routine. Use Knob.getValueNormalised() which tucks away all this logarithmic stuff and gives you a normalised linear value from 0...1 that you can use to draw the value on your panel.
            4. Add a timer callback that grabs the value and repaints it.
            5. This way you get the other nice things from the Knob / Slider widget (shift click to enter a value, double click to return, adjustable mouse sensitivity etc)

            I am using this trick in HEXERACT for the vector knobs:

            knob_vector.gif

            d.healeyD ustkU 2 Replies Last reply Reply Quote 1
            • d.healeyD
              d.healey @Christoph Hart
              last edited by d.healey

              @Christoph-Hart Why use a timer callback and not the knob's control callback?

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

              1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @Christoph Hart
                last edited by

                @Christoph-Hart Well, I'm not sure it is what I want to do, this will clutter a lot my interface and component list. Also I noticed that having too many widget in an interface makes it laggy. And, my vector knob has already all the options I need...

                I really think adjusting from the skew factor would be better in my case.
                It's already what Hise is using, isn't it? So what are the maths after calculating the skew?

                Also, I found some methods in Juce for mapping the values from a skew factor or mid-point, maybe it would be cool to have it in Hise what do you think?

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

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

                16

                Online

                1.7k

                Users

                11.8k

                Topics

                103.1k

                Posts