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.5k 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.
    • 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

            12

            Online

            1.7k

            Users

            11.9k

            Topics

            103.3k

            Posts