Krotos Modules 3
Loading...
Searching...
No Matches
krotos::GenericParameter Class Reference

A subclass of RangedAudioParameter that can act as an alias for another audio parameter, used in the parameter routing system. More...

#include <GenericParameter.h>

Inheritance diagram for krotos::GenericParameter:

Public Member Functions

 GenericParameter (const String &paramID, const String &paramName, int idx)
 
bool isLinked ()
 
void link (RangedAudioParameter *paramToAttach)
 
void unlink ()
 
int getIndex () const
 
float getValue () const override
 
void setValue (float newValue) override
 
float getDefaultValue () const override
 
String getName (int maximumStringLength) const override
 
String getLabel () const override
 
String getText (float normalisedValue, int maximumStringLength) const override
 
float getValueForText (const String &text) const override
 
const NormalisableRange< float > & getNormalisableRange () const override
 
bool isMetaParameter () const override
 

Private Attributes

const int m_idx
 
const NormalisableRange< float > m_range {0.0f, 1.0f}
 
std::atomic< float > m_normalisedValue
 
RangedAudioParameter * m_currentParameter {nullptr}
 

Detailed Description

A subclass of RangedAudioParameter that can act as an alias for another audio parameter, used in the parameter routing system.

GenericParameter is an external or DAW-facing parameter that can be linked with any RangedAudioParameter using its link() function. Once linked, the GenericParameter will take on the name, value, range, etc. from the linked parameter and send this info to the host.

See also
KParameter

Constructor & Destructor Documentation

◆ GenericParameter()

krotos::GenericParameter::GenericParameter ( const String & paramID,
const String & paramName,
int idx )

Constructor.

Parameters
paramIDA unique parameter ID.
paramNameThe display name of the parameter when it is not attached to a KParmaeter.

Member Function Documentation

◆ getDefaultValue()

float krotos::GenericParameter::getDefaultValue ( ) const
override

◆ getIndex()

int krotos::GenericParameter::getIndex ( ) const

Get the parameter index.

◆ getLabel()

String krotos::GenericParameter::getLabel ( ) const
override

◆ getName()

String krotos::GenericParameter::getName ( int maximumStringLength) const
override

◆ getNormalisableRange()

const NormalisableRange< float > & krotos::GenericParameter::getNormalisableRange ( ) const
override

◆ getText()

String krotos::GenericParameter::getText ( float normalisedValue,
int maximumStringLength ) const
override

◆ getValue()

float krotos::GenericParameter::getValue ( ) const
override

Get the current normalised value.

◆ getValueForText()

float krotos::GenericParameter::getValueForText ( const String & text) const
override

◆ isLinked()

bool krotos::GenericParameter::isLinked ( )

Checks if this parameter is currently linked to a RangedAudioParameter.

◆ isMetaParameter()

bool krotos::GenericParameter::isMetaParameter ( ) const
override

◆ link()

void krotos::GenericParameter::link ( RangedAudioParameter * paramToAttach)

Links this parameter to a RangedAudioParameter, updating the name, range, etc. to that of the newly attached parameter, and begins propagating changes to and from the KParameter.

If this GenericParameter instance is already attached to another KParameter, this function will terminate the old connection before attaching the new KParameter.

◆ setValue()

void krotos::GenericParameter::setValue ( float newValue)
override

Set the normalised value. Don't call this directly, use setValueNotifyingHost() instead.

◆ unlink()

void krotos::GenericParameter::unlink ( )

Unlinks this object from its currently linked parameter.

Member Data Documentation

◆ m_currentParameter

RangedAudioParameter* krotos::GenericParameter::m_currentParameter {nullptr}
private

◆ m_idx

const int krotos::GenericParameter::m_idx
private

◆ m_normalisedValue

std::atomic<float> krotos::GenericParameter::m_normalisedValue
private

◆ m_range

const NormalisableRange<float> krotos::GenericParameter::m_range {0.0f, 1.0f}
private

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