iPlug2 - C++ Audio Plug-in Framework
|
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... | |
enum | EShapeIDs { kShapeLinear = 0 , kShapePowCurve = 1 , kShapeExponential = 2 , kShapeUnknown } |
IDs for the shapes. 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 | |
IParam & | operator= (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 |
EShapeIDs | GetShapeID () const |
double | GetShapeValue () 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... | |
IPlug's parameter class.
Definition at line 30 of file IPlugParameter.h.
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 70 of file IPlugParameter.h.
enum IParam::EDisplayType |
Used by AudioUnit plugins to determine the mapping of parameters.
Definition at line 41 of file IPlugParameter.h.
enum IParam::EFlags |
Flags to determine characteristics of the parameter.
Definition at line 44 of file IPlugParameter.h.
enum IParam::EParamType |
Defines types or parameter.
Definition at line 35 of file IPlugParameter.h.
enum IParam::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.
enum IParam::EShapeIDs |
IDs for the shapes.
Definition at line 61 of file IPlugParameter.h.
IParam::IParam | ( | ) |
Definition at line 84 of file IPlugParameter.cpp.
|
inline |
Returns the parameter's value as a boolean.
true
if value >= 0.5, else otherwise Definition at line 350 of file IPlugParameter.h.
Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), and IPluginBase::DumpMakePresetSrc().
|
inline |
Constrains the input value between mMin
and mMax
and apply stepping if relevant.
value | The input value to constrain |
Definition at line 279 of file IPlugParameter.h.
References Clip(), and kFlagStepped.
Referenced by FromNormalized(), Set(), StringToValue(), and ToNormalized().
|
inline |
Constrains a normalised input value similarly to Constrain()
value | The normalised input value to constrain |
Definition at line 287 of file IPlugParameter.h.
References ToNormalized().
Referenced by IKnobControlBase::OnMouseDrag(), and ISliderControlBase::OnMouseDrag().
|
inline |
Gain based on parameter's current value in dB.
Definition at line 360 of file IPlugParameter.h.
|
inline |
Get the parameter's display type.
Definition at line 442 of file IPlugParameter.h.
|
inline |
Convert a normalized value to real value for this parameter.
normalizedValue | The normalized input value in the range 0. to 1. |
Definition at line 303 of file IPlugParameter.h.
References Constrain().
Referenced by GetDisplay(), IPlugCLAP::InformHostOfParamChange(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), SetNormalized(), IVNumberBoxControl::SetValueFromDelegate(), and IVNumberBoxControl::SetValueFromUserInput().
void IParam::GetBounds | ( | double & | lo, |
double & | hi | ||
) | const |
Get the minimum and maximum real value of the parameter's range in one method call.
lo | The minimum value will be put here |
hi | The maximum value will be put here |
Definition at line 380 of file IPlugParameter.cpp.
|
inline |
true
If the parameter should be automateable Definition at line 479 of file IPlugParameter.h.
References kFlagCannotAutomate.
|
inline |
Get parameter's label (unit suffix)
nullptr
if it is not set Definition at line 406 of file IPlugParameter.h.
|
inline |
Returns the parameter's default value.
normalized | Should the returned value be the default as a normalized or real value |
Definition at line 447 of file IPlugParameter.h.
References GetDefault(), and ToNormalized().
Referenced by GetDefault(), GetJSON(), IVNumberBoxControl::OnInit(), and IControl::SetValueToDefault().
void IParam::GetDisplay | ( | double | value, |
bool | normalized, | ||
WDL_String & | display, | ||
bool | withDisplayText = true |
||
) | const |
Get the current textual display for a specified parameter value.
value | The value to get the display for |
normalized | Is value normalized or real |
display | WDL_String to fill with the results |
withDisplayText | Should the output include display texts |
Definition at line 262 of file IPlugParameter.cpp.
References FromNormalized(), GetDisplayText(), kFlagNegateDisplay, and kFlagSignDisplay.
|
inline |
Get the current textual display for the current parameter value.
display | WDL_String to fill with the results |
withDisplayText | Should the output include display texts |
Definition at line 369 of file IPlugParameter.h.
References GetDisplay().
Referenced by ICaptionControl::Draw(), GetDisplay(), GetDisplayWithLabel(), IGraphics::PromptUserInput(), and IVSwitchControl::SetDirty().
|
inline |
Returns the parameter's precision.
Definition at line 472 of file IPlugParameter.h.
const char * IParam::GetDisplayText | ( | double | value | ) | const |
Get the display text for a particular value.
value | The value to get the display text for |
Definition at line 327 of file IPlugParameter.cpp.
Referenced by GetDisplay(), GetLabel(), and IGraphics::PromptUserInput().
const char * IParam::GetDisplayTextAtIdx | ( | int | idx, |
double * | pValue = nullptr |
||
) | const |
Get the display text at a particular index.
idx | The index of the display text |
pValue | The value linked to the display text will be put here |
Definition at line 337 of file IPlugParameter.cpp.
Referenced by Init().
|
inline |
Fills the WDL_String
the value of the parameter along with the label, e.g.
units
display | WDL_String to fill with the results |
withDisplayText | Should the output include display texts |
Definition at line 381 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().
|
inline |
Returns the parameter's flags.
Definition at line 476 of file IPlugParameter.h.
const char * IParam::GetGroup | ( | ) | const |
Returns the parameter's group.
Definition at line 317 of file IPlugParameter.cpp.
Referenced by IPluginBase::CopyParamValues(), IPluginBase::ForParamInGroup(), and IVTrackControlBase::SetParamsByGroup().
void IParam::GetJSON | ( | WDL_String & | json, |
int | idx | ||
) | const |
Get a JSON description of the parameter.
json | WDL_String to fill with the JSON |
idx | Index of the parameter, to place in the JSON |
Definition at line 386 of file IPlugParameter.cpp.
References GetDefault(), GetMax(), GetMin(), GetName(), and Type().
Referenced by WebViewEditorDelegate::OnWebContentLoaded().
const char * IParam::GetLabel | ( | ) | const |
Returns the parameter's label.
Definition at line 312 of file IPlugParameter.cpp.
References GetDisplayText().
Referenced by ICaptionControl::Draw(), GetDisplayWithLabel(), and IGraphics::PromptUserInput().
|
inline |
Returns the parameter's maximum value.
Definition at line 455 of file IPlugParameter.h.
Referenced by GetJSON(), IParam::ShapeExp::Init(), IParam::ShapePowCurve::NormalizedToValue(), IVNumberBoxControl::OnInit(), and IParam::ShapePowCurve::ValueToNormalized().
|
inline |
true
If the parameter is flagged as a "meta" parameter, e.g. one that could modify other parameters Definition at line 491 of file IPlugParameter.h.
References kFlagMeta.
|
inline |
Returns the parameter's minimum value.
Definition at line 451 of file IPlugParameter.h.
Referenced by GetJSON(), IParam::ShapeExp::Init(), IParam::ShapePowCurve::NormalizedToValue(), IVNumberBoxControl::OnInit(), and IParam::ShapePowCurve::ValueToNormalized().
const char * IParam::GetName | ( | ) | const |
Returns the parameter's name.
Definition at line 307 of file IPlugParameter.cpp.
Referenced by GetJSON(), IVSwitchControl::OnInit(), IVTabSwitchControl::OnInit(), IVKnobControl::OnInit(), IVSliderControl::OnInit(), PrintDetails(), IGraphics::PromptUserInput(), IPluginBase::SerializeParams(), and IPluginBase::UnserializeParams().
|
inline |
true
If the parameter should be displayed as a negative value Definition at line 485 of file IPlugParameter.h.
References kFlagNegateDisplay.
|
inline |
Returns the parameter's normalized value.
Definition at line 364 of file IPlugParameter.h.
References ToNormalized().
Referenced by CocoaEditorDelegate::OnParamChangeUI().
|
inline |
Returns the parameter's range.
Definition at line 464 of file IPlugParameter.h.
Referenced by ISwitchControlBase::OnInit(), and IVTrackControlBase::SetParams().
IParam::EShapeIDs IParam::GetShapeID | ( | ) | const |
Definition at line 423 of file IPlugParameter.cpp.
double IParam::GetShapeValue | ( | ) | const |
Definition at line 435 of file IPlugParameter.cpp.
|
inline |
true
If the parameter should be displayed as a signed value Definition at line 488 of file IPlugParameter.h.
References kFlagSignDisplay.
|
inline |
Returns the parameter's step size.
Definition at line 468 of file IPlugParameter.h.
Referenced by IKnobControlBase::OnMouseDrag(), ISliderControlBase::OnMouseDrag(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), and IVTrackControlBase::SetParams().
|
inline |
true
If the parameter should be discrete (stepped) Definition at line 482 of file IPlugParameter.h.
References kFlagStepped.
Referenced by IKnobControlBase::OnMouseDrag(), ISliderControlBase::OnMouseDrag(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), and IVTrackControlBase::SetParams().
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.
p | The existing parameter |
searchStr | Search string for modifying the parameter name |
replaceStr | Replace string for modifying the parameter name |
newGroup | Group for the new parameter |
Definition at line 214 of file IPlugParameter.cpp.
References GetDisplayTextAtIdx(), InitDouble(), NDisplayTexts(), SetDisplayText(), and Type().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 209 of file IPlugParameter.cpp.
References InitDouble().
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.
name | The parameter's name |
defaultValue | The default value of the parameter |
label | The parameter's unit suffix. Has no effect for this type of parameter |
flags | The parameter's flags |
group | The parameter's group |
offText | The display text when the parameter value == 0. |
onText | The display text when the parameter value == 1. |
Definition at line 92 of file IPlugParameter.cpp.
References InitEnum(), kFlagStepped, and SetDisplayText().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
step | The step size of the parameter |
label | The parameter's unit suffix (eg. dB, %) |
flags | The parameter's flags |
group | The parameter's group |
shape | A Parameter::Shape struct that determines the skewing of the parameters values across its range |
unit | Used by AudioUnit plugins to determine the appearance of parameters, based on the kind of data they represent |
displayFunc | Custom 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().
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.
name | The parameter's name |
defaultValue | The default value of the parameter |
listItems | An initializer list of CStrings for the list items |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 120 of file IPlugParameter.cpp.
References InitInt(), kFlagStepped, and SetDisplayText().
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.
name | The parameter's name |
defaultValue | The default value of the parameter |
nEnums | The number of elements in the enumerated list |
label | The parameter's unit suffix. Has no effect for this type of parameter |
flags | The parameter's flags |
group | The parameter's group |
listItems | VARARG 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().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
step | The step size of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 173 of file IPlugParameter.cpp.
References InitDouble().
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)
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
step | The step size of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 199 of file IPlugParameter.cpp.
References InitDouble().
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.
name | The parameter's name |
defaultValue | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
label | The parameter's unit suffix (eg. dB, %) |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 133 of file IPlugParameter.cpp.
References InitDouble(), and kFlagStepped.
Referenced by InitEnum().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
step | The step size of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 183 of file IPlugParameter.cpp.
References InitDouble().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 204 of file IPlugParameter.cpp.
References InitDouble().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 188 of file IPlugParameter.cpp.
References InitEnum(), MidiNoteName(), and SetDisplayText().
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.
name | The parameter's name |
defaultVal | The default value of the parameter |
minVal | The minimum value of the parameter |
maxVal | The maximum value of the parameter |
step | The step size of the parameter |
flags | The parameter's flags |
group | The parameter's group |
Definition at line 178 of file IPlugParameter.cpp.
References InitDouble().
|
inline |
Returns the parameter's value as an integer.
Definition at line 354 of file IPlugParameter.h.
Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), and IPluginBase::DumpMakePresetSrc().
bool IParam::MapDisplayText | ( | const char * | str, |
double * | pValue | ||
) | const |
Get the value of a particular display text.
str | The display text to look up |
pValue | The value linked to the display text will be put here |
true
if str matched a display text Definition at line 344 of file IPlugParameter.cpp.
Referenced by StringToValue().
int IParam::NDisplayTexts | ( | ) | const |
Get the number of display texts for the parameter.
Definition at line 322 of file IPlugParameter.cpp.
Referenced by Init(), IGraphics::PromptUserInput(), and StringToValue().
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().
|
inline |
Sets the parameter value.
value | Value to be set. Will be stepped and clamped between mMin and mMax |
Definition at line 310 of file IPlugParameter.h.
References Constrain().
Referenced by InitDouble(), SetNormalized(), and IPluginBase::UnserializeParams().
|
inline |
Set the parameter's default value, and set the parameter to that default.
value | The new default value |
Definition at line 325 of file IPlugParameter.h.
References SetToDefault().
|
inline |
Set the function to translate display values.
func | A function conforming to DisplayFunc |
Definition at line 342 of file IPlugParameter.h.
void IParam::SetDisplayPrecision | ( | int | precision | ) |
Set the parameters display precision.
precision | The display precision in digits |
Definition at line 257 of file IPlugParameter.cpp.
void IParam::SetDisplayText | ( | double | value, |
const char * | str | ||
) |
Set some text to display for a particular value, e.g.
-70dB could display "-inf"
value | The value for which to display the text |
str | CString text to display at value |
Definition at line 248 of file IPlugParameter.cpp.
Referenced by Init(), InitBool(), InitEnum(), and InitPitch().
|
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
label | CString for the label |
Definition at line 338 of file IPlugParameter.h.
|
inline |
Sets the parameter value from a normalized range (usually coming from the linked IControl)
normalizedValue | The expected normalized value between 0. and 1. |
Definition at line 314 of file IPlugParameter.h.
References FromNormalized(), and Set().
Referenced by IPluginBase::RandomiseParamValues(), and IEditorDelegate::SendParameterValueFromUI().
|
inline |
Set the parameter value using a textual representation.
str | The textual representations as a CString |
Definition at line 318 of file IPlugParameter.h.
References StringToValue().
|
inline |
Replaces the parameter's current value with the default one
Definition at line 321 of file IPlugParameter.h.
Referenced by IPluginBase::DefaultParamValues(), and SetDefault().
double IParam::StringToValue | ( | const char * | str | ) | const |
Convert a textual representation of the parameter value to a double (real value)
str | CString textual representation of the parameter value |
Definition at line 358 of file IPlugParameter.cpp.
References Constrain(), kFlagNegateDisplay, MapDisplayText(), NDisplayTexts(), and Type().
Referenced by IGraphics::SetControlValueAfterTextEdit(), and SetString().
|
inline |
Convert a real value to normalized value for this parameter.
nonNormalizedValue | The real input value |
Definition at line 295 of file IPlugParameter.h.
References Clip(), and Constrain().
Referenced by ConstrainNormalized(), GetDefault(), GetNormalized(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), IGEditorDelegate::SendParameterValueFromDelegate(), WebViewEditorDelegate::SendParameterValueFromDelegate(), and IGraphics::SetControlValueAfterTextEdit().
|
inline |
Get the parameter's type.
Definition at line 432 of file IPlugParameter.h.
Referenced by IPluginBase::DumpMakePresetFromNamedParamsSrc(), IPluginBase::DumpMakePresetSrc(), GetJSON(), IPlugCLAP::InformHostOfParamChange(), Init(), ITextEntryControl::OnKeyDown(), ICaptionControl::OnResize(), IGraphics::PromptUserInput(), and StringToValue().
|
inline |
Get the parameter's unit.
Definition at line 437 of file IPlugParameter.h.
|
inline |
Gets a readable value of the parameter.
Definition at line 346 of file IPlugParameter.h.
Referenced by IPluginBase::CloneParamRange(), IPluginBase::DumpMakePresetFromNamedParamsSrc(), IPluginBase::DumpMakePresetSrc(), PrintDetails(), IPluginBase::SerializeParams(), and IPluginBase::UnserializeParams().