Gin
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Parameter Class Reference

A parameter with user values, real time safe callbacks, modulation, and all sorts of other fancy stuff. More...

Inherits juce::AudioPluginInstance::HostedParameter, juce::AsyncUpdater, and juce::Timer.

Classes

class  ParameterListener
 
struct  ParamState
 

Public Types

using Ptr = Parameter *
 

Public Member Functions

 Parameter (Processor &, juce::String uid, juce::String name, juce::String shortName, juce::String label, float minValue, float maxValue, float intervalValue, float defaultValue, float skewFactor=1.0f, std::function< juce::String(const Parameter &, float)> textFunction=nullptr)
 
 Parameter (Processor &, juce::String uid, juce::String name, juce::String shortName, juce::String label, juce::NormalisableRange< float > range, float defaultValue, std::function< juce::String(const Parameter &, float)> textFunction=nullptr)
 
juce::String getUid () const
 
void setInternal (bool i)
 
bool isInternal () const
 
void setModIndex (int i)
 
int getModIndex () const
 
void setModMatrix (ModMatrix *m)
 
ModMatrixgetModMatrix () const
 
virtual void prepareToPlay (double, int)
 
virtual void reset ()
 
float getProcValue ()
 
virtual float getProcValue (int)
 
float getUserValue () const
 
int getUserValueInt () const
 
bool getUserValueBool () const
 
float getUserDefaultValue () const
 
virtual void setUserValue (float v)
 
virtual void setUserValueNotifingHost (float f)
 
void setUserValueAsUserAction (float f)
 
juce::String getUserValueText () const
 
juce::String userValueToText (float val)
 
bool isOnOff ()
 
bool isOn ()
 
virtual bool isSmoothingActive ()
 
void beginUserAction ()
 
void beginUserTimedAction ()
 
void endUserAction ()
 
juce::NormalisableRange< float > getUserRange () const
 
float getUserRangeStart () const
 
float getUserRangeEnd () const
 
void addListener (ParameterListener *listener)
 
void removeListener (ParameterListener *listener)
 
ParamState getState ()
 
void setState (const ParamState &state)
 
juce::String getParameterID () const override
 
float getValue () const override
 
bool getBoolValue () const
 
void setValue (float newValue) override
 
float getDefaultValue () const override
 
juce::String getName (int maximumStringLength) const override
 
juce::String getShortName () const
 
juce::String getLabel () const override
 
int getNumSteps () const override
 
juce::String getText (float value, int) const override
 
float getValueForText (const juce::String &text) const override
 
bool isOrientationInverted () const override
 
bool isAutomatable () const override
 
bool isMetaParameter () const override
 
float getSkew ()
 
bool isSkewSymmetric ()
 

Public Attributes

std::function< float(float)> conversionFunction
 

Protected Member Functions

void handleAsyncUpdate () override
 
void timerCallback () override
 
virtual void changed ()
 

Protected Attributes

Processorprocessor
 
juce::NormalisableRange< float > range
 
bool internal = false
 
ModMatrixmodMatrix = nullptr
 
int modIndex = -1
 
float value = 0.0f
 
float defaultValue = 0.0f
 
juce::String uid
 
juce::String name
 
juce::String shortName
 
juce::String label
 
std::function< juce::String(const Parameter &, float)> textFunction
 
int userActionCount = 0
 
juce::ListenerList< ParameterListenerlisteners
 

Detailed Description

A parameter with user values, real time safe callbacks, modulation, and all sorts of other fancy stuff.

A paramter return it's value in 3 formats: value: always 0..1 user value: range as displayed to user proc value: range used for processing

For example, a gain parameter may have a user range of -100 to +10 dB. The coresponding proc range would be 0 to 3.1623. By default user value and proc value are the same. To provide an alternate proc value, set conversionFunction

Parameters can be either internal or external. External parameters are exposed to the host and can be modulated. Internal parameters are for things that should not be modulated.

Parameters can optionally be added to a modmatrix

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ Parameter() [1/2]

Parameter::Parameter ( Processor ,
juce::String  uid,
juce::String  name,
juce::String  shortName,
juce::String  label,
float  minValue,
float  maxValue,
float  intervalValue,
float  defaultValue,
float  skewFactor = 1.0f,
std::function< juce::String(const Parameter &, float)>  textFunction = nullptr 
)

◆ Parameter() [2/2]

Parameter::Parameter ( Processor ,
juce::String  uid,
juce::String  name,
juce::String  shortName,
juce::String  label,
juce::NormalisableRange< float >  range,
float  defaultValue,
std::function< juce::String(const Parameter &, float)>  textFunction = nullptr 
)

Member Function Documentation

◆ getUid()

juce::String Parameter::getUid ( ) const

References uid.

Referenced by ParamComponent::getUid().

◆ setInternal()

void Parameter::setInternal ( bool  i)

◆ isInternal()

bool Parameter::isInternal ( ) const

◆ setModIndex()

void Parameter::setModIndex ( int  i)

References modIndex.

◆ getModIndex()

int Parameter::getModIndex ( ) const

References modIndex.

◆ setModMatrix()

void Parameter::setModMatrix ( ModMatrix m)

References modMatrix.

◆ getModMatrix()

ModMatrix* Parameter::getModMatrix ( ) const

