Failing to prevent onRandomize from setting certain params

(Josbouten) #1

I noticed that a call to onRandomize will randomize all parameters.
However I use 2 gain parameters whose values shouldn’t get too large. So I thought I set them myself at the end of my version of onRandomize to an acceptable value. However, this code does not seem to have an effect:

void Vocode_O_Matic::onRandomize() {
// set some vars and state here.


params[CARRIER_GAIN_PARAM].value = INITIAL_CARRIER_GAIN;
params[MODULATOR_GAIN_PARAM].value = INITIAL_MODULATOR_GAIN;
}

Can anyone explain this behaviour?

(Andrew Belt) #2

A call to onRandomize does not random parameters. That is done lower in the call stack. onRandomize is an event that is called so your module can randomize its own internal state. If you wish to randomize certain parameters differently than uniform, you can override ParamWidget::onRandomize in v1.

Suggestions for better handling this is welcome, since the v1 API is not yet stable.

(Josbouten) #3

Thx, I’m using the 0.6 code base. What can I do there?
B.t.w. is the v1 code base available for plugin development?

(Andrew Belt) #4

It’s in the v1 git branch. Migrating plugins to the v1 API is not yet recommended by https://vcvrack.com/manual/Migrate1.html, but you can if you want.