Copyright © 2008-2018 MultiMedia Soft

Effects.CustomDspExternalSetFunction 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 Effects.CustomDspExternalSetFunction method allows retrieving the address of an exported function from a specified dynamic-link library (DLL) file previously loaded through the Effects.CustomDspExternalLoad 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 custom commands to the DSP.

 

For further details about managing a custom DSP effect refer to the How to manage custom DSP effects section.

For further details about methods related to the use of special effects refer to the EffectsMan class.

 

 

Syntax

 

[Visual Basic]

Public Function CustomDspExternalSetFunction (

nIdDsp as Int32,

nFunctionType as enumDspExternalFunctions,

strFunctionName as string

) as enumErrorCodes


 

[C#]

public enumErrorCodes CustomDspExternalSetFunction (

Int32 nIdDsp,

enumDspExternalFunctions nFunctionType,

string strFunctionName

);


 

[C++]

public: enumErrorCodes CustomDspExternalSetFunction (

Int32 nIdDsp,

enumDspExternalFunctions nFunctionType,

string strFunctionName

);


 

 

Parameter

Description

 

 

nIdDsp

Unique identifier of the custom DSP as returned by the Effects.CustomDspExternalLoad method

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 Effects.CustomDspUseFloatSamples 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.ERR_NOERROR (0)

The method call was successful.