COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 05-31-2019, 01:01 PM   #1
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default Reaper 5.978 loads VST3 presets but always shows "Default" preset name

Strange problem in Reaper with VST3 plugin I am building/testing. Reaper loads the plugin's factory preset control settings OK but always shows "Default" program name. Please see video screenshot here: https://drive.google.com/open?id=1Cn...PCjvCI3P1Ucl1s

VST2 version of the plugin works as expected (programs load and show correct names).

Any idea what is causing this? This plugin works OK in other DAWs so I'm assuming it's a problem in Reaper? Reaper is usually pretty solid so this has me concerned.

BTW - I have tried previous builds of Reaper going back to 5.975 and they do the same thing
Nonlinear is offline   Reply With Quote
Old 05-31-2019, 01:15 PM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

For VST3s, when the user chooses a factory program, REAPER calls setParamNormalized on the parameter that the plugin exports marked as kIsProgramChange, then immediately calls getParamNormalized on that parameter. Maybe your plugin is not returning the same value that REAPER is setting?
schwa is offline   Reply With Quote
Old 05-31-2019, 05:56 PM   #3
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by schwa View Post
For VST3s, when the user chooses a factory program, REAPER calls setParamNormalized on the parameter that the plugin exports marked as kIsProgramChange, then immediately calls getParamNormalized on that parameter. Maybe your plugin is not returning the same value that REAPER is setting?
All the parameters are loading properly - what is not loading properly is the preset name. It appears briefly then switches back to "Default" (please see the video I linked to above). All the settings load and stay as they should but the loaded preset name changes back. Weird. It doesn't do this in Cubase or Cakewalk.
Nonlinear is offline   Reply With Quote
Old 05-31-2019, 06:46 PM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

This is your plugin, right? I would guess the problem is that the parameter your plugin specifies as kIsProgramChange does not return the value that it is set to, immediately after REAPER sets it. In other words, the user changes the program, then REAPER asks the plugin what program it thinks it is set to, and the plugin doesn't respond with the same program number that the user set. If you are using some wrapper code and therefore don't know what I'm talking about, then there's maybe not much we can do on our side to help.
schwa is offline   Reply With Quote
Old 05-31-2019, 10:06 PM   #5
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by schwa View Post
This is your plugin, right? I would guess the problem is that the parameter your plugin specifies as kIsProgramChange does not return the value that it is set to, immediately after REAPER sets it. In other words, the user changes the program, then REAPER asks the plugin what program it thinks it is set to, and the plugin doesn't respond with the same program number that the user set. If you are using some wrapper code and therefore don't know what I'm talking about, then there's maybe not much we can do on our side to help.
I am using the Cockos WDL-OL "iPlug" framework. Will search through it and see if I can dig down to what you suggest.

Now, how do you explain that this works properly in other VST3 DAWs?
Nonlinear is offline   Reply With Quote
Old 06-01-2019, 05:48 AM   #6
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

FWIW the VST3 version of my plugin (also made with iPlug) behaves the same in REAPER, always snaps back to first (default) preset entry though the parameters do change. (the VST2 version behaves correctly in this regard)
I always thought it's a bug in iPlug so I stopped bothering at some point, also I don't have another VST3 host currently to test / compare with.




It's here:
http://www.vst4free.com/free_vst.php?id=2483

Last edited by nofish; 06-01-2019 at 05:55 AM.
nofish is offline   Reply With Quote
Old 06-01-2019, 06:04 AM   #7
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

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.

Separately, REAPER regularly polls the plugin to see what it thinks its program is set to, because many plugins support their own internal preset system. This plugin always responds that its kIsProgramChange parameter is set to zero, which is definitely a bug, so on the next poll, REAPER says OK fine and sets the dropdown back to the first program.

I'm going to move this thread to the WDL users forum.
schwa is offline   Reply With Quote
Old 06-01-2019, 06:13 AM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Thanks for having a look schwa.

