HISE Logo Forum
    • Categories
    • Register
    • Login

    A Tutorial on Callbacks, Factories and Animation — and an Animated Disclosure Widget

    Scheduled Pinned Locked Moved Scripting
    17 Posts 3 Posters 625 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.
    • clevername27C
      clevername27 @d.healey
      last edited by clevername27

      @d-healey said in A Tutorial on Callbacks, Animation and Creating Panel Buttons — And an Animated Disclosure Widget:

      @Dr-Bill

      Would this be a "var" declaration, then?

      Avoid var like your life depends on it. The only place they should be used is in non-inline functions.

      Please do call me out when I should be using a reg variable.

      All the HISE documentation links on variable types lead to 404 pages.

      Not this one :)

      Link Preview Image
      HISE | Docs

      favicon

      (docs.hise.audio)

      I appreciate the link; I guess I'm particular on these things. The text you refer to is an optional style guideline; it's not documentation, nor meant to be. Any technical discussion therein is incidental, incomplete, and not within a referential context.

      This is the documentation link for data types is here: ```
      https://docs.hise.audio/scripting/scripting-in-hise/javascript.html#data-types

      1 Reply Last reply Reply Quote 0
      • clevername27C
        clevername27 @ustk
        last edited by clevername27

        @ustk Thank you for taking the time to write this code. I've incorporated your colour assignment, as that's simpler than referring the user to the Properties panel—nice thinking. Please understand that I am writing a tutorial; you code is certainly more efficient, but not pedagogical. (I love your use of the data extension.)

        Can you please explain what you mean by "…don’t use var but reg for what can be modified"?

        d.healeyD ustkU 2 Replies Last reply Reply Quote 0
        • d.healeyD
          d.healey @clevername27
          last edited by d.healey

          @Dr-Bill

          Can you please explain what you mean by "…don’t use var but reg for what can be modified"?

          Always use reg for any data that isn't constant (except arrays/objects). The only time you should use var is in functions, and that's only because we have no other choice. The reason to avoid var is because var leaks into the script wide namespace.

          952a047b-c049-417a-be12-21c727315b25-image.png

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

          clevername27C 1 Reply Last reply Reply Quote 1
          • clevername27C
            clevername27 @d.healey
            last edited by

            @d-healey Thank you - I originally had the variables outside the functions as reg, but @ulrik suggested they should be var or const var, so I made the change. Is it possible I am misunderstanding both of you?

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

              @Dr-Bill

              I originally had the variables outside the functions as reg

              Sounds like you had it right for those variables. If they needed to be script-wide then reg was the way to go.

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

              clevername27C 1 Reply Last reply Reply Quote 1
              • clevername27C
                clevername27 @d.healey
                last edited by

                @d-healey What's funny is that in my comments explaining why I used reg variables, I named-check you, saying you preferred reg variables. 😃 (Look back through the post edits back to the initial post.)

                Bottom line is you guys are both are far more knowledge about HISE than me. I appreciate your insights on my tutorials, and help with my forum questions—thank you.

                1 Reply Last reply Reply Quote 1
                • ustkU
                  ustk @clevername27
                  last edited by

                  @Dr-Bill no worries, my pleasure to contribute

                  I don’t take what you said badly of course, but I think a method that is more straight forward and doesn’t lead beginners to bad practices can’t be less pedagogical than your method.
                  I don’t have the time to comment my code today though, excuse me for this…

                  Can't help pressing F5 in the forum...

                  clevername27C 1 Reply Last reply Reply Quote 2
                  • clevername27C
                    clevername27 @ustk
                    last edited by

                    @ustk I'll have a think on that for the next tutorial I write - cheers, mate.

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @clevername27
                      last edited by

                      @Dr-Bill Excuse me if, as a non native speaker, what I wrote offended you in some ways, it was absolutely not meant to do it...
                      That been said, your demonstration still contains some hiccups if I might say it this way.
                      I have to go more deeply through your code because tonight I run out of time, but there's one thing that I think is weird.
                      You are talking about globals, I understand what you mean regarding the tuto, they global in a sense. But global variables are defined using global and have a special purpose, which is being accessed from other scripts.

                      Can't help pressing F5 in the forum...

                      clevername27C 1 Reply Last reply Reply Quote 1
                      • clevername27C
                        clevername27 @ustk
                        last edited by

                        @ustk Not at all, mate. You and what you wrote are awesome; I appreciate the opportunity to learn from someone as knowledgable about HISE as you. I value any critiques you can offer from going through my code - thank you! I'll follow up on any suggestions/corrections you make.

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

                        17

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        103.0k

                        Posts