Jamba C++ API  5.1.1
JmbParamDef< T > Class Template Reference

Base class for all non vst parameters (need to provide serialization/deserialization) More...

#include <ParamDef.h>

Inherits IJmbParamDef, and IParamSerializer< T >.

Public Types

using ParamType = T
 
- Public Types inherited from IParamDef
enum  Owner { kRT, kGUI }
 Who owns the parameter (mostly for state saving purposes) More...
 

Public Member Functions

std::string computeMessageAttrID () const
 
std::shared_ptr< IDiscreteConverter< T > > getDiscreteConverter () const
 
bool isSerializable () const override
 
 JmbParamDef (ParamID const iParamID, VstString16 iTitle, Owner const iOwner, bool const iTransient, int16 const iDeprecatedSince, bool const iShared, ParamType const &iDefaultValue, std::shared_ptr< IParamSerializer< ParamType >> iSerializer)
 
std::shared_ptr< GUI::Params::IGUIJmbParameternewGUIParam () override
 Create a new IGUIJmbParameter of the proper subtype. More...
 
tresult readFromMessage (Message const &iMessage, ParamType &oValue) const
 
tresult readFromStream (IBStreamer &iStreamer, ParamType &oValue) const override
 This method should read from the stream and populate oValue accordingly (aka deserialization) More...
 
ParamType readFromStream (IBStreamer &iStreamer) const
 
std::string toUTF8String (ParamType const &iValue, int32 iPrecision) const
 Return the value as a utf-8 string. More...
 
void writeDefaultValue (std::ostream &oStreamer) const override
 
tresult writeToMessage (ParamType const &iValue, Message &oMessage) const
 
tresult writeToStream (ParamType const &iValue, IBStreamer &oStreamer) const override
 This method should write iValue to the stream (aka serialization) More...
 
void writeToStream (ParamType const &iValue, std::ostream &oStreamer) const override
 By default, this implementation simply writes the value to the stream IF it is possible (determined at compilation time). More...
 
- Public Member Functions inherited from IJmbParamDef
 IJmbParamDef (const ParamID iParamID, VstString16 iTitle, Owner const iOwner, bool const iTransient, int16 const iDeprecatedSince, bool const iShared)
 
 ~IJmbParamDef () override=default
 
- Public Member Functions inherited from IParamDef
 IParamDef (ParamID const iParamID, VstString16 iTitle, Owner const iOwner, bool const iTransient, int16 const iDeprecatedSince)
 
bool isDeprecated () const
 Returns true if the parameter is deprecated (meaning it can only be used to upgrade to latest version) More...
 
virtual ~IParamDef ()=default
 

Public Attributes

const ParamType fDefaultValue
 
const std::shared_ptr< IParamSerializer< ParamType > > fSerializer
 
- Public Attributes inherited from IJmbParamDef
bool const fShared
 
- Public Attributes inherited from IParamDef
const int16 fDeprecatedSince
 
const Owner fOwner
 
const ParamID fParamID
 
const VstString16 fTitle
 
const bool fTransient
 

Additional Inherited Members

- Static Public Attributes inherited from IParamDef
static constexpr int16 kVersionNotDeprecated = -1
 Special version indicating the parameter is not deprecated. More...
 
- Private Types inherited from IParamSerializer< T >
using ParamType = T
 
- Private Member Functions inherited from IParamSerializer< T >
virtual std::string toString (ParamType const &iValue, int32 iPrecision) const
 

Detailed Description

template<typename T>
class pongasoft::VST::GUI::JmbParamDef< T >

Base class for all non vst parameters (need to provide serialization/deserialization)

Template Parameters
Tthe underlying type of the param

Member Typedef Documentation

◆ ParamType

using ParamType = T

Constructor & Destructor Documentation

◆ JmbParamDef()

JmbParamDef ( ParamID const  iParamID,
VstString16  iTitle,
Owner const  iOwner,
bool const  iTransient,
int16 const  iDeprecatedSince,
bool const  iShared,
ParamType const &  iDefaultValue,
std::shared_ptr< IParamSerializer< ParamType >>  iSerializer 
)
inline

Member Function Documentation

◆ computeMessageAttrID()

std::string computeMessageAttrID ( ) const
inline

◆ getDiscreteConverter()

std::shared_ptr<IDiscreteConverter<T> > getDiscreteConverter ( ) const
inline
Returns
the discrete converter associated with this param def or nullptr if there isn't one.

◆ isSerializable()

bool isSerializable ( ) const
inlineoverridevirtual
Returns
true if a serializer was provided

Implements IJmbParamDef.

◆ newGUIParam()

std::shared_ptr< GUI::Params::IGUIJmbParameter > newGUIParam ( )
overridevirtual

Create a new IGUIJmbParameter of the proper subtype.

Implementation note: because IGUIJmbParameter depends on ParamDef the implementation of this templated method is defined in GUIState.h.

Implements IJmbParamDef.

◆ readFromMessage()

tresult readFromMessage ( Message const &  iMessage,
ParamType oValue 
) const

◆ readFromStream() [1/2]

tresult readFromStream ( IBStreamer &  iStreamer,
ParamType oValue 
) const
overridevirtual

This method should read from the stream and populate oValue accordingly (aka deserialization)

Returns
kResultOk if reading was successful, kResultFalse otherwise (or kNotImplemented if not supported)

Reimplemented from IParamSerializer< T >.

◆ readFromStream() [2/2]

T readFromStream ( IBStreamer &  iStreamer) const

◆ toUTF8String()

std::string toUTF8String ( ParamType const &  iValue,
int32  iPrecision 
) const
inline

Return the value as a utf-8 string.

Parameters
iValuethe value to process
iPrecisionif < 0 uses fPrecision otherwise use the one provided

◆ writeDefaultValue()

void writeDefaultValue ( std::ostream &  oStreamer) const
overridevirtual

Implements IJmbParamDef.

◆ writeToMessage()

tresult writeToMessage ( ParamType const &  iValue,
Message oMessage 
) const

◆ writeToStream() [1/2]

tresult writeToStream ( ParamType const &  iValue,
IBStreamer &  oStreamer 
) const
overridevirtual

This method should write iValue to the stream (aka serialization)

Returns
kResultOk if writing was successful, kResultFalse otherwise (or kNotImplemented if not supported)

Reimplemented from IParamSerializer< T >.

◆ writeToStream() [2/2]

void writeToStream ( ParamType const &  iValue,
std::ostream &  oStream 
) const
overridevirtual

By default, this implementation simply writes the value to the stream IF it is possible (determined at compilation time).

Doesn't do anything if not. Subclasses can redefine this behavior.

Reimplemented from IParamSerializer< T >.

Member Data Documentation

◆ fDefaultValue

const ParamType fDefaultValue

◆ fSerializer

const std::shared_ptr<IParamSerializer<ParamType> > fSerializer

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