• Dark Theme
    • Categories
    • Register
    • Login
    HISE Logo Forum
    • Categories
    • Register
    • Login

    SNEX UI Parameters

    Scheduled Pinned Locked Moved ScriptNode
    12 Posts 4 Posters 468 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.
    • S
      Straticah
      last edited by Straticah 13 Dec 2023, 15:58

      Hey there i am using the SNEX template in scriptnode.
      How do i add my parameters here? (Line 58) I am getting a compile error.

      bb0b3e15-0838-41f2-8359-ab55ec29f243-image.png

      building user interfaces in HISE :)
      web: www.vst-design.com

      I C 2 Replies Last reply 13 Dec 2023, 16:12 Reply Quote 0
      • I
        iamlamprey @Straticah
        last edited by 13 Dec 2023, 16:12

        @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
        • C
          Christoph Hart @Straticah
          last edited by 13 Dec 2023, 16:16

          @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.

          T 1 Reply Last reply 13 Dec 2023, 16:31 Reply Quote 0
          • T
            tobante @Christoph Hart
            last edited by 13 Dec 2023, 16:31

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

            C 1 Reply Last reply 13 Dec 2023, 16:34 Reply Quote 0
            • C
              Christoph Hart @tobante
              last edited by 13 Dec 2023, 16:34

              @tobante scriptnode::parameter p, line 69

              T 1 Reply Last reply 13 Dec 2023, 16:36 Reply Quote 0
              • T
                tobante @Christoph Hart
                last edited by 13 Dec 2023, 16:36

                @Christoph-Hart

                But this is legal:

                {
                    // scope a
                    int p = 42;
                    // ...
                }
                {
                    // scope b
                    int p = 43;
                    // ...
                }
                C 1 Reply Last reply 13 Dec 2023, 17:09 Reply Quote 0
                • C
                  Christoph Hart @tobante
                  last edited by 13 Dec 2023, 17:09

                  @tobante Yes but this isn't:

                  int p = 41;
                  {
                  
                  }
                  int p = 42;
                  
                  T 2 Replies Last reply 13 Dec 2023, 17:37 Reply Quote 0
                  • T
                    tobante @Christoph Hart
                    last edited by 13 Dec 2023, 17:37

                    @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
                    • T
                      tobante @Christoph Hart
                      last edited by 13 Dec 2023, 17:41

                      @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.

                      C 1 Reply Last reply 13 Dec 2023, 19:02 Reply Quote 0
                      • C
                        Christoph Hart @tobante
                        last edited by 13 Dec 2023, 19:02

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

                        C 1 Reply Last reply 13 Dec 2023, 19:03 Reply Quote 0
                        • C
                          Christoph Hart @Christoph Hart
                          last edited by 13 Dec 2023, 19:03

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

                          T 1 Reply Last reply 13 Dec 2023, 19:03 Reply Quote 1
                          • T
                            tobante @Christoph Hart
                            last edited by 13 Dec 2023, 19:03

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

                            1 Reply Last reply Reply Quote 0
                            6 out of 12
                            • First post
                              Last post

                            21

                            Online

                            1.9k

                            Users

                            10.8k

                            Topics

                            94.2k

                            Posts