References modMatrix.

◆ prepareToPlay()

virtual void Parameter::prepareToPlay ( double  ,
int   
)
virtual

◆ reset()

virtual void Parameter::reset ( )
virtual

◆ getProcValue() [1/2]

float Parameter::getProcValue ( )

◆ getProcValue() [2/2]

virtual float Parameter::getProcValue ( int  )
virtual

◆ getUserValue()

float Parameter::getUserValue ( ) const

◆ getUserValueInt()

int Parameter::getUserValueInt ( ) const

References range, and value.

◆ getUserValueBool()

bool Parameter::getUserValueBool ( ) const

References range, and value.

◆ getUserDefaultValue()

float Parameter::getUserDefaultValue ( ) const

References defaultValue.

Referenced by PluginSlider::mouseDown().

◆ setUserValue()

virtual void Parameter::setUserValue ( float  v)
virtual

◆ setUserValueNotifingHost()

virtual void Parameter::setUserValueNotifingHost ( float  f)
virtual

◆ setUserValueAsUserAction()

void Parameter::setUserValueAsUserAction ( float  f)

◆ getUserValueText()

juce::String Parameter::getUserValueText ( ) const

◆ userValueToText()

juce::String Parameter::userValueToText ( float  val)

References getText(), label, and range.

Referenced by PluginComboBox::PluginComboBox().

◆ isOnOff()

bool Parameter::isOnOff ( )

References range.

◆ isOn()

bool Parameter::isOn ( )

References getUserValue(), and range.

◆ isSmoothingActive()

virtual bool Parameter::isSmoothingActive ( )
virtual

◆ beginUserAction()

void Parameter::beginUserAction ( )

◆ beginUserTimedAction()

void Parameter::beginUserTimedAction ( )

◆ endUserAction()

void Parameter::endUserAction ( )

◆ getUserRange()

juce::NormalisableRange<float> Parameter::getUserRange ( ) const

References range.

◆ getUserRangeStart()

float Parameter::getUserRangeStart ( ) const

◆ getUserRangeEnd()

float Parameter::getUserRangeEnd ( ) const

◆ addListener()

void Parameter::addListener ( ParameterListener listener)

◆ removeListener()

void Parameter::removeListener ( ParameterListener listener)

◆ getState()

ParamState Parameter::getState ( )

◆ setState()

void Parameter::setState ( const ParamState state)

◆ getParameterID()

juce::String Parameter::getParameterID ( ) const
override

References uid.

◆ getValue()

float Parameter::getValue ( ) const
override

References range, and value.

Referenced by getBoolValue(), and getUserValueText().

◆ getBoolValue()

bool Parameter::getBoolValue ( ) const

References getValue().

◆ setValue()

void Parameter::setValue ( float  newValue)
override

◆ getDefaultValue()

float Parameter::getDefaultValue ( ) const
override

References defaultValue, and range.

◆ getName()

juce::String Parameter::getName ( int  maximumStringLength) const
override

◆ getShortName()

juce::String Parameter::getShortName ( ) const

◆ getLabel()

juce::String Parameter::getLabel ( ) const
override

References label.

◆ getNumSteps()

int Parameter::getNumSteps ( ) const
override

◆ getText()

juce::String Parameter::getText ( float  value,
int   
) const
override

◆ getValueForText()

float Parameter::getValueForText ( const juce::String &  text) const
override

◆ isOrientationInverted()

bool Parameter::isOrientationInverted ( ) const
override

◆ isAutomatable()

bool Parameter::isAutomatable ( ) const
override

◆ isMetaParameter()

bool Parameter::isMetaParameter ( ) const
override

◆ getSkew()

float Parameter::getSkew ( )

References range.

◆ isSkewSymmetric()

bool Parameter::isSkewSymmetric ( )

References range.

◆ handleAsyncUpdate()

void Parameter::handleAsyncUpdate ( )
overrideprotected

◆ timerCallback()

void Parameter::timerCallback ( )
overrideprotected

◆ changed()

virtual void Parameter::changed ( )
protectedvirtual

Member Data Documentation

◆ conversionFunction

std::function<float (float)> Parameter::conversionFunction

Referenced by getProcValue().

◆ processor

Processor& Parameter::processor
protected

◆ range

juce::NormalisableRange<float> Parameter::range
protected

◆ internal

bool Parameter::internal = false
protected

◆ modMatrix

ModMatrix* Parameter::modMatrix = nullptr
protected

Referenced by getModMatrix(), and setModMatrix().

◆ modIndex

int Parameter::modIndex = -1
protected

Referenced by getModIndex(), and setModIndex().

◆ value

float Parameter::value = 0.0f
protected

◆ defaultValue

float Parameter::defaultValue = 0.0f
protected

◆ uid

juce::String Parameter::uid
protected

Referenced by getParameterID(), and getUid().

◆ name

juce::String Parameter::name
protected

◆ shortName

juce::String Parameter::shortName
protected

Referenced by getShortName().

◆ label

juce::String Parameter::label
protected

◆ textFunction

std::function<juce::String (const Parameter&, float)> Parameter::textFunction
protected

◆ userActionCount

int Parameter::userActionCount = 0
protected

◆ listeners

juce::ListenerList<ParameterListener> Parameter::listeners
protected

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