Forum
    • Categories
    • Register
    • Login

    Knob values displayed as percentage

    Scheduled Pinned Locked Moved Scripting
    44 Posts 2 Posters 143 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.
    • J
      Jeetender @David Healey
      last edited by

      @David-Healey iam confused for now...please help

      //Left Knob
      const Knob1 = Content.getComponent("left");
      Knob1.setControlCallback(onleftControl);
      
      inline function onleftControl(component, value)
      {
      	Panel1.set("text", Math.round(value * 100) + "%");
      	Panel1.repaint();
      }
      
      const Panel1 = Content.getComponent("LeftPanel");
      Panel1.setPaintRoutine(function(g)
      {
      	var a = this.getLocalBounds(0);
      	
      	g.setColour(this.get("textColour"));
      	g.drawAlignedText(this.get("text"), a, "centred");
      });
      
      //Right Knob
      const Knob2 = Content.getComponent("right");
      Knob2.setControlCallback(onrightControl);
      
      inline function onrightControl(component, value)
      {
      	Panel2.set("text", Math.round(value * 100) + "%");
      	Panel2.repaint();
      }
      
      const Panel2 = Content.getComponent("RightPanel");
      Panel2.setPaintRoutine(function(g)
      {
      	var b = this.getLocalBounds(0);
      	
      	g.setColour(this.get("textColour"));
      	g.drawAlignedText(this.get("text"), b, "centred");
      });
      
      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @Jeetender
        last edited by

        @Jeetender said in Knob values displayed as percentage:

        iam confused for now

        Which part is confusing you and I can try and give you a pointer?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        J 1 Reply Last reply Reply Quote 0
        • J
          Jeetender @David Healey
          last edited by

          @David-Healey use a control callback or you can connect through processor/parameter ID iam new to hise coding or even coding...

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @Jeetender
            last edited by

            @Jeetender If you want to use a control callback then you can't connect to your fx module using the processor/parameter ID settings in the property editor. Instead you need to set the fx module's controls through the control callback as well. You can do this using the setAttribute() function.

            However in your case I don't think you should use a control callback at all and you shouldn't draw the knob values in a panel. Instead you should be using look and feel to style to the knobs and draw the value.

            Neither of these things are beginner friendly so don't worry if you feel a bit stuck at the moment, you'll get there.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            J 1 Reply Last reply Reply Quote 0
            • J
              Jeetender @David Healey
              last edited by

              @David-Healey the only work around here is to display the pan or gain values from the scriptfx nodes?

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @Jeetender
                last edited by

                @Jeetender I don't know what you mean

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                J 1 Reply Last reply Reply Quote 0
                • J
                  Jeetender @David Healey
                  last edited by Jeetender

                  @David-Healey
                  i can add this
                  this.setAttribute("ProcessorParameterID", value) to the callbacks,

                  this.setAttribute("Script FX1.LeftJpanner.pan", value)

                  David HealeyD 2 Replies Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @Jeetender
                    last edited by

                    @Jeetender Almost. this should be a reference to your effect and ProcessorParameterID will be the constant that refers to the parameter you want to control, in your case something like myEffect.Left

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    J 1 Reply Last reply Reply Quote 0
                    • David HealeyD
                      David Healey @Jeetender
                      last edited by

                      @Jeetender Here's an example using a Simple Gain effect

                      HiseSnippet 1025.3oc0W0saaaCElzwJqwasnsXO.Z4J2ghT4XO2FTLzzXmrYzkTioztsqJnEohILEofHUV8F1Cx1M64X2Uf8Bs2fsCojikaLRb89Aq5BCQdNGd93ge76HOLSEwzZUFB23zooLD9i7BmJMi6MlvknA8Q3a4cLQaXY9EScvzThVynHLdiuvNAdq5H2ye7jCHBhLhMeJD5kJdD6q3Iby7YGt+y3BwQDJ6TdREu6r+fHkrmRnxA7rgW.JkDMgbF6Dh0sZdnujnGivepGIpcqffNcosGQHin6tWm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.j6SOiC
                      

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • J
                        Jeetender @David Healey
                        last edited by

                        @David-Healey

                        const Knob1 = Content.getComponent("left");
                        Knob1.setControlCallback(onleftControl);
                        
                        inline function onleftControl(component, value)
                        {
                        	Panel1.set("text", Math.round(value * 100) + "%");
                        	Panel1.repaint();
                        	
                        	this.setAttributeNormalized("DSPNetwork.leftjpanner.Pan", value);
                        }
                        
                        const Panel1 = Content.getComponent("LeftPanel");
                        Panel1.setPaintRoutine(function(g)
                        {
                        	var a = this.getLocalBounds(0);
                        	
                        	g.setColour(this.get("textColour"));
                        	g.drawAlignedText(this.get("text"), a, "centred");
                        });
                        
                        David HealeyD 1 Reply Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @Jeetender
                          last edited by

                          @Jeetender Take a look at the snippet I posted above and my comment in the post above that.

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            Jeetender @David Healey
                            last edited by Jeetender

                            @David-Healey yes i saw the snippet and ure comment

                            const DspNet = Synth.getEffect("Script FX1");
                            
                            const Knob1 = Content.getComponent("left");
                            Knob1.setControlCallback(onleftControl);
                            
                            inline function onleftControl(component, value)
                            {
                            	Panel1.set("text", Math.round(value * 100) + "%");
                            	Panel1.repaint();
                            	
                            	DspNet.setAttributeNormalized("Script Fx1.Left", value); // left is a macro in the dspnetowrk
                            }
                            
                            const Panel1 = Content.getComponent("LeftPanel");
                            Panel1.setPaintRoutine(function(g)
                            {
                            	var a = this.getLocalBounds(0);
                            	
                            	g.setColour(this.get("textColour"));
                            	g.drawAlignedText(this.get("text"), a, "centred");
                            });
                            
                            David HealeyD 1 Reply Last reply Reply Quote 0
                            • David HealeyD
                              David Healey @Jeetender
                              last edited by

                              @Jeetender said in Knob values displayed as percentage:

                              "Script Fx1.Left"

                              Did I use quotation marks in the snippet?

                              Free HISE Bootcamp Full Course for beginners.
                              YouTube Channel - Public HISE tutorials
                              My Patreon - HISE tutorials

                              J 1 Reply Last reply Reply Quote 0
                              • J
                                Jeetender @David Healey
                                last edited by Jeetender

                                @David-Healey

                                DspNet.setAttributeNormalized(Script FX1.Left, value);
                                

                                Found identifier when expecting ',' error after this line

                                David HealeyD 1 Reply Last reply Reply Quote 0
                                • David HealeyD
                                  David Healey @Jeetender
                                  last edited by

                                  @Jeetender Generally spaces are not good in code. Your reference is called DspNet not Script FX1 - so DspNet.Left - you should name things consistently though so that you are using the same naming everywhere, your code will get very confusing otherwise.

                                  Free HISE Bootcamp Full Course for beginners.
                                  YouTube Channel - Public HISE tutorials
                                  My Patreon - HISE tutorials

                                  J 1 Reply Last reply Reply Quote 0
                                  • J
                                    Jeetender @David Healey
                                    last edited by

                                    @David-Healey

                                    yea iam trying to clean up with small error, now as iam using

                                    DspNet.setAttributeNormalized(DspNet.Left, value);

                                    it give sout an error fucntion not found..

                                    const DspNet = Synth.getEffect("Script FX1");
                                    const Knob1 = Content.getComponent("left");
                                    Knob1.setControlCallback(onleftControl);
                                    
                                    inline function onleftControl(component, value)
                                    {
                                    	Panel1.set("text", Math.round(value * 100) + "%");
                                    	Panel1.repaint();
                                    	
                                    	DspNet.setAttributeNormalized(DspNet.Left, value);
                                    }
                                    
                                    const Panel1 = Content.getComponent("LeftPanel");
                                    Panel1.setPaintRoutine(function(g)
                                    {
                                    	var a = this.getLocalBounds(0);
                                    	g.setColour(this.get("textColour"));
                                    	g.drawAlignedText(this.get("text"), a, "centred");
                                    });
                                    
                                    David HealeyD 1 Reply Last reply Reply Quote 0
                                    • David HealeyD
                                      David Healey @Jeetender
                                      last edited by

                                      @Jeetender said in Knob values displayed as percentage:

                                      it give sout an error fucntion not found..

                                      What is the full error

                                      Free HISE Bootcamp Full Course for beginners.
                                      YouTube Channel - Public HISE tutorials
                                      My Patreon - HISE tutorials

                                      J 1 Reply Last reply Reply Quote 0
                                      • J
                                        Jeetender @David Healey
                                        last edited by

                                        @David-Healey

                                        Interface:! Line 30, column 31: function not found {{SW50ZXJmYWNlfHw4NTZ8MzB8MzE=}}

                                        David HealeyD 1 Reply Last reply Reply Quote 0
                                        • David HealeyD
                                          David Healey @Jeetender
                                          last edited by

                                          @Jeetender What is the function on Line 30?

                                          Free HISE Bootcamp Full Course for beginners.
                                          YouTube Channel - Public HISE tutorials
                                          My Patreon - HISE tutorials

                                          J 1 Reply Last reply Reply Quote 0
                                          • J
                                            Jeetender @David Healey
                                            last edited by Jeetender

                                            @David-Healey said in Knob values displayed as percentage:

                                            @Jeetender What is the function on Line 30?

                                            const DspNet = Synth.getEffect("Script FX1");
                                            const Knob1 = Content.getComponent("left");
                                            Knob1.setControlCallback(onleftControl);
                                            
                                            inline function onleftControl(component, value)
                                            {
                                            	Panel1.set("text", Math.round(value * 100) + "%");
                                            	Panel1.repaint();
                                            	
                                            	DspNet.setAttributeNormalized(DspNet.Left, value); // line 30
                                            }
                                            
                                            const Panel1 = Content.getComponent("LeftPanel");
                                            Panel1.setPaintRoutine(function(g)
                                            {
                                            	var a = this.getLocalBounds(0);
                                            	g.setColour(this.get("textColour"));
                                            	g.drawAlignedText(this.get("text"), a, "centred");
                                            });
                                            
                                            
                                            David HealeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            15

                                            Online

                                            2.3k

                                            Users

                                            13.6k

                                            Topics

                                            118.3k

                                            Posts