To add, this was made with the 'old' WDL-OL/iPlug, I haven't used Olli's new/current iPlug v2 yet, so I don't know if it still happens there.
nofish is offline   Reply With Quote
Old 06-01-2019, 10:22 AM   #9
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
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.

Separately, REAPER regularly polls the plugin to see what it thinks its program is set to, because many plugins support their own internal preset system. This plugin always responds that its kIsProgramChange parameter is set to zero, which is definitely a bug, so on the next poll, REAPER says OK fine and sets the dropdown back to the first program.

I'm going to move this thread to the WDL users forum.
OK, but, if it's a bug in iPlug (and not Reaper) why do these plugins work properly in Cubase, Cakewalk, etc.? Here is my plugin running in Cubase 10: https://drive.google.com/file/d/1eKR...ew?usp=sharing It works exactly as it should.

All of the parameters in my preset list ARE normalized and load correctly. What "snaps back" in Reaper is only the preset NAME.

Last edited by Nonlinear; 06-01-2019 at 10:37 AM.
Nonlinear is offline   Reply With Quote
Old 06-01-2019, 12:10 PM   #10
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

Quote:
Originally Posted by Nonlinear View Post
OK, but, if it's a bug in iPlug (and not Reaper) why do these plugins work properly in Cubase, Cakewalk, etc.?
Because those DAWs do not poll the plugin to see if it changed its own preset? All I can tell you is what I see from REAPER's side with nofish's plugin. The plugin always responds that it is set to the first preset, so REAPER always switches back to display the first preset in the dropdown list.
schwa is offline   Reply With Quote
Old 06-01-2019, 12:16 PM   #11
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

Also, something I think you're not getting is that the way VST3 built-in programs work, the plugin exports one special parameter marked as the program change parameter. The host tells the plugin to change its program by setting a new value for this parameter, the same way the host tells the plugin to change any other parameter. The plugin also reports the value it thinks the parameter is set to, just like any other parameter. It looks like iplug, or at least whatever version nofish is using, does not quite handle that special parameter correctly, and always reports that it is set to zero.
schwa is offline   Reply With Quote
Old 06-02-2019, 04:05 AM   #12
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 356
Default

I just tested this on one of my plugins using IPlug1, and the same issue occurs in Reaper. I'll try to do some digging into IPlug.
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 06-04-2019, 04:36 PM   #13
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 356
Default

I think I got this.

I made two changes in IPlugVST3.cpp. The first change is with getParamNormalized(). This is around line 843. I am not sure if this was something I did earlier, but there was code that was commented out. The complete function I have is:
Code:
 ParamValue PLUGIN_API IPlugVST3::getParamNormalized(ParamID tag)
{  
  if (tag == kBypassParam) 
  {
    return (ParamValue) mIsBypassed;
  }
   else if (tag == kPresetParam) 
   {
     return (ParamValue) ToNormalizedParam(mCurrentPresetIdx, 0, NPresets(), 1.);
   }

    
    if (tag >= mPublicParams) return 0.0;
    
  IParam* param = GetParam(tag);

  if (param)
  {
    return param->GetNormalized();
  }

  return 0.0;
}
The second change (and I think what is more of the fix to this problem) is in setParamNormalize(). This is right after the previous function in my code. I added some code to set mCurrentPresetIdx. The complete function is:
Code:
tresult PLUGIN_API IPlugVST3::setParamNormalized(ParamID tag, ParamValue value)
{

	if (tag == kBypassParam)
	{
		mIsBypassed = (bool)value;
		return kResultOk;
	}
	else if (tag == kPresetParam)
	{
		mCurrentPresetIdx = FromNormalizedParam(value, 0, NPresets(), 1.);
		return kResultOk;
	}

    if (tag >= mPublicParams) return kResultFalse;
    
  IParam* param = GetParam(tag);

  if (param)
  {
    param->SetNormalized(value);
    return kResultOk;
  }

  return kResultFalse;
}
Hope it works. I don't think it should affect/break anything else.
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 06-04-2019, 08:35 PM   #14
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by random_id View Post
Hope it works. I don't think it should affect/break anything else.
Thank you for looking into this and posting what you found.

