iPlug2 - C++ Audio Plug-in Framework
Classes | Macros | Functions
IPlug::Utilities

Utility functions and macros. More...

Classes

class  IMidiQueue
 A class to help with queuing timestamped MIDI messages. More...
 

Macros

#define MAKE_QUOTE(str)   #str
 
#define MAKE_STR(str)   MAKE_QUOTE(str)
 
#define GET_PARAM_FROM_VARARG(paramType, vp, v)
 

Functions

template<typename T >
BEGIN_IPLUG_NAMESPACE T Clip (T x, T lo, T hi)
 Clips the value x between lo and hi. More...
 
template<typename T >
Lerp (T a, T b, T f)
 Linear interpolate between values a and b. More...
 
static bool CStringHasContents (const char *str)
 
static double DBToAmp (double dB)
 Calculates gain from a given dB value. More...
 
static double AmpToDB (double amp)
 
static void GetVersionParts (int versionInteger, int &maj, int &min, int &pat)
 Helper function to unpack the version number parts as individual integers. More...
 
static int GetDecimalVersion (int versionInteger)
 Helper function to get the version number as a decimal integer. More...
 
static void GetVersionStr (int versionInteger, WDL_String &str)
 Helper function to get the semantic version number as a string from an integer. More...
 
template<class SRC , class DEST >
void CastCopy (DEST *pDest, SRC *pSrc, int n)
 Helper function to loop through a buffer of samples copying and casting from e.g float to double. More...
 
static void ToLower (char *cDest, const char *cSrc)
 
static EHost LookUpHost (const char *inHost)
 Gets the host ID from a human-readable name. More...
 
static void GetHostNameStr (EHost host, WDL_String &str)
 Gets a human-readable name from host identifier. More...
 
static void MidiNoteName (double midiPitch, WDL_String &noteName, bool cents=false, bool middleCisC4=false)
 

Detailed Description

Utility functions and macros.

Function Documentation

static double AmpToDB ( double  amp)
inlinestatic
Returns
dB calculated as an approximation of \( 20*log_{10}(x) \)
See also
AMP_DB

Definition at line 103 of file IPlugUtilities.h.

References AMP_DB.

Referenced by IVMeterControl< MAXNC >::OnMsgFromDelegate().

template<class SRC , class DEST >
void CastCopy ( DEST *  pDest,
SRC *  pSrc,
int  n 
)

Helper function to loop through a buffer of samples copying and casting from e.g float to double.

Template Parameters
SRCThe source type
DESTThe destination type
Parameters
pDestPtr to the destination buffer
pSrcPtr to the source buffer
nThe number of or elements in the buffer

Definition at line 147 of file IPlugUtilities.h.

Referenced by IPlugProcessor::GetAUPluginType().

template<typename T >
BEGIN_IPLUG_NAMESPACE T Clip ( x,
lo,
hi 
)
static double DBToAmp ( double  dB)
inlinestatic

Calculates gain from a given dB value.

Parameters
dBValue in dB
Returns
Gain calculated as an approximation of \( 10^{\frac{x}{20}} \)
See also
IAMP_DB

Definition at line 95 of file IPlugUtilities.h.

References IAMP_DB.

Referenced by IParam::DBToAmp().

static int GetDecimalVersion ( int  versionInteger)
inlinestatic

Helper function to get the version number as a decimal integer.

Parameters
versionIntegerThe version number packed into an integer
Returns
int Decimal version

Definition at line 123 of file IPlugUtilities.h.

References GetVersionParts().

Referenced by IPluginBase::GetHostVersion(), and IPluginBase::GetPluginVersion().

static void GetHostNameStr ( EHost  host,
WDL_String &  str 
)
static

Gets a human-readable name from host identifier.

Parameters
hostHost identifier (see EHost)
strWDL_String to set
1 int hostID = EHost::kHostAbletonLive;
2 WDL_String hostName;
3 GetHostNameStr(hostID, hostName);

Definition at line 235 of file IPlugUtilities.h.

Referenced by IPluginBase::GetHostStr().

static void GetVersionParts ( int  versionInteger,
int &  maj,
int &  min,
int &  pat 
)
inlinestatic

Helper function to unpack the version number parts as individual integers.

Parameters
versionIntegerThe version number packed into an integer
majThe major version
minThe minor version
patThe patch version

Definition at line 113 of file IPlugUtilities.h.

Referenced by GetDecimalVersion(), and GetVersionStr().

static void GetVersionStr ( int  versionInteger,
WDL_String &  str 
)
inlinestatic

Helper function to get the semantic version number as a string from an integer.

Parameters
versionIntegerThe version number packed into an integer
strWDL_String to be populated with the version number in MAJOR.MINOR.PATCH format as a string

Definition at line 133 of file IPlugUtilities.h.

References GetVersionParts().

Referenced by IPluginBase::GetHostVersionStr(), IPluginBase::GetPluginVersionStr(), and IPlugAPIBase::SetHost().

template<typename T >
T Lerp ( a,
b,
f 
)
inline

Linear interpolate between values a and b.

Parameters
aLow value
bHigh value
fValue betweeen 0-1 for interpolation

Definition at line 54 of file IPlugUtilities.h.

Referenced by IWheelControl::Draw(), IWheelControl::OnMouseUp(), and IVMultiSliderControl< MAXNC >::SnapToMouse().

static EHost LookUpHost ( const char *  inHost)
static

Gets the host ID from a human-readable name.

Parameters
inHostHost name to search for
Returns
Identifier of the host (see EHost)

Definition at line 171 of file IPlugUtilities.h.

References ToLower().

Referenced by IPlugAPIBase::SetHost().

static void MidiNoteName ( double  midiPitch,
WDL_String &  noteName,
bool  cents = false,
bool  middleCisC4 = false 
)
static
Todo:
Parameters
midiPitch

Definition at line 294 of file IPlugUtilities.h.

Referenced by IParam::InitPitch().

static void ToLower ( char *  cDest,
const char *  cSrc 
)
static