Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
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 class  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.
tresult readFromMessage (Message const &iMessage, ParamType &oValue) const
ParamType readFromStream (IBStreamer &iStreamer) const
tresult readFromStream (IBStreamer &iStreamer, ParamType &oValue) const override
 This method should read from the stream and populate oValue accordingly (aka deserialization).
std::string toUTF8String (ParamType const &iValue, int32 iPrecision) const
 Return the value as a utf-8 string.
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).
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).
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).
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.
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::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

template<typename T>
using ParamType = T

Constructor & Destructor Documentation

◆ JmbParamDef()

template<typename T>
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()

template<typename T>
std::string computeMessageAttrID ( ) const
inline

◆ getDiscreteConverter()

template<typename T>
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()

template<typename T>
bool isSerializable ( ) const
inlineoverridevirtual
Returns
true if a serializer was provided

Implements IJmbParamDef.

◆ newGUIParam()

template<typename T>
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()

template<typename T>
tresult readFromMessage ( Message const & iMessage,
ParamType & oValue ) const

◆ readFromStream() [1/2]

template<typename T>
T readFromStream ( IBStreamer & iStreamer) const

◆ readFromStream() [2/2]

template<typename T>
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 >.

◆ toUTF8String()

template<typename T>
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()

template<typename T>
void writeDefaultValue ( std::ostream & oStreamer) const
overridevirtual

Implements IJmbParamDef.

◆ writeToMessage()

template<typename T>
tresult writeToMessage ( ParamType const & iValue,
Message & oMessage ) const

◆ writeToStream() [1/2]

template<typename T>
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]

template<typename T>
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

template<typename T>
const ParamType fDefaultValue

◆ fSerializer

template<typename T>
const std::shared_ptr<IParamSerializer<ParamType> > fSerializer

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