View Single Post
Old 06-30-2019, 11:06 AM   #21
Human being with feelings
Join Date: Dec 2015
Posts: 323

Originally Posted by schwa View Post
That does look like a bug in iplug's handling of the kIsProgramChange parameter. For nofish's plugin, when trying to set the (say) 7th program, REAPER first calls plainParamToNormalized(7) to see if the plugin does something sensible. In this case, that function returns 7, which isn't normalized. This is sort of a bug, but can be worked around by REAPER, which sets the parameter to 0.875, because it's the 7th program of 8 total. The plugin accepts this and changes its parameters.
I've fixed IPlug to the point is works on other hosts, and almost works on Reaper. Sorry, I need to parse what you're saying here to see if you misstated, or I misunderstand how it's suppose to work.

You describe a list of 8 presets. Trying to set the 7th program (7th menu item), wouldn't Reaper call plainParamToNormalized(6), instead of (7)?

In getProgramListInfo, I believe info.programCount should be set to the number of presets (8).

In vstparameters.h/Parameter::Parameter , I believe that stepCount should pass 7 (the docs are clear that a range of 0-127 has a stepCount of 127). Similarly, it seems that the vst3 host considers preset numbers to be 0...7, so a normalized value of 0 represent the first preset (non-normalized 0), and 1 represents the last preset on the menu (non-normalized 7).

Anything there I said wrong?

After fixing things like plainParamToNormalized in IPlug, my plugin works on other hosts, and also bring up the correct preset in Reaper. However the menu checkmark and the displayed name of the preset misbehaves in this way: With 36 presets (0-35), the first 18 display correctly. The second half is off by one (the plugin selects the chosen preset, but the menu indication is one higher), except for the last one. That is, it behaves as it for the purpose of displaying the menu choice, the host (perhaps with the plugin's help) is assuming a 0-36 range (but clipping to 35). I don't see anywhere in IPlug that I'm making a mistake, so I'm wondering if I'm understanding the definitions wrong.

I've confirmed that I'm using 35 where I think I should (most places), and 36 for the number of presets. I've confirmed that my get/setParamNormalized and plainParamToNormalized do the correct conversions for all values. And I've confirmed that when I set preset index 10 (the 11th preset), Reaper asks for preset name with index 10, and if I set index 34, it asks for preset name index 35(!).
earlevel is offline   Reply With Quote