HISE Logo Forum
    • Categories
    • Register
    • Login

    Failing at HISE 101

    Scheduled Pinned Locked Moved Solved Scripting
    18 Posts 2 Posters 630 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 That you for looking further into this, and taking the time to write this code. But I'm not sure what to do with the information that it works for someone else, but doesn't work for me. (I was using a MIDI list - it's an array.) I tried to import the snippet you provided, but I get an error message. I don't understand where to go from here. There's another section of my plugin where a simple comparison operation doesn't work. I have no explanation for what might be going on, and there's nothing I can think of which might be wrong with my code. I'll try downloading a later build, and see if that does anything. I do appreciate your efforts.

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

        @clevername27 said in Failing at HISE 101:

        I tried to import the snippet you provided, but I get an error message.

        Probably need to move to the latest develop branch for the snippet to load.

        @clevername27 said in Failing at HISE 101:

        I don't understand where to go from here.

        Simplify. Make a new project. In the interface script add your global variable, in the on note callback set the velocity.

        Add a second script, in it's note on callback read the velocity from the global variable.

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

        1 Reply Last reply Reply Quote 0
        • 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

                                26

                                Online

                                1.8k

                                Users

                                12.1k

                                Topics

                                105.0k

                                Posts