iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
IParam Class Reference

IPlug's parameter class. More...

#include <IPlugParameter.h>

Classes

struct  Shape
 Base struct for parameter shaping. More...
 
struct  ShapeExp
 Exponential parameter shaping. More...
 
struct  ShapeLinear
 Linear parameter shaping. More...
 
struct  ShapePowCurve
 PowCurve parameter shaping. More...
 

Public Types

enum  EParamType {
  kTypeNone , kTypeBool , kTypeInt , kTypeEnum ,
  kTypeDouble
}
 Defines types or parameter. More...
 
enum  EParamUnit {
  kUnitPercentage , kUnitSeconds , kUnitMilliseconds , kUnitSamples ,
  kUnitDB , kUnitLinearGain , kUnitPan , kUnitPhase ,
  kUnitDegrees , kUnitMeters , kUnitRate , kUnitRatio ,
  kUnitFrequency , kUnitOctaves , kUnitCents , kUnitAbsCents ,
  kUnitSemitones , kUnitMIDINote , kUnitMIDICtrlNum , kUnitBPM ,
  kUnitBeats , kUnitCustom
}
 Used by AudioUnit plugins to determine the appearance of parameters, based on the kind of data they represent. More...
 
enum  EDisplayType {
  kDisplayLinear , kDisplayLog , kDisplayExp , kDisplaySquared ,
  kDisplaySquareRoot , kDisplayCubed , kDisplayCubeRoot
}
 Used by AudioUnit plugins to determine the mapping of parameters. More...
 
enum  EFlags {
  kFlagsNone = 0 , kFlagCannotAutomate = 0x1 , kFlagStepped = 0x2 , kFlagNegateDisplay = 0x4 ,
  kFlagSignDisplay = 0x8 , kFlagMeta = 0x10
}
 Flags to determine characteristics of the parameter. More...
 
using DisplayFunc = std::function< void(double, WDL_String &)>
 DisplayFunc allows custom parameter display functions, defined by a lambda matching this signature. More...
 

Public Member Functions

 IParam (const IParam &)=delete
 
IParamoperator= (const IParam &)=delete
 
void InitBool (const char *name, bool defaultValue, const char *label="", int flags=0, const char *group="", const char *offText="off", const char *onText="on")
 Initialize the parameter as boolean. More...
 
void InitEnum (const char *name, int defaultValue, int nEnums, const char *label="", int flags=0, const char *group="", const char *listItems=0,...)
 Initialize the parameter as an enumerated list. More...
 
void InitEnum (const char *name, int defaultValue, const std::initializer_list< const char * > &listItems, int flags=0, const char *group="")
 Initialize the parameter as enum. More...
 
void InitInt (const char *name, int defaultValue, int minVal, int maxVal, const char *label="", int flags=0, const char *group="")
 Initialize the parameter as integer. More...
 
void InitDouble (const char *name, double defaultVal, double minVal, double maxVal, double step, const char *label="", int flags=0, const char *group="", const Shape &shape=ShapeLinear(), EParamUnit unit=kUnitCustom, DisplayFunc displayFunc=nullptr)
 Initialize the parameter as double. More...
 
void InitSeconds (const char *name, double defaultVal=1., double minVal=0., double maxVal=10., double step=0.1, int flags=0, const char *group="")
 Initialize the parameter as seconds. More...
 
void InitMilliseconds (const char *name, double defaultVal=1., double minVal=0., double maxVal=100., int flags=0, const char *group="")
 Initialize the parameter as milliseconds. More...
 
void InitFrequency (const char *name, double defaultVal=1000., double minVal=0.1, double maxVal=10000., double step=0.1, int flags=0, const char *group="")
 Initialize the parameter as frequency. More...
 
void InitPitch (const char *name, int defaultVal=60, int minVal=0, int maxVal=128, int flags=0, const char *group="", bool middleCisC4=false)
 Initialize the parameter as pitch. More...
 
void InitGain (const char *name, double defaultVal=0., double minVal=-70., double maxVal=24., double step=0.5, int flags=0, const char *group="")
 Initialize the parameter as gain (units in decibels) More...
 
