HISE Logo Forum
    • Categories
    • Register
    • Login

    XY Pad Moving Knobs But Knobs Not Moving my dot. What Have I missed?

    Scheduled Pinned Locked Moved Solved Newbie League
    3 Posts 2 Posters 98 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
      JamesC
      last edited by

      Morning all

      I'm sure as always its something I've missed. I've set up this XY pad to control 2 simple Gains. Its looking as it should and the dot behaving on the panel as it should adn when the cursor moves the dots the knobs respond correctly and so do the simple gains.

      Now the knobs work and control the simple gains also But don't then force the dot to respond on the pad. If someone can have a look at the code here it would be most helpful. Thanks in advance

      ///XY Panel
      const var XYPadPnl = Content.getComponent("XYPadPnl");
      const var SimpleGain1 = Synth.getEffect("Simple Gain1");
      const var SimpleGain2 = Synth.getEffect("Simple Gain2");
      
      XYPadPnl.setControlCallback(onXYPadPnlControl);
      
      inline function onXYPadPnlControl(component, value)
      {
      	component.repaint();
      }
      ///Knobs
      const var knobs = []; 
      
      for (i = 0; i < 2; i++)
      {
          knobs[i] = Content.getComponent("Knob"+(i+1));
          knobs[i].setControlCallback(XYPad);
      }
      
      // Mouse CB
      XYPadPnl.setMouseCallback(function(event)
      {
          if (event.clicked || event.drag)
          {
              this.data.x = Math.range(event.x / this.getWidth(), 0, 1);
              this.data.y = Math.range(event.y / this.getHeight(), 0, 1);
              
              this.changed();
                     
              knobs[0].setValue(1*this.data.x);
              knobs[1].setValue(1-(1*this.data.y));
              knobs[0].changed();
              knobs[1].changed();
          }    
      });
      
      // Paint routine
      
      const SIZE = 10
      
      XYPadPnl.setPaintRoutine(function(g)
      {
         	var l = this.getLocalBounds(0);
          
          g.fillAll(this.get("bgColour"));
          
          var x = Math.range(this.data.x * this.getWidth(), 0, this.getWidth() - SIZE);
          var y = Math.range(this.data.y * this.getHeight(), 0, this.getHeight() - SIZE);
            
          //Draw Dot
          g.setColour(this.get("itemColour"));
          g.fillEllipse([x, y, SIZE, SIZE]);
      
      });
      
      inline function XYPad(component, value)
      { 
          local idx = knobs.indexOf(component);
         XYPadPnl.repaint();
      };
      
      inline function onKnob1Control(component, value)
      {
      	if(value)
      	   SimpleGain1.setAttribute(SimpleGain1.Gain,(1 - value)*-100);
      	    
      };
      Content.getComponent("Knob1").setControlCallback(onKnob1Control);
      
      
      LindonL J 2 Replies Last reply Reply Quote 0
      • LindonL
        Lindon @JamesC
        last edited by Lindon

        @JamesC well in the end what we did was......

        Think long and hard about the end user experience. ..which led us to having two SimpleGain FX in each "voice" - one managed by the XY pad - as your does, and the other managed by the Gain control in the Voice editing section....this way the end user can independently set the balance between voices, and the XY pad movements modulate across this balance....

        Added bonus, now you can modulate the Voice Gain controls independently of the XY pad for Vibrato like output in a given voice...and still retain the cross-fading in the XY pad...

        HISE Development for hire.
        www.channelrobot.com

        1 Reply Last reply Reply Quote 0
        • J
          JamesC @JamesC
          last edited by

          @JamesC I like this a simple sensible solution I will definitely consider it!

          1 Reply Last reply Reply Quote 0
          • J JamesC has marked this topic as solved
          • First post
            Last post

          24

          Online

          1.9k

          Users

          12.5k

          Topics

          109.0k

          Posts