Global Variable stuck?
-
I changed one of my 'const var's to a 'global' then I decided I wanted to change it back to a 'const var'.... now it tells me the my variable is already defined as a global... I rewrote the line and restarted Hise but now that line that is calling for a value no longer can get the value.
-
@Chazrox Have you declared that global variable in any of your other script processors?
-
@d-healey I just deleted the whole section, compiled, pasted the code back in and compiled then it worked.
-
@Chazrox Magic! I have never used a global variable in a released project, I recommend avoiding them unless you have no other choice - I have yet to see that situation.
-
@d-healey are 'const var's within 'onNoteOn' or 'onNoteOff' considered "defined on a global level"? Im trying to see where is the best place to have values that can be called on from any external script. Sometimes my .getValue();s dont work unless I define it close by, sometimes as a local within my function just to be extra sure.
-
consts
should only be declared inon init
. If you need to declare a variable in one of the midi callbacks you can uselocal
. -
@d-healey Good to know! I have a bunch of 'consts' in my 'onNoteOn's. Im going to change them now and hope nothing breaks. Thank You!
-
C Chazrox marked this topic as a question
-
C Chazrox has marked this topic as solved