void InitPercentage (const char *name, double defaultVal=0., double minVal=0., double maxVal=100., int flags=0, const char *group="")
 Initialize the parameter as percentage. More...
 
void InitAngleDegrees (const char *name, double defaultVal=0., double minVal=0., double maxVal=360., int flags=0, const char *group="")
 Initialize the parameter as angle in degrees. More...
 
void Init (const IParam &p, const char *searchStr="", const char *replaceStr="", const char *newGroup="")
 Initialize the parameter based on another parameter, replacing a CString in the name. More...
 
double StringToValue (const char *str) const
 Convert a textual representation of the parameter value to a double (real value) More...
 
double Constrain (double value) const
 Constrains the input value between mMin and mMax and apply stepping if relevant. More...
 
double ConstrainNormalized (double normalizedValue) const
 Constrains a normalised input value similarly to Constrain() More...
 
double ToNormalized (double nonNormalizedValue) const
 Convert a real value to normalized value for this parameter. More...
 
double FromNormalized (double normalizedValue) const
 Convert a normalized value to real value for this parameter. More...
 
void Set (double value)
 Sets the parameter value. More...
 
void SetNormalized (double normalizedValue)
 Sets the parameter value from a normalized range (usually coming from the linked IControl) More...
 
void SetString (const char *str)
 Set the parameter value using a textual representation. More...
 
void SetToDefault ()
 Replaces the parameter's current value with the default one
More...
 
void SetDefault (double value)
 Set the parameter's default value, and set the parameter to that default. More...
 
void SetDisplayText (double value, const char *str)
 Set some text to display for a particular value, e.g. More...
 
void SetDisplayPrecision (int precision)
 Set the parameters display precision. More...
 
void SetLabel (const char *label)
 Set the parameters label after creation. More...
 
void SetDisplayFunc (DisplayFunc func)
 Set the function to translate display values. More...
 
double Value () const
 Gets a readable value of the parameter. More...
 
bool Bool () const
 Returns the parameter's value as a boolean. More...
 
int Int () const
 Returns the parameter's value as an integer. More...
 
double DBToAmp () const
 Gain based on parameter's current value in dB. More...
 
double GetNormalized () const
 Returns the parameter's normalized value. More...
 
void GetDisplay (WDL_String &display, bool withDisplayText=true) const
 Get the current textual display for the current parameter value. More...
 
void GetDisplay (double value, bool normalized, WDL_String &display, bool withDisplayText=true) const
 Get the current textual display for a specified parameter value. More...
 
void GetDisplayWithLabel (WDL_String &display, bool withDisplayText=true) const
 Fills the WDL_String the value of the parameter along with the label, e.g. More...
 
const char * GetName () const
 Returns the parameter's name. More...
 
const char * GetLabel () const
 Returns the parameter's label. More...
 
const char * GetGroup () const
 Returns the parameter's group. More...
 
const char * GetCustomUnit () const
 Get parameter's label (unit suffix) More...
 
int NDisplayTexts () const
 Get the number of display texts for the parameter. More...
 
const char * GetDisplayText (double value) const
 Get the display text for a particular value. More...
 
const char * GetDisplayTextAtIdx (int idx, double *pValue=nullptr) const
 Get the display text at a particular index. More...
 
bool MapDisplayText (const char *str, double *pValue) const
 Get the value of a particular display text. More...
 
EParamType Type () const
 Get the parameter's type. More...
 
EParamUnit Unit () const
 Get the parameter's unit. More...
 
EDisplayType DisplayType () const
 Get the parameter's display type. More...
 
double GetDefault (bool normalized=false) const
 Returns the parameter's default value. More...
 
double GetMin () const
 Returns the parameter's minimum value. More...
 
double GetMax () const
 Returns the parameter's maximum value. More...
 
void GetBounds (double &lo, double &hi) const
 Get the minimum and maximum real value of the parameter's range in one method call. More...
 
double GetRange () const
 Returns the parameter's range. More...
 
double GetStep () const
 Returns the parameter's step size. More...
 
