HISE Logo Forum
    • Categories
    • Register
    • Login

    button for switching arp speed value

    Scheduled Pinned Locked Moved Scripting
    6 Posts 3 Posters 352 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.
    • M
      meto396
      last edited by meto396

      Hello, can someone please tell me how I can change the speed of my Arp with a button? if the button = 0 it should be at 1/8 and if it is 1 it should be at 1/16

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

        @meto396

        You just need an if statement in your button's callback. I'm not 100% sure what the command is to change the arp speed but almost certainly it's going to use .setAttribute() - unless you've also added a speed knob to your UI then you could just change that from the button's callback instead.

        if (value)
            // set arp speed to 1/8
        else
            // set arp speed to 1/16
        

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

        LindonL 1 Reply Last reply Reply Quote 0
        • LindonL
          Lindon @d.healey
          last edited by

          @d-healey said in button for switching arp speed value:

          @meto396

          You just need an if statement in your button's callback. I'm not 100% sure what the command is to change the arp speed but almost certainly it's going to use .setAttribute() - unless you've also added a speed knob to your UI then you could just change that from the button's callback instead.

          if (value)
              // set arp speed to 1/8
          else
              // set arp speed to 1/16
          

          .setAttribute(.SpeedKnob, value);

          HISE Development for hire.
          www.channelrobot.com

          M 1 Reply Last reply Reply Quote 0
          • M
            meto396 @Lindon
            last edited by

            @Lindon I tried this but the value changes only from 1/1 to 1/2D

            inline function onSpeedButtonControl(component, value)
            {
                if (value)
                {
                Arpeggiator1.setAttribute(Arpeggiator1.SpeedKnob, 1/8);
                }
                else
                {
                Arpeggiator1.setAttribute(Arpeggiator1.SpeedKnob, 1/16);
                }
            };
            Content.getComponent("SpeedButton").setControlCallback(onSpeedButtonControl);
            
            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @meto396
              last edited by d.healey

              @meto396 said in button for switching arp speed value:

              Arpeggiator1.setAttribute(Arpeggiator1.SpeedKnob, 1/8);

              1/8 isn't a recognised value. You need to use a tempo index (a number between 0 and 18 if I remember correctly), there are probably constants for this too.

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

              M 1 Reply Last reply Reply Quote 0
              • M
                meto396 @d.healey
                last edited by

                @d-healey yup now it works 👍

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

                20

                Online

                1.7k

                Users

                11.8k

                Topics

                102.8k

                Posts