HISE Logo Forum
    • Categories
    • Register
    • Login

    Change Slider Value via MIDI + Velocity

    Scheduled Pinned Locked Moved Scripting
    midivelocitysliderslider midislider velocity
    44 Posts 4 Posters 2.3k 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.
    • d.healeyD
      d.healey @trillbilly
      last edited by

      @trillbilly said in Change Slider Value via MIDI + Velocity:

      I tried using an "if/else" statement in the onNoteOff but it throw an error on the "else".

      Snippet

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

      trillbillyT 1 Reply Last reply Reply Quote 0
      • trillbillyT
        trillbilly @d.healey
        last edited by

        @d-healey
        Here is snippet. This one is broken because of the if/else in onNoteOff. If you remove that, everything works but when you Play C & D together, then release one, both animations return to 0.

        HiseSnippet 1341.3oc4XE2SaaDE+bRbWi6FpcpaZ+4Iz9ifTFMFn.UnoFHAphVCDgoroUsgNrujbB667ru.jMUo8QaeD1Gk9MX6c1Nw1fAxhJUSpQBTdu6987u68d268b5EHroggh.jV0iF6SQZett0XtbXqgDFG0oMRaA8tjPIM.GqZmw9jvPpCRSq7qTJzpVAE848ubGhKgaSSUgPGKX1zWy7XxTs8Z9CLW28HNziXdY18ZM6XK3sDthQ.eJq2.4SrOiLftOQssR5HsGrqCSJBrjDIMDoUYGgyXqghK3w6+XVH6TWpRvDYAFJV8dBWGEiUeG0ZHy0o2jycHBoo2K0KTN1K7T8tLG1T8odiGGs.NEQV+gVo7zqbN5YdSzq.JokgRUhozSzsrCX9xzUT74Q5c3PvoOAb6YoR7dQkbpn2R.6fKW1ibFcu.PXJhZq2nQcL7uk1xv.b8gR74j.bnKyAh2eOdBxATYKgmufCB0VLd4EALWEh4cfwbw7OnynistfIsGRCaAPeKPFyUpiWYs53UWuNdsMUjqNdCP2lftW.5LaroZSM9ksvO6YsBK1XsUFC.YBfVA.sJf44pSJnaC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OCOhcf3D63QlUWVeXjF3byi9QZpp2UIiSmTVuQ7HcrSrsUt6uyDgJFyJyAlUmCLqMGXd9bfY84.yFyAlMuULpNuaORJheiXHf1s2tQu0hl1tbUYknrdz+B+FZVW
        
        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @trillbilly
          last edited by

          @trillbilly Your if statement is missing curly braces

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

          trillbillyT 1 Reply Last reply Reply Quote 0
          • trillbillyT
            trillbilly @d.healey
            last edited by

            @d-healey I get the same error

            ! Line 8, column 2: Found 'else' when expecting a statement
            
            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @trillbilly
              last edited by

              @trillbilly Show me your if statement

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

              trillbillyT 1 Reply Last reply Reply Quote 0
              • trillbillyT
                trillbilly @d.healey
                last edited by

                @d-healey This is where Im starting and trying to work my way out.

                function onNoteOff()
                {
                	if (keySwitchesC.contains(Message.getNoteNumber()))
                {	
                	slider.setValue(Message.getVelocity());
                	slider.changed();
                	
                	slider1.setValue(Message.getVelocity());
                	slider1.changed();
                	
                }	
                }
                
                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @trillbilly
                  last edited by

                  @trillbilly Show me the one that doesn't work

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

                  trillbillyT 1 Reply Last reply Reply Quote 0
                  • trillbillyT
                    trillbilly @d.healey
                    last edited by

                    @d-healey Any else statement I do like this.

                    function onNoteOff()
                    {
                    	if (keySwitchesC.contains(Message.getNoteNumber()))
                    {	
                    	slider.setValue(index);
                    	slider1.setValue(index);
                    	
                    	else
                    	
                    	slider.setValue(Message.getVelocity());
                    	slider1.setValue(Message.getVelocity());
                    	
                    }	
                    }
                    

                    I get the error:

                    ! Line 8, column 2: Found 'else' when expecting a statement
                    
                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @trillbilly
                      last edited by d.healey

                      @trillbilly I just had a similar conversation with another forum member a few minutes ago :)

                      Code is written in blocks. Blocks are defined by opening and closing curly braces {}

                      Your if statement is a block, and so requires {}

                      if (something)
                      {
                      }
                      

                      Your else is also a block, so it also needs curly braces.

                      else
                      {
                      }
                      

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

                      trillbillyT 1 Reply Last reply Reply Quote 0
                      • trillbillyT
                        trillbilly @d.healey
                        last edited by

                        @d-healey ahhhh, yes. Now I see.

                        Im confusing myself on the order I should be doing this in.

                        *Example:
                        If slider changes value

                        else

                        these slider stay same value*

                        Im confused which way I call for the slider in the IF statement. Do I call just the slider or do I call the "cKeySwitch" Variable or "cAnimation" Function. I've tried them all and cant seem to figure it out. The animation compiles and still works but the issue is not fixed,

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

                          @trillbilly Write it out as a list, in English.

                          Do this,
                          Then do this,
                          If this, do this,
                          Otherwise do this
                          etc.
                          etc.

                          It might make it easier to figure out the flow of the program.

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

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

                          49

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          101.8k

                          Posts