int GetDisplayPrecision () const
 Returns the parameter's precision. More...
 
int GetFlags () const
 Returns the parameter's flags. More...
 
bool GetCanAutomate () const
 
bool GetStepped () const
 
bool GetNegateDisplay () const
 
bool GetSignDisplay () const
 
bool GetMeta () const
 
void GetJSON (WDL_String &json, int idx) const
 Get a JSON description of the parameter. More...
 
void PrintDetails () const
 Helper to print the parameter details to debug console in debug builds. More...
 

Detailed Description

IPlug's parameter class.

Definition at line 30 of file IPlugParameter.h.

Member Typedef Documentation

◆ DisplayFunc

using IParam::DisplayFunc = std::function<void(double, WDL_String&)>

DisplayFunc allows custom parameter display functions, defined by a lambda matching this signature.

Definition at line 61 of file IPlugParameter.h.

Member Enumeration Documentation

◆ EDisplayType

Used by AudioUnit plugins to determine the mapping of parameters.

Definition at line 41 of file IPlugParameter.h.

◆ EFlags

Flags to determine characteristics of the parameter.

Enumerator
kFlagsNone 

No flags.

kFlagCannotAutomate 

Indicates that the parameter is not automatable.

kFlagStepped 

Indicates that the parameter is stepped

kFlagNegateDisplay 

Indicates that the parameter should be displayed as a negative value.

kFlagSignDisplay 

Indicates that the parameter should be displayed as a signed value.

kFlagMeta 

Indicates that the parameter may influence the state of other parameters.

Definition at line 44 of file IPlugParameter.h.

◆ EParamType

Defines types or parameter.

Definition at line 35 of file IPlugParameter.h.

◆ EParamUnit

Used by AudioUnit plugins to determine the appearance of parameters, based on the kind of data they represent.

Definition at line 38 of file IPlugParameter.h.

Constructor & Destructor Documentation

◆ IParam()

IParam::IParam ( )

Definition at line 84 of file IPlugParameter.cpp.

Member Function Documentation

◆ Bool()

bool IParam::Bool ( ) const
inline

Returns the parameter's value as a boolean.

Returns
true if value >= 0.5, else otherwise

Definition at line 341 of file IPlugParameter.h.

Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), and IPluginBase::DumpMakePresetSrc().

◆ Constrain()

double IParam::Constrain ( double  value) const
inline

Constrains the input value between mMin and mMax and apply stepping if relevant.

Parameters
valueThe input value to constrain
Returns
double The resulting constrained value

Definition at line 270 of file IPlugParameter.h.

References Clip(), and kFlagStepped.

Referenced by FromNormalized(), Set(), StringToValue(), and ToNormalized().

◆ ConstrainNormalized()

double IParam::ConstrainNormalized ( double  normalizedValue) const
inline

Constrains a normalised input value similarly to Constrain()

Parameters
valueThe normalised input value to constrain
Returns
double The resulting constrained value

Definition at line 278 of file IPlugParameter.h.

References ToNormalized().

Referenced by IKnobControlBase::OnMouseDrag(), and ISliderControlBase::OnMouseDrag().

◆ DBToAmp()

double IParam::DBToAmp ( ) const
inline

Gain based on parameter's current value in dB.

Returns
double Gain calculated as an approximation of \( 10^{\frac{x}{20}} \)
See also
IAMP_DB

Definition at line 351 of file IPlugParameter.h.

◆ DisplayType()

EDisplayType IParam::DisplayType ( ) const
inline

Get the parameter's display type.

Note
This is only used for AU plugins to determine the mapping of parameters
Returns
EDisplayType

Definition at line 433 of file IPlugParameter.h.

◆ FromNormalized()

double IParam::FromNormalized ( double  normalizedValue) const
inline

Convert a normalized value to real value for this parameter.

Parameters
normalizedValueThe normalized input value in the range 0. to 1.
Returns
The corresponding real value, for this parameter

Definition at line 294 of file IPlugParameter.h.

References Constrain().

Referenced by GetDisplay(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), SetNormalized(), IVNumberBoxControl::SetValueFromDelegate(), and IVNumberBoxControl::SetValueFromUserInput().

