reg declaration "error at definition"
-
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? -
@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...
-
@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.
-
@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
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? -
@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.
-
@d-healey
sorry it quite messy...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... -
@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
(orlocal
within inline functions).All those
reg
variables you have could be replaced with a singleconst
- look up JSON.