| Parameters in a VST plugin |
There are two functions you have to override if your
effect has any parameters. These are getParameter and setParameter. When you
don't have an editor (which is the case we're discussing here), you also need
to override getParameterLabel, getParameterName and getParameterDisplay.
procedure setParameter(index: Longint; value: Single); override;
SetParameter gets called by the host when the user has changed the value of
a parameter. This allows your effect to update its state. Index indicates which
parameter has been changed. Value holds the new value. This new value lies between
0.0 and 1.0. Your effect has to convert this to whatever format it uses internally.
function getParameter(index: Longint): Single; override;
GetParameter gets called when the host wants to know the value of a specific
parameter. Index indicates which parameter to return the value for. The result
has to be a value between 0.0 and 1.0. Your effect has to convert whatever format
is used internally to a floating point value in this range.
procedure getParameterLabel(index: Longint; aLabel: PChar); override;
The host calls GetParameterLabel when it needs a string to tell the user something
more about the value of a parameter. Mostly, this is used for the unit of a
parameter. For example, for a parameter called Delay which is expressed in milliseconds,
you might return ' ms '. Note that the string to
return shouldn't be longer than eight characters (although I believe it's possible).
procedure getParameterDisplay(index: Longint; text: PChar); override;
The host calls GetParameterDisplay to get a string representation for the current
value of a parameter. You can use some functions in the VSTUtils unit (DVSTUtils
in sdk version 2.0.x). See uExampleEffect.pas for
more information.
procedure getParameterName(index: Longint; text: PChar); override;
Return the name of the parameter in text.