◆ GetBounds()

void IParam::GetBounds ( double &  lo,
double &  hi 
) const

Get the minimum and maximum real value of the parameter's range in one method call.

Parameters
loThe minimum value will be put here
hiThe maximum value will be put here

Definition at line 380 of file IPlugParameter.cpp.

◆ GetCanAutomate()

bool IParam::GetCanAutomate ( ) const
inline
Returns
true If the parameter should be automateable

Definition at line 470 of file IPlugParameter.h.

References kFlagCannotAutomate.

◆ GetCustomUnit()

const char * IParam::GetCustomUnit ( ) const
inline

Get parameter's label (unit suffix)

Returns
CString Parameter's label (unit suffix) or nullptr if it is not set

Definition at line 397 of file IPlugParameter.h.

◆ GetDefault()

double IParam::GetDefault ( bool  normalized = false) const
inline

Returns the parameter's default value.

Parameters
normalizedShould the returned value be the default as a normalized or real value
Returns
double The parameter's default value

Definition at line 438 of file IPlugParameter.h.

References GetDefault(), and ToNormalized().

Referenced by GetDefault(), GetJSON(), IVNumberBoxControl::OnInit(), and IControl::SetValueToDefault().

◆ GetDisplay() [1/2]

void IParam::GetDisplay ( double  value,
bool  normalized,
WDL_String &  display,
bool  withDisplayText = true 
) const

Get the current textual display for a specified parameter value.

Parameters
valueThe value to get the display for
normalizedIs value normalized or real
displayWDL_String to fill with the results
withDisplayTextShould the output include display texts

Definition at line 262 of file IPlugParameter.cpp.

References FromNormalized(), GetDisplayText(), kFlagNegateDisplay, and kFlagSignDisplay.

◆ GetDisplay() [2/2]

void IParam::GetDisplay ( WDL_String &  display,
bool  withDisplayText = true 
) const
inline

Get the current textual display for the current parameter value.

Parameters
displayWDL_String to fill with the results
withDisplayTextShould the output include display texts

Definition at line 360 of file IPlugParameter.h.

References GetDisplay().

Referenced by ICaptionControl::Draw(), GetDisplay(), GetDisplayWithLabel(), IGraphics::PromptUserInput(), and IVSwitchControl::SetDirty().

◆ GetDisplayPrecision()

int IParam::GetDisplayPrecision ( ) const
inline

Returns the parameter's precision.

Returns
int The number of decimal places that should be used to display the parameter's real value

Definition at line 463 of file IPlugParameter.h.

◆ GetDisplayText()

const char * IParam::GetDisplayText ( double  value) const

Get the display text for a particular value.

Parameters
valueThe value to get the display text for
Returns
CString The display text

Definition at line 327 of file IPlugParameter.cpp.

Referenced by GetDisplay(), GetLabel(), and IGraphics::PromptUserInput().

◆ GetDisplayTextAtIdx()

const char * IParam::GetDisplayTextAtIdx ( int  idx,
double *  pValue = nullptr 
) const

Get the display text at a particular index.

Parameters
idxThe index of the display text
pValueThe value linked to the display text will be put here
Returns
CString The display text

Definition at line 337 of file IPlugParameter.cpp.

Referenced by Init().

◆ GetDisplayWithLabel()

void IParam::GetDisplayWithLabel ( WDL_String &  display,
bool  withDisplayText = true 
) const
inline

Fills the WDL_String the value of the parameter along with the label, e.g.

units

Parameters
displayWDL_String to fill with the results
withDisplayTextShould the output include display texts

Definition at line 372 of file IPlugParameter.h.

References GetDisplay(), and GetLabel().

Referenced by IVMenuButtonControl::IVMenuButtonControl(), IVSwitchControl::OnInit(), IVKnobControl::OnInit(), IVSliderControl::OnInit(), IVKnobControl::SetDirty(), IVSliderControl::SetDirty(), IVMenuButtonControl::SetValueFromDelegate(), IVMenuButtonControl::SetValueFromUserInput(), ShowBubbleHorizontalActionFunc(), and ShowBubbleVerticalActionFunc().

