Best practice to handle a lot of parameters (HL sliders)

(Josbouten) #1

Hi, I’m considering adding a lot (4 * 31) of sliders to a module. So far in the step() method in the modules that I experimented with I scanned the values of knobs etc and applied them either every time step() was called or I used a counter to only do that once every half second or so. With 4 * 31 sliders, and given that the odds are that they will seldomly be changed even checking them every half second will often be a waste of time. So I was wondering whether there exists a method where one can define a callback to a method that will only be called as soon as a parameter is changed, like one often finds in event loops that motor a gui. I would then like to define one callback routine that identifies which slider was affected and then does something appropriate. Does this exist in Rack or can this be achieved in some way?

(Andrew Belt) #2

In Rack, think like a hardware designer. If you want to optimize reading parameters, simply recompute your module’s internal state every N samples.

(Josbouten) #3

Ok, I’m doing this now. But I’m not sure at what point in time after loading a module the params array is initialised. I get the impression that this happens at some point in time AFTER the definitions and statements in Module {} are executed. It appears that any initialisation done there may be undone by the params being set from the patch file. This is to be expected, but it would be good to know what the sequence of events is in order to be able to initialise them. And what happens if there is no patch file? How are the params initialised then? I’m also wondering whether the onReset method could be called as a general initialisation routine (a sort of onInitialisation() perhaps). Questions, questions, questions …

(Andrew Belt) #4

In Rack v1, all params are set to their default values upon Module construction if you use configParam instead of createParam to set param defaults and limits.

(Josbouten) #5

I’m still using v0.6 ( as I’ve read somewhere that it is discouraged to start migrating to 1 until it is finally released ). So how does this work in v0.6?

(Andrew Belt) #6

There is no guaranteed point in time that the params array is initialized in Rack v0.6.

(Josbouten) #7

Ok, then a wise approach would be to call some initialisation routine once (only once) in the step() function?