Jamba C++ API  5.1.1
DiscreteTypeParamConverter< T, Compare > Class Template Reference

This converters maps a list of values of type T to discrete values. More...

#include <ParamConverters.h>

Inherits IParamConverter< T >.

Public Types

using ConstructorType = std::initializer_list< std::pair< const T, VstString16 > > const &
 Defines the type for the constructor argument. More...
 
using ParamType = T
 
using TList = std::vector< T >
 Defines the mapping: discrete value [0, stepCount] to T. More...
 
using TMap = std::map< T, std::tuple< VstString16, ParamValue, int32 >, Compare >
 Maintains the map of possible values of T (defined in constructor) More...
 
- Public Types inherited from IParamConverter< T >
using ParamType = T
 

Public Member Functions

ParamType denormalize (ParamValue iNormalizedValue) const override
 
 DiscreteTypeParamConverter (ConstructorType iInitList)
 This constructor will be called this way when initializing a vst or jmb parameter: More...
 
int32 getStepCount () const override
 
ParamValue normalize (ParamType const &iValue) const override
 
void toString (ParamType const &iValue, String128 oString, int32 iPrecision) const override
 
- Public Member Functions inherited from IParamConverter< T >
virtual std::string toString (ParamType const &iValue, int32 iPrecision) const
 

Private Attributes

TList fList {}
 
TMap fMap {}
 

Detailed Description

template<typename T, class Compare = std::less<T>>
class pongasoft::VST::DiscreteTypeParamConverter< T, Compare >

This converters maps a list of values of type T to discrete values.

It can be used with any T that is comparable (note that you can optionally provide your own Compare). For example, T can be an enum, enum class, struct, class, etc...

Example:

enum class ETabs {
kTabAll = 100,
kTabToggleButtonView = 150
};
// ...
VstParam<ETabs> fTab;
// ...
fTab =
vst<DiscreteTypeParamConverter<ETabs>>(EJambaTestPluginParamID::kTab, STR16("Tab"),
{
{ETabs::kTabAll, STR16("All Controls")},
{ETabs::kTabToggleButtonView, STR16("ToggleButtonView")}
})
.add();

Member Typedef Documentation

◆ ConstructorType

using ConstructorType = std::initializer_list<std::pair<const T, VstString16> > const &

Defines the type for the constructor argument.

Example: { { t, STR16("abc") }, ... }

◆ ParamType

using ParamType = T

◆ TList

using TList = std::vector<T>

Defines the mapping: discrete value [0, stepCount] to T.

◆ TMap

using TMap = std::map<T, std::tuple<VstString16, ParamValue, int32>, Compare>

Maintains the map of possible values of T (defined in constructor)

Constructor & Destructor Documentation

◆ DiscreteTypeParamConverter()

This constructor will be called this way when initializing a vst or jmb parameter:

Member Function Documentation

◆ denormalize()

ParamType denormalize ( ParamValue  iNormalizedValue) const
inlineoverridevirtual

Implements IParamConverter< T >.

◆ getStepCount()

int32 getStepCount ( ) const
inlineoverridevirtual

Reimplemented from IParamConverter< T >.

◆ normalize()

ParamValue normalize ( ParamType const &  iValue) const
inlineoverridevirtual

Implements IParamConverter< T >.

◆ toString()

void toString ( ParamType const &  iValue,
String128  oString,
int32  iPrecision 
) const
inlineoverridevirtual

Reimplemented from IParamConverter< T >.

Member Data Documentation

◆ fList

TList fList {}
private

◆ fMap

TMap fMap {}
private

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