COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 05-23-2014, 12:46 PM   #1
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default first use of "MakePreset" not working

So I kept trying to set the first preset to have a gain of 0 (using the gain knob IplugEffect example). However, it seems the preset is immediately overwritten by the default value of that parameter. Default was set to 1.

So my workaround was using:
PHP Code:
MakePreset("init"); 
to just have it make sense to my brains, and not put any values for that preset.

what is the correct way of handling this?
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 05-23-2014, 02:53 PM   #2
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 343
Default

If you are not using chunks, you can do something like this
Code:
MakeDefaultPreset("-", 1); 
MakePresetFromNamedParams("-3 dB", 1, kInGain, -3.00000);
MakePresetFromNamedParams("0 dB", 1, kInGain, 0.000000);
That will give you a default preset and two other ones.

The presets will not be loaded until the user selects them. If you want to make the default value of a control (i.e., the value it starts with when loading), you will want to set it when you initialize the parameter
Code:
GetParam(kInGain)->InitDouble("In Gain", 0.0, -60.0, 20.0, 0.1, "dB");
That would initialize the value to 0.0, regardless of any of the presets.
__________________
Website: LVC-Audio

Last edited by random_id; 05-23-2014 at 04:26 PM.
random_id is offline   Reply With Quote
Old 05-23-2014, 04:25 PM   #3
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default

nice, thanks!
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 07-03-2019, 04:11 PM   #4
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 307
Default

Old thread, but three things wrong for VST presets, related to the first preset not working, making you add default/init preset to make it seems like it's right:

1) The first preset is overwritten by default settings. Especially annoying since the preset's name isn't changed.

2) Presets are modifiable in memory. Parameter changes are remembered as you move to other presets and back, but forgotten when you reload the plugin.

3) The first preset isn't set at initialization, so the host displays the first preset name, but default settings.

Code:
1. IPlug_include_in_plugsrc.h

was:
  pPlug->EnsureDefaultPreset();
  pPlug->mAEffect.numPrograms = IPMAX(pPlug->mAEffect.numPrograms, 1);

change to:
  if (!pPlug->mAEffect.numPrograms) {
    pPlug->EnsureDefaultPreset();
    pPlug->mAEffect.numPrograms = 1;
  }

2. IPlugVST.cpp

was:
  if (_this->DoesStateChunks() == false)

change to:
  if (_this->DoesStateChunks())

3. IPlugVST.cpp

after this line:
  OnHostIdentified();

add this:
  RestorePreset(0);
earlevel is online now   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 02:46 PM.


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