I was not able to include the line "if (tag >= mPublicParams) return kResultFalse;" as my compiler could not find "mPublicParams". Did you add that somewhere as well?

Now, this fixed the preset name issue but for some reason my presets still load erratically. Please try clicking around in your presets and see if they load the correct values to the parameters. Now try clicking on the same preset twice in a row. In my plugin there seems to be two different sets of values being loaded and it toggles between them if I click on the same preset twice in a row. I don't know where the second set of values is coming from.

BTW - I also found a major error in the VST3 host bypass function (with latency). NChanDelay.h had an error that prevented any signal from passing. I don't know why no one else found this previously (iPlug1 has been around a long time). The corrected code is below:

Code:
  void ProcessBlock(double** inputs, double** outputs, int nFrames)
  {
    double* buffer = mBuffer.Get();
    
    for (int s = 0 ; s < nFrames; ++s)
    {

      for (int chan = 0; chan < mNumInChans; chan++) 
      {
        if (chan < mNumOutChans)
        {
		  double input = inputs[chan][s];
		  int offset = chan * mDTSamples;
		  outputs[chan][s] = buffer[offset + mWriteAddress];
		  buffer[offset + mWriteAddress] = input;
		}
      }
      
      mWriteAddress++;
      mWriteAddress %= mDTSamples;
    }
  }
It is frustrating that a framework as mature as iPlug has these significant errors. Maybe VST3 support is only "half baked" and perhaps that's why Oli stopped supporting it in favor of iPlug2?

Last edited by Nonlinear; 06-05-2019 at 07:24 AM.
Nonlinear is offline   Reply With Quote
Old 06-05-2019, 07:57 AM   #15
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

OK, seems to be working now EXCEPT the very last program in the list does not load the parameters, only the name. It's doing it in every host DAW I have tried, so there's still an issue in iPlug somewhere...

Last edited by Nonlinear; 06-05-2019 at 09:38 AM.
Nonlinear is offline   Reply With Quote
Old 06-07-2019, 06:18 PM   #16
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by random_id View Post
I think I got this.
Hope it works. I don't think it should affect/break anything else.
Yes! You got it. The trouble I was having with erratic presets loading was due to some nested/interactive parameters. I added some checks in the code to avoid conflicts and now all is well.

Awesome. Thank you!
Nonlinear is offline   Reply With Quote
Old 06-14-2019, 04:03 PM   #17
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Quote:
Originally Posted by random_id View Post
I think I got this.

I made two changes in IPlugVST3.cpp...
Thanks, other than "mPublicParams" not being defined, this fixed the problem for me.
earlevel is offline   Reply With Quote
Old 06-14-2019, 05:02 PM   #18
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 356
Default

Quote:
Originally Posted by earlevel View Post
Thanks, other than "mPublicParams" not being defined, this fixed the problem for me.
Sorry about that. I am not sure if I put this in for public/private params, or if it is there from Youlean. I use his branch of IPlug1 for the resizing.
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 06-29-2019, 10:42 AM   #19
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

There are still problems, in both the proposed changes and elsewhere.

For all ToNormalizedParam and FromNormalizedParam, the third parameter is "max", so "NPresets() - 1".

For all FromNormalizedParm that feed an integer parameter, there needs to be rounding (e.g., "+ 0.5"). RestorePreset and mCurrentPresetIdx.

"NPresets() - 1" also for parameters.addParameter(new Parameter...kPresetParam...).

I'm still chasing one related bug—I can't choose the last preset because the host (any) still things the highest preset is NPresets(). That is, I have 36 presets, 0-35. If I select the last preset, the host sends the parameter value 0.972222 (35/36—it thinks max is 36, apparently)...looks like that's only happening in Reaper, Cubase gets the full range...

