User Guide
DLL Component
Example 2 – String Uppercase
This example takes a string and makes it uppercase. There's a bit more to it in that you need to manage the memory for the output string
that holds the result.
extern "C" __declspec(dllexport) void makeUppercase( int nParams, int* pIn, int* pOut )
{
if( pIn && pOut && nParams >= 1 )
{
char* strIn = GETSTRING(pIn[0]);
DELETESTRING(pOut[0]);
if( strIn )
{
int i=0;
int len = strlen(strIn);
char* strOut = new char[len+1];
while( strIn[i] )
{
char c = strIn[i];
strOut[i] = toupper(c);
i++;
}
strOut[len]=0;
GETSTRING(pOut[0]) = strOut;
}
}
}
Example 3 – Audio Delay
This little delay effect will give you and idea of how to do audio processing in your dll. The effect expects 6 inputs, the frame, number of
samples delay, feedback amount, mix level, a counter to maintain the position in the circular buffer and the circular buffer itself.
We could have created the buffer and counter as global variables in the dll but we've chosen to supply them from the schematic so that the
dll could be used by more than one DLL component at a time.
extern "C" __declspec(dllexport) void makeUppercase( int nParams, int* pIn, int* pOut )
{
if( pIn && pOut && nParams >= 6 )
{
if( pIn[0] )
{
float* pData = GETFRAME(pIn[0]);
int n = GETFRAMESIZE(pIn[0]);
int delay = GETINT(pIn[1]);
float feed = GETFLOAT(pIn[2]);
float mix = GETFLOAT(pIn[3]);
int ctr = GETINT(pOut[4]);
float* pBuffer = GETFRAME(pIn[5]);
int buffSize = GETFRAMESIZE(pIn[5]);
if( pBuffer && buffSize >= delay && pData )
{
float curr;
for( int i=0; i<n; i++ )
{
curr = pData[i];
194 of 212