HISE Logo Forum
    • Categories
    • Register
    • Login

    reg declaration "error at definition"

    Scheduled Pinned Locked Moved General Questions
    7 Posts 3 Posters 198 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.
    • A
      Allen
      last edited by

      After using reg declaration for about 40 times in order to scale the values and send them to Math.from0To1, I found i start to get the "error at definition".
      I 've double checked there isn't any reg in any functions (cuz i only have four functions is this project now...)
      It there a number limit for this? Are there alternatives which could do the same job in Hise?

      Matt_SFM d.healeyD 2 Replies Last reply Reply Quote 0
      • Matt_SFM
        Matt_SF @Allen
        last edited by

        @Allen There's a limit of 32 reg variables per namespace but, maybe there's a better way of doing what you want to do. Using 32 reg variables just to scale a value seems a bit much...

        Develop branch
        Win10 & VS17 / Ventura & Xcode 14. 3

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

          @Allen You only get 32 reg variables per namespace. Without seeing your code it's hard to guide you but it's likely you can replace a lot of your reg variables with consts and arrays. You might also be able to modularize your code into inline functions to make use of local variables.

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

          1 Reply Last reply Reply Quote 1
          • A
            Allen @Matt_SF
            last edited by

            @Matt_SF @d-healey
            Thank you guys! I didn't know there's a limitation. I splited these regs into several namespaces and now it works!

            It's a "self-tuning" effect like this
            hse5.gif hse4.gif

            Each slider controls about 20 parameters plus receving extra values send by lfos. I need to scale values for almost every parameters into certain ranges in order to not let it sounding too bad.
            I found Math.from0to1 pair with reg are probably the most easy and stright forwarwd way to scale values so i used that quite a lot.
            Are there any alternative ways for this?

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

              @Allen said in reg declaration "error at definition":

              Are there any alternative ways for this?

              Almost certainly, but without seeing your code it's difficult to give guidance.

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

              A 1 Reply Last reply Reply Quote 0
              • A
                Allen @d.healey
                last edited by

                @d-healey
                sorry it quite messy...

                HISE - aether fx 2024_08_09 22_19_37.png HISE - aether fx 2024_08_09 22_19_49.png HISE - aether fx 2024_08_09 22_20_01.png

                this is basically all i do for all my four main slider. Just bunch of reg , setAttribute and getValue
                I've downsized a lil bit of the regs in the LFO part by some weird math stuff...(which is the first picture)
                I think this project is most completed right now but I will definitely reach in the 32 limit in the future update...

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

                  @Allen Yes your code could be vastly improved. If you send me your project I will make a video for my YouTube channel going through some of the things I think could help to make your code more manageable.

                  Here are some general tips.

                  Never use var unless you have no other choice.

                  Objects and arrays should generally be declared as const (or local within inline functions).

                  All those reg variables you have could be replaced with a single const - look up JSON.

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

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post

                  16

                  Online

                  1.7k

                  Users

                  11.8k

                  Topics

                  102.5k

                  Posts