12-16-2022, 04:10 AM | #1 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
CLAP parameter modulation LFO shape (FIXED)
While testing prereleases of our plugins in CLAP format I came across a possible bug with CLAP and REAPR's LFO parameter modulation.
Steps to reproduce:
For both VST2 and AU all LFO shapes work, even if the parameter is stepped, so I guess this is a off-by-one bug in REAPER's CLAP implementation, although it could also be a bug in Kee Bass. Tested with Kee Bass v1.2.0 RC1 in REAPER v6.71 on both Windows 10 x64 and macOS 12.6.2 M1. Last edited by Tale; 12-19-2022 at 12:53 AM. Reason: Fixed |
12-16-2022, 08:03 AM | #2 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
I don't see a bug here. If the plugin reports that the parameter is stepped, certain behaviors change in REAPER. The easiest way to see this is to display an envelope for the parameter.
|
12-16-2022, 08:37 AM | #3 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Well, if I do this for the Prio parameter, which has 3 steps, then both VST2 and CLAP show an envelope with 3 steps. However, if I modulate that parameter using a triangular LFO at 0.25 Hz, then with VST2 this will result in the following repeating sequence:
0 = Low (1 second) 1 = High (1 second) 2 = Last (1 second) 1 = High (1 second) But if I do the same with CLAP, then I get this repeating sequence: 0 = Low (1 second) 1 = High (2 seconds) 0 = Low (1 second) Like I said, it never reaches the 3rd value. IMHO what VST2 (and AU) do makes more sense. Also, because it seems to go from 0..N-2 instead of 0..N-1 (where N = number of steps), for parameters with only 2 steps it actually always stays at 0. I'd say this makes the random LFO shape a lot less random... |
12-16-2022, 10:20 AM | #4 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
OK, couple of things happening I think.
The CLAP plugin supports CLAP_PARAM_IS_STEPPED, but the VST does not seem to support effGetParameterProperties, which is why REAPER knows the CLAP parameter is stepped but doesn't know the VST parameter is stepped. That's fine though, it's not required for the VST to support effGetParameterProperties. Given CLAP_PARAM_IS_STEPPED, I think the plugin should quantize the parameter range rather than just taking the floor. With an integer range of [0,2], if the host sets a floating point value > 1.33.. [edit: more simply, >= 1.5], the plugin should quantize it to 2. This is what happens when the host tries to change the Prio parameter: get 2.000000 set 1.998000 get 1.000000 set 0.998000 get 0.000000 Last edited by schwa; 12-17-2022 at 09:18 AM. |
12-16-2022, 03:13 PM | #5 | |||
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Quote:
Quote:
Quote:
|
|||
12-16-2022, 03:23 PM | #6 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
REAPER definitely calls it. The plugin returns 0 and doesn't alter the passed-in struct.
|
12-16-2022, 03:45 PM | #7 | |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Quote:
I ask because I just logged the opcodes for all calls to my VSTDispatcher when loading VSTi: Kee Bass (in REAPER v6.72rc8 on macOS M1), and I really don't see opcode 56. |
|
12-16-2022, 03:47 PM | #8 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
56, yes. The call won't happen unless it's needed, so you'd need to do something like display a track envelope for the Prio parameter.
|
12-16-2022, 04:10 PM | #9 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Oops, I expected it to call it on loading. Anyway, yeah now I see the call, but AFAICT I am in fact altering the struct, and returning 1.
This is my code (from IPlugVST2.cpp): Code:
VstParameterProperties* const pp = (VstParameterProperties*)ptr; const IParam* const pParam = _this->GetParam(idx); vst_strncpy(pp->label, pParam->GetNameForHost(), kVstMaxLabelLen); switch (pParam->Type()) { case IParam::kTypeBool: { pp->flags = kVstParameterIsSwitch; break; } case IParam::kTypeEnum: { pp->flags = kVstParameterUsesIntegerMinMax | kVstParameterUsesIntStep; pp->minInteger = 0; pp->maxInteger = ((const IEnumParam*)pParam)->NEnums() - 1; pp->largeStepInteger = pp->stepInteger = 1; break; } } static const int len = kVstMaxShortLabelLen; vst_strncpy(pp->shortLabel, pParam->GetNameForHost(len), len); ret = 1; |
12-17-2022, 04:21 AM | #10 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
My plugin was version 1.0.1. I updated to 1.1.0 and now effGetParameterProperties is supported.
|
12-17-2022, 04:45 AM | #11 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Oops, sorry for the confusion, but I did say that I was using Kee Bass v1.2.0 RC1, and I've linked it in the OP.
Anyway, mystery solved then, thanks! |
12-17-2022, 04:53 AM | #12 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
BTW, although rounding stepped CLAP parameter values seems like a good idea, and fixes my issue, I think it might be against the spec. Here is what CLAP's params.h has to say about it:
Code:
// Is this param stepped? (integer values only) // if so the double value is converted to integer using a cast (equivalent to trunc). CLAP_PARAM_IS_STEPPED = 1 << 0, |
12-17-2022, 08:57 AM | #13 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
Hm, I will bring this up in the CLAP discussion group. I think the trunc recommendation should be changed to round.
Last edited by schwa; 12-17-2022 at 09:17 AM. |
12-17-2022, 11:40 AM | #14 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,519
|
Here's the discussion on the CLAP github:
https://github.com/free-audio/clap/issues/242 We'll change it so REAPER rounds the values before handing them to the plugin, so it shouldn't matter whether the plugin uses round or floor. |
12-18-2022, 03:44 AM | #15 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Thanks!
|
12-20-2022, 12:20 AM | #16 |
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,716
|
Fixed in REAPER v6.72.
|
Thread Tools | |
Display Modes | |
|
|