Edit: It looks like the problem is that IPlugVST3::plainParamToNormalized is wrong. The function is given a tag, but uses it as an index so it always fails (I see, the same error as set/getParamNormalized). According to Schwa, Reaper should give a try at it. I'm not sure why it fails, but fixing the plainParamToNormalized...still not there...the last preset now works and the menu indicates the last, the first 18 of 36 presets likewise, but the others work but the menu displays the next one. IPlugVST3::plainParamToNormalized returns the correct value, so it's something else. Seems like repeat still thinks there is one more preset? It's asking for preset name 35 when I set 34...only Reaper that having an issue now.

Last edited by earlevel; 06-29-2019 at 06:33 PM.
earlevel is offline   Reply With Quote
Old 06-30-2019, 07:36 AM   #20
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by earlevel View Post
There are still problems, in both the proposed changes and elsewhere.

For all ToNormalizedParam and FromNormalizedParam, the third parameter is "max", so "NPresets() - 1".
I have found this problem shows up in Cakewalk by Bandlab with VST3 versions of my plugins. The last preset in the list does not load. It works in other DAWs and it works in CbB with the VST2 version - but not the VST3 version.

I looked all through iPlug code and didn't see anything to cause this and chalked it up as a Cakewalk bug - but maybe you have discovered it here. Will take another look.
Nonlinear is offline   Reply With Quote
Old 06-30-2019, 11:06 AM   #21
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Quote:
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
Old 07-03-2019, 06:35 PM   #22
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Figured it out. Wow, what a bundle of issues it turned out to be...

First, these routines in IPlugVST3.cpp that take a VST3 ParamID were broken, because ParamID is a tag, and the code was treating it as an index: setParamNormalized, getParamNormalized, plainParamToNormalized. Also, normalizedParamToPlain wasn't implemented.

Also, there seems to be a difference of opinion between Reaper and me as to how to map normalized 0-1 preset index. That's not a problem if plainParamToNormalized was working and normalizedParamToPlain was implemented. I used the VST3 definition of 0-1 maps to 0-35, so multiply to divide by 35, Reaper seemed to think 36. Maybe I'm the one that's wrong, but that seems to be how Steinberg defines it. In any case, as long as those two functions are implemented, there is no problem.

PS—https://forum.cockos.com/showthread.php?t=187289, wish I'd found that before, spent too much time thinking it had to be in the plugin code.

Last edited by earlevel; 07-04-2019 at 09:58 AM.
earlevel is offline   Reply With Quote
Old 07-04-2019, 10:06 AM   #23
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by earlevel View Post
Figured it out. Wow, what a bundle of issues it turned out to be...

First, these routines in IPlugVST3.cpp that take a VST3 ParamID were broken, because ParamID is a tag, and the code was treating it as an index: setParamNormalized, getParamNormalized, plainParamToNormalized. Also, normalizedParamToPlain wasn't implemented.
Thx for the detective work! Will look into this in my plugins. Is there anywhere you can post your fixes to iplugvst3.cpp?

Yes, it seems iPlug 1 development stopped with VST3 only partially and, in some cases, incorrectly supported. That’s surprising/frustrating since VST3 has been out for over a decade!

Oli doesn’t want to address anything now but iPlug2 so that is the best path forward...
Nonlinear is offline   Reply With Quote
Old 07-11-2019, 06:06 PM   #24
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Quote:
Originally Posted by Nonlinear View Post
Thx for the detective work! Will look into this in my plugins. Is there anywhere you can post your fixes to iplugvst3.cpp?
My branch here, IPlugVST3.ccp and .h:

https://github.com/earlevel/wdl-ol/t...evel/WDL/IPlug

I included a change from another person/thread, marked with the "#if 0" (left the ugliness so you could revert it if you want, but I haven't had any problems with it), because it fixed another issue I had with Studio One. The other changes make VST3 presets work right in Reaper.
earlevel is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.