◆ GetFlags()

int IParam::GetFlags ( ) const
inline

Returns the parameter's flags.

Returns
int The parameter's flags as an integer

Definition at line 467 of file IPlugParameter.h.

◆ GetGroup()

const char * IParam::GetGroup ( ) const

Returns the parameter's group.

Returns
CString with the parameter's group

Definition at line 317 of file IPlugParameter.cpp.

Referenced by IPluginBase::CopyParamValues(), IPluginBase::ForParamInGroup(), and IVTrackControlBase::SetParamsByGroup().

◆ GetJSON()

void IParam::GetJSON ( WDL_String &  json,
int  idx 
) const

Get a JSON description of the parameter.

Parameters
jsonWDL_String to fill with the JSON
idxIndex of the parameter, to place in the JSON

Definition at line 386 of file IPlugParameter.cpp.

References GetDefault(), GetMax(), GetMin(), GetName(), and Type().

◆ GetLabel()

const char * IParam::GetLabel ( ) const

Returns the parameter's label.

Returns
CString with the parameter's label

Definition at line 312 of file IPlugParameter.cpp.

References GetDisplayText().

Referenced by ICaptionControl::Draw(), GetDisplayWithLabel(), and IGraphics::PromptUserInput().

◆ GetMax()

double IParam::GetMax ( ) const
inline

Returns the parameter's maximum value.

Returns
The maximum real value of the parameter's range

Definition at line 446 of file IPlugParameter.h.

Referenced by GetJSON(), IParam::ShapeExp::Init(), IParam::ShapePowCurve::NormalizedToValue(), IVNumberBoxControl::OnInit(), and IParam::ShapePowCurve::ValueToNormalized().

◆ GetMeta()

bool IParam::GetMeta ( ) const
inline
Returns
true If the parameter is flagged as a "meta" parameter, e.g. one that could modify other parameters

Definition at line 482 of file IPlugParameter.h.

References kFlagMeta.

◆ GetMin()

double IParam::GetMin ( ) const
inline

Returns the parameter's minimum value.

Returns
The minimum real value of the parameter's range

Definition at line 442 of file IPlugParameter.h.

Referenced by GetJSON(), IParam::ShapeExp::Init(), IParam::ShapePowCurve::NormalizedToValue(), IVNumberBoxControl::OnInit(), and IParam::ShapePowCurve::ValueToNormalized().

◆ GetName()

const char * IParam::GetName ( ) const

◆ GetNegateDisplay()

bool IParam::GetNegateDisplay ( ) const
inline
Returns
true If the parameter should be displayed as a negative value

Definition at line 476 of file IPlugParameter.h.

References kFlagNegateDisplay.

◆ GetNormalized()

double IParam::GetNormalized ( ) const
inline

Returns the parameter's normalized value.

Returns
double The resulting normalized value

Definition at line 355 of file IPlugParameter.h.

References ToNormalized().

◆ GetRange()

double IParam::GetRange ( ) const
inline

Returns the parameter's range.

Returns
double The difference between the parameter's maximum and minimum bounds

Definition at line 455 of file IPlugParameter.h.

Referenced by ISwitchControlBase::OnInit(), and IVTrackControlBase::SetParams().

◆ GetSignDisplay()

bool IParam::GetSignDisplay ( ) const
inline
Returns
true If the parameter should be displayed as a signed value

Definition at line 479 of file IPlugParameter.h.

References kFlagSignDisplay.

◆ GetStep()

double IParam::GetStep ( ) const
inline

Returns the parameter's step size.

Returns
The parameter's step size

Definition at line 459 of file IPlugParameter.h.

Referenced by IKnobControlBase::OnMouseDrag(), ISliderControlBase::OnMouseDrag(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), and IVTrackControlBase::SetParams().

◆ GetStepped()

bool IParam::GetStepped ( ) const
inline
Returns
true If the parameter should be discrete (stepped)

Definition at line 473 of file IPlugParameter.h.

References kFlagStepped.

