Forum

    • Register
    • Login
    • Search
    • Categories

    Connecting two different value type knobs & inverting one...

    Scripting Forum
    3
    4
    39
    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.
    • B
      BM_FORUM last edited by BM_FORUM

      Hey all,

      Any ideas on how to do the following? I've searched through the forum, checked out the documentation and also @d-healey vids to no avail... Apologies if I missed it somewhere!

      1. Connect two knobs (both with different value types)
        - One controls Saturation level in % (0-100) - this one wants to control the second one.
        - One controls Post Gain in dB (-24 to 0)
      2. Then turn the Post Gain knob into a inverted control so it actually goes from (0 to -24)

      It's a head scratcher, and I'm probably missing something obvious... Using the 'linkTo' function is not an option it appears, as the range and default type of the dB control gets overwritten to mirror the % type of the other control. Then trying this via standard 'setAttribute' isn't working because the values are not matched. As for inverting the dB control, I'm completely at a loss...

      Thanks for any light shed!

      DanH 1 Reply Last reply Reply Quote 0
      • DanH
        DanH @BM_FORUM last edited by DanH

        @bm_forum you need to use normalisedToRange, and then set the values accordingly.

        Here's a bunch of code I've used recently which uses one knob to change multiple other knobs. I'd be interested if there's a better way of doing it though? @d-healey @ustk

        inline function normalisedToRange(normalisedValue, min, max)
        {
            return min + normalisedValue * (max - min);
        }
        
        inline function onMAINControl(component, value)
        {
        	local v1 = normalisedToRange(value, 0, 7);
        	local v2 = normalisedToRange(value, 0, 7);
        	local v3 = normalisedToRange(value, 0, 1);
        	local v4 = normalisedToRange(value, 100, 170);
        	
        	LF.setValue(v1);
        	HF.setValue(v2);
        	SATURATION.setValue(v3);
        	WIDTH.setValue(v4);
        	
        	LF.changed();
        	HF.changed();
        	SATURATION.changed();
        	WIDTH.changed();
        };
        
        Content.getComponent("MAIN").setControlCallback(onMAINControl);
        
        ustk B 2 Replies Last reply Reply Quote 2
        • ustk
          ustk @DanH last edited by

          @danh That is the good way to do it, except if you have many values you might want to make a loop...

          Tired to press F5 in the forum...
          Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

          1 Reply Last reply Reply Quote 1
          • B
            BM_FORUM @DanH last edited by

            @danh Amazing, thanks! Worked like a charm

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

            20
            Online

            741
            Users

            5.4k
            Topics

            50.3k
            Posts