Failing at HISE 101
-
@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.
-
@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.
-
@d-healey I'm confused (though appreciative) when you say not to use reg variables in the MIDI callback. The documentation reads:
-
@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.
-
@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.
-
@d-healey There may be no advantage, but why am I getting an error message that I can't use them at all?
-
@d-healey I don't understand - are you saying I can't use global variables in MIDI callbacks?
-
@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.
-
@d-healey Thank you - I may still be missing something. I did try with two non-deferred scripts.
-
@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.
-
@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.
-
@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.
-
@d-healey Thanks, man.
-
@d-healey Thank you again, Dave. I built with a newer dev branch, and it works. My immense gratitude.
-
-
-