HISE Logo Forum
    • Categories
    • Register
    • Login

    Global Variable stuck?

    Scheduled Pinned Locked Moved Solved Scripting
    7 Posts 2 Posters 61 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.
    • ChazroxC
      Chazrox
      last edited by

      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.

      Screenshot 2025-06-24 at 4.54.50 AM.png

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

        @Chazrox Have you declared that global variable in any of your other script processors?

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

        ChazroxC 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @d.healey
          last edited by

          @d-healey I just deleted the whole section, compiled, pasted the code back in and compiled then it worked.

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

            @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.

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

            ChazroxC 1 Reply Last reply Reply Quote 0
            • ChazroxC
              Chazrox @d.healey
              last edited by Chazrox

              @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.

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

                @Chazrox

                consts should only be declared in on init. If you need to declare a variable in one of the midi callbacks you can use local.

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

                ChazroxC 1 Reply Last reply Reply Quote 1
                • ChazroxC
                  Chazrox @d.healey
                  last edited by

                  @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! 🙏

                  1 Reply Last reply Reply Quote 0
                  • ChazroxC Chazrox marked this topic as a question
                  • ChazroxC Chazrox has marked this topic as solved
                  • First post
                    Last post

                  45

                  Online

                  1.8k

                  Users

                  12.0k

                  Topics

                  104.4k

                  Posts