Referenced by IKnobControlBase::OnMouseDrag(), ISliderControlBase::OnMouseDrag(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), and IVTrackControlBase::SetParams().

◆ Init()

void IParam::Init ( const IParam p,
const char *  searchStr = "",
const char *  replaceStr = "",
const char *  newGroup = "" 
)

Initialize the parameter based on another parameter, replacing a CString in the name.

Parameters
pThe existing parameter
searchStrSearch string for modifying the parameter name
replaceStrReplace string for modifying the parameter name
newGroupGroup for the new parameter

Definition at line 214 of file IPlugParameter.cpp.

References GetDisplayTextAtIdx(), InitDouble(), NDisplayTexts(), SetDisplayText(), and Type().

◆ InitAngleDegrees()

void IParam::InitAngleDegrees ( const char *  name,
double  defaultVal = 0.,
double  minVal = 0.,
double  maxVal = 360.,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as angle in degrees.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 209 of file IPlugParameter.cpp.

References InitDouble().

◆ InitBool()

void IParam::InitBool ( const char *  name,
bool  defaultValue,
const char *  label = "",
int  flags = 0,
const char *  group = "",
const char *  offText = "off",
const char *  onText = "on" 
)

Initialize the parameter as boolean.

Parameters
nameThe parameter's name
defaultValueThe default value of the parameter
labelThe parameter's unit suffix. Has no effect for this type of parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group
offTextThe display text when the parameter value == 0.
onTextThe display text when the parameter value == 1.

Definition at line 92 of file IPlugParameter.cpp.

References InitEnum(), kFlagStepped, and SetDisplayText().

◆ InitDouble()

void IParam::InitDouble ( const char *  name,
double  defaultVal,
double  minVal,
double  maxVal,
double  step,
const char *  label = "",
int  flags = 0,
const char *  group = "",
const Shape shape = ShapeLinear(),
EParamUnit  unit = kUnitCustom,
DisplayFunc  displayFunc = nullptr 
)

Initialize the parameter as double.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
stepThe step size of the parameter
labelThe parameter's unit suffix (eg. dB, %)
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group
shapeA Parameter::Shape struct that determines the skewing of the parameters values across its range
unitUsed by AudioUnit plugins to determine the appearance of parameters, based on the kind of data they represent
displayFuncCustom display function, conforming to DisplayFunc

Definition at line 140 of file IPlugParameter.cpp.

References IParam::Shape::Clone(), and Set().

Referenced by Init(), InitAngleDegrees(), InitFrequency(), InitGain(), InitInt(), InitMilliseconds(), InitPercentage(), and InitSeconds().

◆ InitEnum() [1/2]

void IParam::InitEnum ( const char *  name,
int  defaultValue,
const std::initializer_list< const char * > &  listItems,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as enum.

Parameters
nameThe parameter's name
defaultValueThe default value of the parameter
listItemsAn initializer list of CStrings for the list items
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 120 of file IPlugParameter.cpp.

References InitInt(), kFlagStepped, and SetDisplayText().

◆ InitEnum() [2/2]

void IParam::InitEnum ( const char *  name,
int  defaultValue,
int  nEnums,
const char *  label = "",
int  flags = 0,
const char *  group = "",
const char *  listItems = 0,
  ... 
)

Initialize the parameter as an enumerated list.

Parameters
nameThe parameter's name
defaultValueThe default value of the parameter
nEnumsThe number of elements in the enumerated list
labelThe parameter's unit suffix. Has no effect for this type of parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group
listItemsVARARG list of enum items, the length of which must match nEnums

Definition at line 102 of file IPlugParameter.cpp.

References InitInt(), kFlagStepped, and SetDisplayText().

Referenced by InitBool(), and InitPitch().

◆ InitFrequency()

void IParam::InitFrequency ( const char *  name,
double  defaultVal = 1000.,
double  minVal = 0.1,
double  maxVal = 10000.,
double  step = 0.1,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as frequency.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
stepThe step size of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 173 of file IPlugParameter.cpp.

References InitDouble().

◆ InitGain()

void IParam::InitGain ( const char *  name,
double  defaultVal = 0.,
double  minVal = -70.,
double  maxVal = 24.,
double  step = 0.5,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as gain (units in decibels)

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
stepThe step size of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 199 of file IPlugParameter.cpp.

References InitDouble().

◆ InitInt()

void IParam::InitInt ( const char *  name,
int  defaultValue,
int  minVal,
int  maxVal,
const char *  label = "",
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as integer.

Parameters
nameThe parameter's name
defaultValueThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
labelThe parameter's unit suffix (eg. dB, %)
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 133 of file IPlugParameter.cpp.

References InitDouble(), and kFlagStepped.

Referenced by InitEnum().

◆ InitMilliseconds()

void IParam::InitMilliseconds ( const char *  name,
double  defaultVal = 1.,
double  minVal = 0.,
double  maxVal = 100.,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as milliseconds.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
stepThe step size of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 183 of file IPlugParameter.cpp.

References InitDouble().

◆ InitPercentage()

void IParam::InitPercentage ( const char *  name,
double  defaultVal = 0.,
double  minVal = 0.,
double  maxVal = 100.,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as percentage.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 204 of file IPlugParameter.cpp.

References InitDouble().

◆ InitPitch()

void IParam::InitPitch ( const char *  name,
int  defaultVal = 60,
int  minVal = 0,
int  maxVal = 128,
int  flags = 0,
const char *  group = "",
bool  middleCisC4 = false 
)

Initialize the parameter as pitch.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 188 of file IPlugParameter.cpp.

References InitEnum(), MidiNoteName(), and SetDisplayText().

◆ InitSeconds()

void IParam::InitSeconds ( const char *  name,
double  defaultVal = 1.,
double  minVal = 0.,
double  maxVal = 10.,
double  step = 0.1,
int  flags = 0,
const char *  group = "" 
)

Initialize the parameter as seconds.

Parameters
nameThe parameter's name
defaultValThe default value of the parameter
minValThe minimum value of the parameter
maxValThe maximum value of the parameter
stepThe step size of the parameter
flagsThe parameter's flags
See also
IParam::EFlags
Parameters
groupThe parameter's group

Definition at line 178 of file IPlugParameter.cpp.

References InitDouble().

◆ Int()

int IParam::Int ( ) const
inline

Returns the parameter's value as an integer.

Returns
Current value of the parameter as an integer

Definition at line 345 of file IPlugParameter.h.

Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), and IPluginBase::DumpMakePresetSrc().

◆ MapDisplayText()

bool IParam::MapDisplayText ( const char *  str,
double *  pValue 
) const

Get the value of a particular display text.

Parameters
strThe display text to look up
pValueThe value linked to the display text will be put here
Returns
true if str matched a display text

Definition at line 344 of file IPlugParameter.cpp.

Referenced by StringToValue().

◆ NDisplayTexts()

int IParam::NDisplayTexts ( ) const

Get the number of display texts for the parameter.

Returns
The number of display texts for the parameter

Definition at line 322 of file IPlugParameter.cpp.

Referenced by Init(), IGraphics::PromptUserInput(), and StringToValue().

◆ PrintDetails()

void IParam::PrintDetails ( ) const

Helper to print the parameter details to debug console in debug builds.

Definition at line 418 of file IPlugParameter.cpp.

References GetName(), and Value().

Referenced by IPluginBase::PrintParamValues().

◆ Set()

void IParam::Set ( double  value)
inline

Sets the parameter value.

Parameters
valueValue to be set. Will be stepped and clamped between mMin and mMax

Definition at line 301 of file IPlugParameter.h.

References Constrain().

Referenced by InitDouble(), SetNormalized(), and IPluginBase::UnserializeParams().

◆ SetDefault()

void IParam::SetDefault ( double  value)
inline

Set the parameter's default value, and set the parameter to that default.

Parameters
valueThe new default value

Definition at line 316 of file IPlugParameter.h.

References SetToDefault().

◆ SetDisplayFunc()

void IParam::SetDisplayFunc ( DisplayFunc  func)
inline

Set the function to translate display values.

Parameters
funcA function conforming to DisplayFunc

Definition at line 333 of file IPlugParameter.h.

◆ SetDisplayPrecision()

void IParam::SetDisplayPrecision ( int  precision)

Set the parameters display precision.

Parameters
precisionThe display precision in digits

Definition at line 257 of file IPlugParameter.cpp.

◆ SetDisplayText()

void IParam::SetDisplayText ( double  value,
const char *  str 
)

Set some text to display for a particular value, e.g.

-70dB could display "-inf"

Parameters
valueThe value for which to display the text
strCString text to display at value

Definition at line 248 of file IPlugParameter.cpp.

Referenced by Init(), InitBool(), InitEnum(), and InitPitch().

◆ SetLabel()

void IParam::SetLabel ( const char *  label)
inline

Set the parameters label after creation.

WARNING: if this is called after the host has queried plugin parameters, the host may display the label as it was previously

Parameters
labelCString for the label

Definition at line 329 of file IPlugParameter.h.

◆ SetNormalized()

void IParam::SetNormalized ( double  normalizedValue)
inline

Sets the parameter value from a normalized range (usually coming from the linked IControl)

Parameters
normalizedValueThe expected normalized value between 0. and 1.

Definition at line 305 of file IPlugParameter.h.

References FromNormalized(), and Set().

Referenced by IPluginBase::RandomiseParamValues(), and IEditorDelegate::SendParameterValueFromUI().

◆ SetString()

void IParam::SetString ( const char *  str)
inline

Set the parameter value using a textual representation.

Parameters
strThe textual representations as a CString

Definition at line 309 of file IPlugParameter.h.

References StringToValue().

◆ SetToDefault()

void IParam::SetToDefault ( )
inline

Replaces the parameter's current value with the default one

Definition at line 312 of file IPlugParameter.h.

Referenced by IPluginBase::DefaultParamValues(), and SetDefault().

◆ StringToValue()

double IParam::StringToValue ( const char *  str) const

Convert a textual representation of the parameter value to a double (real value)

Parameters
strCString textual representation of the parameter value
Returns
double The real value

Definition at line 358 of file IPlugParameter.cpp.

References Constrain(), kFlagNegateDisplay, MapDisplayText(), NDisplayTexts(), and Type().

Referenced by IGraphics::SetControlValueAfterTextEdit(), and SetString().

◆ ToNormalized()

double IParam::ToNormalized ( double  nonNormalizedValue) const
inline

Convert a real value to normalized value for this parameter.

Parameters
nonNormalizedValueThe real input value
Returns
The corresponding normalized value, for this parameter

Definition at line 286 of file IPlugParameter.h.

References Clip(), and Constrain().

Referenced by ConstrainNormalized(), GetDefault(), GetNormalized(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), IGEditorDelegate::SendParameterValueFromDelegate(), and IGraphics::SetControlValueAfterTextEdit().

◆ Type()

EParamType IParam::Type ( ) const
inline

Get the parameter's type.

Returns
EParamType Type of the parameter, kTypeNone if not initialized
See also
EParamType

Definition at line 423 of file IPlugParameter.h.

Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), IPluginBase::DumpMakePresetSrc(), GetJSON(), Init(), ITextEntryControl::OnKeyDown(), ICaptionControl::OnResize(), IGraphics::PromptUserInput(), and StringToValue().

◆ Unit()

EParamUnit IParam::Unit ( ) const
inline

Get the parameter's unit.

Note
This is only used for AU plugins to determine the appearance of parameters, based on the kind of data they represent
Returns
EParamUnit

Definition at line 428 of file IPlugParameter.h.

◆ Value()

double IParam::Value ( ) const
inline

Gets a readable value of the parameter.

Returns
double Current value of the parameter

Definition at line 337 of file IPlugParameter.h.

Referenced by IPluginBase::CloneParamRange(), IPluginBase::DumpMakePresetFromNamedParamsSrc(), IPluginBase::DumpMakePresetSrc(), PrintDetails(), IPluginBase::SerializeParams(), and IPluginBase::UnserializeParams().


The documentation for this class was generated from the following files: