HISE Logo Forum
    • Categories
    • Register
    • Login

    SNEX UI Parameters

    Scheduled Pinned Locked Moved ScriptNode
    12 Posts 4 Posters 571 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.
    • ?
      A Former User @Straticah
      last edited by

      @Straticah

      idk what's going on with this example, but to get SNEX parameters working:

      f8e831fb-2957-44e3-8ae7-53ef4e575d07-image.png

      click the 3 dots -> "Add Parameter", give it a name and range of values, then in the SNEX script

      //declare a variable the parameter will control
      float myVar = 0.0; 
      
      template <int P> void setParameter(double v)
      {
      	if (P ==0) // the index of our parameter
      	{
      		myVar = v;
      	}
      }
      

      you can inspect the variable changing by opening the data table (eye icon)

      6616bc85-b740-4239-925b-4d6fb2f99d4b-image.png

      1 Reply Last reply Reply Quote 1
      • Christoph HartC
        Christoph Hart @Straticah
        last edited by

        @Straticah I‘m afraid you need a basic understanding of C++ in order to write C++ code :)

        In your example you‘re redeclaring a variable within the same scope.

        tobanteT 1 Reply Last reply Reply Quote 0
        • tobanteT
          tobante @Christoph Hart
          last edited by

          @Christoph-Hart Which variable is redeclared? I don't see it? He has scopes around each parameter.

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @tobante
            last edited by

            @tobante scriptnode::parameter p, line 69

            tobanteT 1 Reply Last reply Reply Quote 0
            • tobanteT
              tobante @Christoph Hart
              last edited by

              @Christoph-Hart

              But this is legal:

              {
                  // scope a
                  int p = 42;
                  // ...
              }
              {
                  // scope b
                  int p = 43;
                  // ...
              }
              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @tobante
                last edited by

                @tobante Yes but this isn't:

                int p = 41;
                {
                
                }
                int p = 42;
                
                tobanteT 2 Replies Last reply Reply Quote 0
                • tobanteT
                  tobante @Christoph Hart
                  last edited by

                  @Christoph-Hart I'm still confused.

                  • Function: L59 -L75 (contains 2 nested scopes)
                  • Scope A: L60 -L65 (contains 1st p)
                  • Scope B: L68 -L74 (contains 2nd p)

                  Indentation is a little misleading, but it is valid.

                  1 Reply Last reply Reply Quote 0
                  • tobanteT
                    tobante @Christoph Hart
                    last edited by

                    @Christoph-Hart I agree that your example is invalid, but that's not what @Straticah has in his example. The error probably is that he uses d for the parameter he called data. Not sure why the compiler flags line 58. Maybe it's always beginning of function.

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @tobante
                      last edited by

                      @tobante 1b1f11d4-31ad-4d58-8b81-c3b3b250d3da-image.png

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @Christoph Hart
                        last edited by

                        haha, now I see it too. That is a contender for worst code formatting ever...

                        tobanteT 1 Reply Last reply Reply Quote 1
                        • tobanteT
                          tobante @Christoph Hart
                          last edited by

                          @Christoph-Hart I was so confused, because I gave @Straticah the code from your GitHub repo. :)

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

                          48

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          102.1k

                          Posts