HISE Logo Forum
    • Categories
    • Register
    • Login

    Failing at HISE 101

    Scheduled Pinned Locked Moved Solved Scripting
    18 Posts 2 Posters 585 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

      @d-healey I'm confused (though appreciative) when you say not to use reg variables in the MIDI callback. The documentation reads:

      0a4bb713-f75e-419c-82c9-1915b06dc9d0-image.png

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

        @clevername27 When it says use reg instead of var for variables which are access in the MIDI callback - that's for variables you have declared in on init. For variables you declare in the on note callback you *can use reg, but as far as I'm aware there is no advantage over using local and since you only have 32 reg variables per namespace you should only use them when needed.

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

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

          @clevername27 said in Failing at HISE 101:

          I globally allocated an array in my Interface Script Processor

          You should be doing this in a non-deferred script because you have no guarantee that this one's midi callbacks will trigger when the UI is closed or that they will trigger before the other scripts that are not deferred and are reading the values.

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

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

            @d-healey There may be no advantage, but why am I getting an error message that I can't use them at all?

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

              @d-healey I don't understand - are you saying I can't use global variables in MIDI callbacks?

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

                @clevername27 said in Failing at HISE 101:

                @d-healey There may be no advantage, but why am I getting an error message that I can't use them at all?

                Ah looks like you can't use them there after all - I never tried. Use local and all will be well.

                @clevername27 said in Failing at HISE 101:

                are you saying I can't use global variables in MIDI callbacks?

                Nope. I'm saying you can't depend on a value set in a deferred script's MIDI callback to be available in a non-deferred scripts MIDI callback when you want it to be.

                You should use two non-deferred scripts. Separate the concerns, the UI script should only be used for UI stuff, anything not directly related to the UI should be in one or more separate MIDI processors and the UI script should connect to them as needed.

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

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

                  @d-healey Thank you - I may still be missing something. I did try with two non-deferred scripts.

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

                    @clevername27 said in Failing at HISE 101:

                    @d-healey Thank you - I may still be missing something. I did try with two non-deferred scripts.

                    We're talking about two separate things. Using two non-deferred scripts is good practice, but won't solve the issue you're having. There is something else wrong with your code but no way of knowing without seeing the whole project. So try the simple version I suggested and see if that works (it does for me) and then figure out from that what is different in your implementation in your main project.

                    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 did try a simple test - I simply cannot access the global array from one script processor in another. I'll try downloading another build. Thank you again for your continued assistance.

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

                        @clevername27 said in Failing at HISE 101:

                        I'll try downloading another build.

                        Let me know how it goes in the latest develop branch, you should be able to load my snippet there.

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

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

                          @d-healey Thanks, man.

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

                            @d-healey Thank you again, Dave. I built with a newer dev branch, and it works. My immense gratitude.

                            1 Reply Last reply Reply Quote 1
                            • clevername27C clevername27 has marked this topic as solved on
                            • clevername27C clevername27 has marked this topic as unsolved on
                            • clevername27C clevername27 has marked this topic as solved on
                            • First post
                              Last post

                            52

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            102.2k

                            Posts