pierreguillot / Camomile

An audio plugin with Pure Data embedded that allows to load and to control patches
GNU General Public License v3.0
909 stars 65 forks source link

sliders with init value set produce an error #82

Closed jensdreske closed 6 years ago

jensdreske commented 6 years ago

If a hsl / vsl slider has an initial value saved in pd, the Camomile Console throws an error: "camomile parameter set method index: out of range" You can test this with the AlmondOrgan (au & vst).

It is sometimes useful to set initial values in pd- next to the default parameter settings in the .txt file

pierreguillot commented 6 years ago

Yes, it's normal. With Almond Organ (but another patch can work differently) when you change the value of a slider, the patch notifies the plugin that the value of the corresponding parameter has changed. At loading, the parameters are yet not initialized by the plugin so in this case, it doesn't work and you receive a warning. But anyway, before notifying the plugin that the value of a parameter has changed, you need to notify the plugin that value will change so even if the parameters were already created it wouldn't work like that. Anyway, it's just not a good approach because you can have a conflict between the default values of the parameters and the init values of the GUI. I guess, you want the init value in the Pd application so what you can do that doesn't interfere with the plugin behavior is to define the value of the slider with [set initvalue( and to define the value of processor with [initvalue(. For example, with the overdrive you can use this

screen shot 2018-01-30 at 2 59 21 pm

It will set the init value of the overdrive in the patch to 12 but the plugin will reset the value with the corresponding default parameter's value. I know, it's a bit complicated because the patch has not been created for this purpose but if you recreate another patch you can use a better/simpler approach.

What important to keep in mind is that the plugin can now work without the GUI. It's more flexible (for example, the value of a parameter can be the result of several GUIs) but also a bit more complicated (as you have to do the link manually between the GUIs and the parameters manually).

jensdreske commented 6 years ago

Ok, thank you for the explanation. For me the best approach right now is to avoid init values in pd and just add a message box I can bang manually. This also improves the readability of the patch and I can copy the values to the .txt file of the plugin later:

bildschirmfoto 2018-01-30 um 19 46 48

By the way there are more objects that need a delay to wait for the plugin to initialize. For example to get the samplerate i had to do this: [loadbang]->[delay 1000]->[samplerate~]->... (I didn't try how many milliseconds are necessary)

pierreguillot commented 6 years ago

I answered the sample rate question in this new issue #83. If it's good for you, you can close this one.

pierreguillot commented 6 years ago

FYI, now the parameters are created before loading the patch (v1.0.2). But it doesn't really change the problem.