Copyright © 2001-2019 MultiMedia Soft

CustomDSP.ExternalSetFunction method

Previous pageReturn to chapter overviewNext page

Remarks

 

Sets the name of a specific function of the external custom DSP.

 

As you may know, the GetProcAddress Windows API allows retrieving the address of an exported function from a specified dynamic-link library (DLL) file previously loaded through the LoadLibrary Windows API: in a very similar way, the CustomDSP.ExternalSetFunction method allows retrieving the address of an exported function from a specified dynamic-link library (DLL) file previously loaded through the CustomDSP.ExternalLoad method. Through this mechanism you can set the callback function that will effectively manage the DSP effect, retrieving/setting DSP effect's parameters, asking the DSP to display its own user interface (also known as "Editor") and also send your own custom commands to the DSP.

 

For further details about methods related to the use of custom DSP effects refer to the CustomDSP COM object.

Further information about the use of Custom DSP effects can be found inside the How to manage custom DSP effects tutorial.

 

 

Syntax

 

[Visual Basic]

control.CustomDSP.ExternalSetFunction (

nPlayer as Integer,

nIdDsp as Long,

nFunctionType as enumDspExternalFunctions,

strFunctionName as String

) as enumErrorCodes


 

[C++]

short control.CustomDSP.ExternalSetFunction (

short nPlayer,

long nIdDsp,

short nFunctionType,

LPCTSTR strFunctionName

);


 

 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

nIdDsp

Unique identifier of the custom DSP

nFunctionType

Type of function to set.

Supported values are the following:

Mnemonic constant

Value

Meaning

DSP_FUNC_CALLBACK

0

Sets the callback function containing the code that will effectively modify original WAV PCM data. Remember that callback functions must be as fast as possible in order to avoid slowing down overall performances.

 

The Visual C++ definition of an external callback function is as follows:

 

void WINAPI MyCustomCallback (

void *bufferSamples,

DWORD bufferSamplesLength,

DWORD nUserData

);

 

where

bufferSamples

Pointer to the buffer containing WAV PCM samples to be processed by the DSP in one of the following formats:

8-bit samples are unsigned

16-bit samples are signed

32-bit floating-point samples can range from -1 to +1: note that they are not clipped so they could be outside the mentioned range.

 

You can instruct the DSP using 32-bit floating-point samples only through the CustomDSP.UseFloatSample method.

bufferSamplesLength

The length in bytes of the buffer above

nUserData

User specific data

DSP_FUNC_PARAMS_GET

1

Sets the function used to obtain current parameters from the external DSP

DSP_FUNC_PARAMS_SET

2

Sets the function used to set parameters to the external DSP

DSP_FUNC_COMMAND_SEND

3

Sets the function used to send your own custom commands to the external DSP

DSP_FUNC_EDITOR_DISPLAY

4

Sets the function used to display the editor (user interface) of the external DSP: the availability of a user interface is not mandatory

DSP_FUNC_EDITOR_GET_INFO

5

Sets the function used to obtain information about the editor (user interface) of the external DSP

strFunctionName

Name of the function exported by the dynamic-link library (DLL)

 

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.