HISE Logo Forum
    • Categories
    • Register
    • Login

    Set Min and Max values of a slider with a button

    Scheduled Pinned Locked Moved General Questions
    5 Posts 3 Posters 491 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.
    • SteveRiggsS
      SteveRiggs
      last edited by

      Hi all,

      I'm trying to make a button that changes a sliders value from min to max with one click.

      I almost got it but not quite. Can anyone see what I've missed in the code?

      const var ReverbBypassBtn = Content.getComponent("ReverbBypassBtn");
      const var ReverbBypassGainKnob = Content.getComponent("ReverbBypassGainKnob");
      
      inline function onReverbBypassBtnControl(component, value)
      {
      if (value ==1)
          {
          ReverbBypassGainKnob.setMaxValue;
          }
      else
          {
          ReverbBypassGainKnob.setMinValue;
          }
      };
      
      Content.getComponent("ReverbBypassBtn").setControlCallback(onReverbBypassBtnControl);
      

      www.anarchyaudioworx.com

      www.facebook.com/groups/audioworx/

      ustkU LindonL 2 Replies Last reply Reply Quote 0
      • ustkU
        ustk @SteveRiggs
        last edited by ustk

        @SteveRiggs .setMaxValue needs an argument to work, like .setMaxValue(0)
        This is not what you want anyway, because this method is for setting the min/max limit of the slider, not its value...
        You may want to use .setValue(0 or -100) instead.
        Don't forget to add ReverbBypassGainKnob.changed(); at the end of your callback

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

        SteveRiggsS 1 Reply Last reply Reply Quote 1
        • LindonL
          Lindon @SteveRiggs
          last edited by

          @SteveRiggs

          wild guess but I would try this:

          inline function onReverbBypassBtnControl(component, value)
          {
          if (value)
          {
              ReverbBypassGainKnob.setValue(ReverbBypassGainKnob.getMaxValue());
          }else{
              ReverbBypassGainKnob.setValue(ReverbBypassGainKnob.getMinValue());    }
          };
          

          HISE Development for hire.
          www.channelrobot.com

          1 Reply Last reply Reply Quote 1
          • SteveRiggsS
            SteveRiggs @ustk
            last edited by SteveRiggs

            @ustk Thanks, dude. That works now changing the slider on the interface. I'm making a right mess of this one though 🙄

            When I link the slider to the simple gain modules gain with the processor Id, it will move the gain in the back end if I turn the slider down manually, but by pushing the button the gain in the back end doesn't change, even though the slider on the interface is.

            So I figured it needs to be hardcoded instead of using the processor Id? If I'm doing it that way then there's no real need for the slider as that would have been a hidden slider anyway.

            If I can get the button just to change the value of the simple gains gain control that would be loads better... but again I've missed something in the if/else statement I think?

            Sorry about this. My brains not working properly at all today.

            const var ReverbGainTESTbypass = Synth.getEffect("ReverbGainTESTbypass");
            const var ReverbBypassBtn = Content.getComponent("ReverbBypassBtn");
            
            inline function onReverbBypassBtnControl(component, value)
            {
            if (value ==1)
                {
                ReverbGainTESTbypass.setValue(Gain, 0);
                }
            else
                {
                ReverbGainTESTbypass.setValue(Gain, -100);
                }
            };
            
            Content.getComponent("ReverbBypassBtn").setControlCallback(onReverbBypassBtnControl);
            
            

            www.anarchyaudioworx.com

            www.facebook.com/groups/audioworx/

            SteveRiggsS 1 Reply Last reply Reply Quote 0
            • SteveRiggsS
              SteveRiggs @SteveRiggs
              last edited by

              @ustk @Lindon No worries! I worked it out.

              I needed setAttribute instead :)

              Cheers for your help

              www.anarchyaudioworx.com

              www.facebook.com/groups/audioworx/

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

              26

              Online

              1.7k

              Users

              11.8k

              Topics

              102.5k

              Posts