FMOD Engine User Manual 2.03

19. Plug-in API Reference | DSP

An interface that manages DSP plug-ins.

For more information on creating and using DSP plug-ins, please refer to the Plug-in DSP API Guide.

System:

Parameter API:




General:






Functions:





FMOD_COMPLEX

Complex number structure.

C
C++
C#
JS

typedef struct FMOD_COMPLEX {
  float   real;
  float   imag;
} FMOD_COMPLEX;
struct COMPLEX
{
  float real;
  float imag;
}
FMOD_COMPLEX
{
  real,
  imag,
};
real
Real component
imag
Imaginary component

See Also: FMOD_DSP_STATE_FUNCTIONS, FMOD_DSP_STATE_DFT_FUNCTIONS

FMOD_DSP_ALLOC_FUNC

Function to allocate memory using the FMOD memory system.

C
C++
C#
JS

void * F_CALL FMOD_DSP_ALLOC_FUNC(
    unsigned int size,
    FMOD_MEMORY_TYPE type,
    const char *sourcestr
);
delegate IntPtr DSP_ALLOC_FUNC(
    uint size,
    MEMORY_TYPE type,
    IntPtr sourcestr
);

Not supported for JavaScript.

size

Allocation size.

  • Units: Bytes
type
Memory allocation type. (FMOD_MEMORY_TYPE)
sourcestr
String with the FMOD source code filename and line number in it. Only valid in logging versions of FMOD. (UTF-8 string)

The 'sourcestr' argument can be used via StringWrapper by using FMOD.StringWrapper sourceStr = new FMOD.StringWrapper(sourcestr);

Implementation Detail:

This function is a wrapper used by the system level allocator and can be called from any DSP instance. Returns a pointer to a region of memory with the requested size, or 0 on a failure.

See Also: FMOD_DSP_STATE, FMOD_DSP_REALLOC_FUNC, FMOD_DSP_FREE_FUNC

FMOD_DSP_BUFFER_ARRAY

Structure for input and output buffers.

C
C++
C#
JS

typedef struct FMOD_DSP_BUFFER_ARRAY {
  int                numbuffers;
  int               *buffernumchannels;
  FMOD_CHANNELMASK   *bufferchannelmask;
  float            **buffers;
  FMOD_SPEAKERMODE   speakermode;
} FMOD_DSP_BUFFER_ARRAY;
struct DSP_BUFFER_ARRAY
{
  int           numbuffers;
  int[]         buffernumchannels;
  CHANNELMASK[] bufferchannelmask;
  IntPtr[]      buffers;
  SPEAKERMODE   speakermode;
  int           numchannels;
  IntPtr        buffer;
}

Not supported for JavaScript.

numbuffers
Array size of buffers.
buffernumchannels
Array of number of channels for each buffer.
bufferchannelmask
Deprecated. (FMOD_CHANNELMASK)
buffers
Array of buffers.
speakermode
Speaker mode for all buffers in the array. (FMOD_SPEAKERMODE)
numchannels C#
C# helper property to get number of channels in the buffer.
buffer C#
C# helper property to retrieve memory from the buffers property.

This structure is used for reading and writing sample data in the FMOD_DSP_PROCESS_CALLBACK.

Example:

The following example demonstrates how to traverse a buffer array to generate a square wave:

int numchannels = outbufferarray[0].buffernumchannels[0];
float *output = outbufferarray[0].buffers[0];

bool pos = false;
int step = 0;
for (unsigned int sample = 0; sample < length; sample++)
{
    for (int channel = 0; channel < numchannels; channel++)
    {
        output[sample * numchannels + channel] = pos ? 1.0f : -1.0f;
    }
    if (step++ % 32 == 0)
    {
        pos = !pos;
    }
}
int numchannels = outbufferarray.numchannels;
float[] output = new float[length * numchannels];

bool pos = false;
int step = 0;
for (int sample = 0; sample < length; sample++)
{
    for (int channel = 0; channel < numchannels; channel++)
    {
        output[sample * numchannels + channel] = pos ? 1.0f : -1.0f;
    }
    if (step++ % 32 == 0)
    {
        pos = !pos;
    }
}

Marshal.Copy(output, 0, outbufferarray.buffer, (int)length * numchannels);

Not supported for JavaScript.

See Also: FMOD_DSP_DESCRIPTION

FMOD_DSP_CREATE_CALLBACK

DSP create callback.

This callback is called when you create a DSP unit instance of this type.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_CREATE_CALLBACK(
  FMOD_DSP_STATE *dsp_state
);
delegate RESULT DSP_CREATE_CALLBACK(
    ref DSP_STATE dsp_state
);
function FMOD_DSP_CREATE_CALLBACK(
    dsp_state
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)

Invoked by:

Implementation Detail:

This callback is typically where memory is allocated and DSP specific variables are initialized.

If a user re-uses a DSP unit instead of releasing it and creating a new one, it may be useful to implement FMOD_DSP_RESET_CALLBACK to reset any variables or buffers when the user calls DSP::reset.

See Also: FMOD_DSP_DESCRIPTION, System::createDSP, System::createDSPByType, System::createDSPByPlugin, FMOD_DSP_RESET_CALLBACK, FMOD_DSP_RELEASE_CALLBACK

FMOD_DSP_DESCRIPTION

DSP description.

This description structure allows you to define all functionality required for a DSP unit when writing a DSP plug-in.

C
C++
C#
JS

typedef struct FMOD_DSP_DESCRIPTION {
  unsigned int                          pluginsdkversion;
  char                                  name[32];
  unsigned int                          version;
  int                                   numinputbuffers;
  int                                   numoutputbuffers;
  FMOD_DSP_CREATE_CALLBACK              create;
  FMOD_DSP_RELEASE_CALLBACK             release;
  FMOD_DSP_RESET_CALLBACK               reset;
  FMOD_DSP_READ_CALLBACK                read;
  FMOD_DSP_PROCESS_CALLBACK             process;
  FMOD_DSP_SETPOSITION_CALLBACK         setposition;
  int                                   numparameters;
  FMOD_DSP_PARAMETER_DESC             **paramdesc;
  FMOD_DSP_SETPARAM_FLOAT_CALLBACK      setparameterfloat;
  FMOD_DSP_SETPARAM_INT_CALLBACK        setparameterint;
  FMOD_DSP_SETPARAM_BOOL_CALLBACK       setparameterbool;
  FMOD_DSP_SETPARAM_DATA_CALLBACK       setparameterdata;
  FMOD_DSP_GETPARAM_FLOAT_CALLBACK      getparameterfloat;
  FMOD_DSP_GETPARAM_INT_CALLBACK        getparameterint;
  FMOD_DSP_GETPARAM_BOOL_CALLBACK       getparameterbool;
  FMOD_DSP_GETPARAM_DATA_CALLBACK       getparameterdata;
  FMOD_DSP_SHOULDIPROCESS_CALLBACK      shouldiprocess;
  void                                 *userdata;
  FMOD_DSP_SYSTEM_REGISTER_CALLBACK     sys_register;
  FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK   sys_deregister;
  FMOD_DSP_SYSTEM_MIX_CALLBACK          sys_mix;
} FMOD_DSP_DESCRIPTION;
struct DSP_DESCRIPTION
{
  uint                           pluginsdkversion;
  char[]                         name;
  uint                           version;
  int                            numinputbuffers;
  int                            numoutputbuffers;
  DSP_CREATE_CALLBACK            create;
  DSP_RELEASE_CALLBACK           release;
  DSP_RESET_CALLBACK             reset;
  DSP_READ_CALLBACK              read;
  DSP_PROCESS_CALLBACK           process;
  DSP_SETPOSITION_CALLBACK       setposition;
  int                            numparameters;
  IntPtr                         paramdesc;
  DSP_SETPARAM_FLOAT_CALLBACK    setparameterfloat;
  DSP_SETPARAM_INT_CALLBACK      setparameterint;
  DSP_SETPARAM_BOOL_CALLBACK     setparameterbool;
  DSP_SETPARAM_DATA_CALLBACK     setparameterdata;
  DSP_GETPARAM_FLOAT_CALLBACK    getparameterfloat;
  DSP_GETPARAM_INT_CALLBACK      getparameterint;
  DSP_GETPARAM_BOOL_CALLBACK     getparameterbool;
  DSP_GETPARAM_DATA_CALLBACK     getparameterdata;
  DSP_SHOULDIPROCESS_CALLBACK    shouldiprocess;
  IntPtr                         userdata;
  DSP_SYSTEM_REGISTER_CALLBACK   sys_register;
  DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister;
  DSP_SYSTEM_MIX_CALLBACK        sys_mix;
}
FMOD_DSP_DESCRIPTION
{
  pluginsdkversion,
  name,
  version,
  numinputbuffers,
  numoutputbuffers,
  create,
  release,
  reset,
  read,
  process,
  setposition,
  numparameters,
  paramdesc,
  setparameterfloat,
  setparameterint,
  setparameterbool,
  setparameterdata,
  getparameterfloat,
  getparameterint,
  getparameterbool,
  getparameterdata,
  shouldiprocess,
  userdata,
  sys_register,
  sys_deregister,
  sys_mix,
};
pluginsdkversion
The plug-in SDK version this plug-in is built for. Set this to FMOD_PLUGIN_SDK_VERSION.
name Opt
DSP name. (UTF-8 string)
version Opt
Plug-in's version number.
numinputbuffers
Number of input FMOD_DSP_BUFFER_ARRAYs to process. Use 0 for DSPs that only generate sound and 1 for effects that process incoming sound.
numoutputbuffers
Number of audio output FMOD_DSP_BUFFER_ARRAYs. Only one output buffer is currently supported.
create Opt
Callback to initialize any required resources when the unit is created. (FMOD_DSP_CREATE_CALLBACK)
release Opt
Callback to perform any required cleanup just before the unit is freed. (FMOD_DSP_RELEASE_CALLBACK)
reset Opt
Callback to perform any required state resetting on the unit, such as history buffers for a filter to avoid clicks or artifacts. (FMOD_DSP_RESET_CALLBACK)
read Opt
Callback to retrieve audio data from the unit. An alternative to the process callback. Use in conjunction with shouldiprocess to determine whether read should continue to be called. (FMOD_DSP_READ_CALLBACK)
process Opt
Callback to retrieve audio data from the unit. Can be specified instead of the read callback if any channel format changes occur between input and output. This also replaces shouldiprocess and should return an error if the effect is to be bypassed. (FMOD_DSP_PROCESS_CALLBACK)
setposition Opt
Callback to change the unit's internal position info without processing data, or to reset a cursor position internally if reading data from a certain source. This is called when Channel::setPosition is called on a Channel created with System::playDSP. (FMOD_DSP_SETPOSITION_CALLBACK)
numparameters Opt
Number of parameters in the paramdesc array. The user finds this with DSP::getNumParameters
paramdesc Opt
Pointer to an array of FMOD_DSP_PARAMETER_DESC defining the parameters used by this filter. (FMOD_DSP_PARAMETER_DESC)
setparameterfloat Opt
Callback to update a floating point parameter value on the unit. (FMOD_DSP_SETPARAM_FLOAT_CALLBACK)
setparameterint Opt
Callback to update an integer parameter value on the unit. (FMOD_DSP_SETPARAM_INT_CALLBACK)
setparameterbool Opt
Callback to update a boolean parameter value on the unit. (FMOD_DSP_SETPARAM_BOOL_CALLBACK)
setparameterdata Opt
Callback to update a data parameter value on the unit. (FMOD_DSP_SETPARAM_DATA_CALLBACK)
getparameterfloat Opt
Callback to retrieve a floating point parameter value from the unit. (FMOD_DSP_GETPARAM_FLOAT_CALLBACK)
getparameterint Opt
Callback to retrieve an integer parameter value from the unit. (FMOD_DSP_GETPARAM_INT_CALLBACK)
getparameterbool Opt
Callback to retrieve a boolean parameter value from the unit. (FMOD_DSP_GETPARAM_BOOL_CALLBACK)
getparameterdata Opt
Callback to retrieve a data parameter value from the unit. (FMOD_DSP_GETPARAM_DATA_CALLBACK)
shouldiprocess Opt
Callback to determine whether read should continue to be called. You can detect if inputs are idle and return FMOD_OK to process or any other error code to avoid processing the effect. Use a countdown timer to allow effect tails to process before idling. If process is used instead, then read and shouldiprocess are not necessary. (FMOD_DSP_SHOULDIPROCESS_CALLBACK)
userdata Opt
User data stored by assignment to this property is shared by all newly created DSP instances constructed from this DSP description and can be accessed using FMOD_DSP_GETUSERDATA_FUNC.
sys_register Opt
Callback to perform any 'global'/per System object initialization for the plug-in. This is called when a DSP plug-in is registered with System::registerDSP. (FMOD_DSP_SYSTEM_REGISTER_CALLBACK)
sys_deregister Opt
Callback to perform any 'global'/per System object shutdown for the plug-in. This is called when a DSP plug-in is unloaded with System::unloadPlugin or during system shutdown with System::close. (FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK)
sys_mix Opt
Callback to perform any 'global'/per System object update calls each mix for the plug-in. This is called when the mixer starts to execute or is just finishing executing. (FMOD_DSP_SYSTEM_MIX_CALLBACK)

There are 2 different ways to change a parameter in this architecture.

One is to use DSP::setParameterFloat / DSP::setParameterInt / DSP::setParameterBool / DSP::setParameterData. This is platform independent and is dynamic, so new unknown plug-ins can have their parameters enumerated and used.

The other is to use DSP::showConfigDialog. This is platform specific and requires a GUI, and will display a dialog box to configure the plug-in.

Implementation Detail:

All function pointers assigned to callbacks must remain valid until the plug-in is unloaded with System::unloadPlugin.

The name is stored as a UTF8 string. You can assign the plug-in's name in like so:

FMOD_DSP_DESCRIPTION desc = {};
strncpy(desc.name, "My DSP", sizeof(desc.name));
FMOD.DSP_DESCRIPTION desc = new FMOD.DSP_DESCRIPTION();
desc.name = System.Text.Encoding.UTF8.GetBytes("My DSP");
var desc = FMOD.DSP_DESCRIPTION();
desc.name = "My DSP";

See Also: System::createDSP, DSP::setParameterFloat, DSP::setParameterInt, DSP::setParameterBool, DSP::setParameterData, FMOD_DSP_STATE, FMOD_DSP_CREATE_CALLBACK, FMOD_DSP_RELEASE_CALLBACK, FMOD_DSP_RESET_CALLBACK, FMOD_DSP_READ_CALLBACK, FMOD_DSP_PROCESS_CALLBACK, FMOD_DSP_SETPOSITION_CALLBACK, FMOD_DSP_PARAMETER_DESC, FMOD_DSP_SETPARAM_FLOAT_CALLBACK, FMOD_DSP_SETPARAM_INT_CALLBACK, FMOD_DSP_SETPARAM_BOOL_CALLBACK, FMOD_DSP_SETPARAM_DATA_CALLBACK, FMOD_DSP_GETPARAM_FLOAT_CALLBACK, FMOD_DSP_GETPARAM_INT_CALLBACK, FMOD_DSP_GETPARAM_BOOL_CALLBACK, FMOD_DSP_GETPARAM_DATA_CALLBACK, FMOD_DSP_SHOULDIPROCESS_CALLBACK, FMOD_DSP_SYSTEM_REGISTER_CALLBACK, FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK, FMOD_DSP_SYSTEM_MIX_CALLBACK

FMOD_DSP_DFT_FFTREAL_FUNC

Function for performing an FFT on a real signal.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_DFT_FFTREAL_FUNC(
    FMOD_DSP_STATE *dsp_state,
    int size,
    const float *signal,
    FMOD_COMPLEX* dft,
    const float *window,
    int signalhop
);
delegate RESULT DSP_DFT_FFTREAL_FUNC(
    ref DSP_STATE dsp_state,
    int size,
    IntPtr signal,
    IntPtr dft,
    IntPtr window,
    int signalhop
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
size

The length of the signal frame.

  • Units: Samples
signal

Input signal frame to perform DFT on.

  • Units: PCM
  • Range: [-1.0, +1.0]
dft Out

The output DFT result. (FMOD_COMPLEX)

window Opt

Window buffer for smoothing input signal prior to analysis. Must be the same length as the input signal. Example window types can be found in FMOD_DSP_FFT_WINDOW.

  • Range: [0.0, 1.0]
signalhop Opt

The number of samples between signal frames.

  • Units: Samples

Implementation Detail:

Calling this function will append an FMOD_DSP_FFT effect to the DSP's output if there isn't one already.

See Also: FMOD_DSP_STATE, FMOD_DSP_DFT_IFFTREAL_FUNC, FFT

FMOD_DSP_DFT_IFFTREAL_FUNC

Function for performing an inverse FFT to get a real signal.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_DFT_IFFTREAL_FUNC(
    FMOD_DSP_STATE *dsp_state,
    int size,
    const FMOD_COMPLEX *dft,
    float* signal,
    const float *window,
    int signalhop
);
delegate RESULT DSP_DFT_IFFTREAL_FUNC(
    ref DSP_STATE dsp_state,
    int size,
    IntPtr dft,
    IntPtr signal,
    IntPtr window,
    int signalhop
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
size

The length of the signal frame.

  • Units: Samples
dft

The previous input DFT result calculated from FMOD_DSP_DFT_FFTREAL_FUNC. (FMOD_COMPLEX)

signal Out

Output signal to perform IFFT on.

  • Units: PCM
  • Range: [-1.0, +1.0]
window Opt

Window buffer for smoothing input signal prior to analysis. Must be the same length as the input signal. Example window types can be found in FMOD_DSP_FFT_WINDOW.

  • Range: [0.0, 1.0]
signalhop Opt

The number of samples between signal frames.

  • Units: Samples

Implementation Detail:

Calling this function will append an FMOD_DSP_FFT effect to the DSP's output if there isn't one already.

See Also: FMOD_DSP_STATE, FMOD_DSP_DFT_FFTREAL_FUNC

FMOD_DSP_FREE_FUNC

Function to free memory allocated with FMOD_DSP_ALLOC_FUNC.

C
C++
C#
JS

void F_CALL FMOD_DSP_FREE_FUNC(
    void *ptr,
    FMOD_MEMORY_TYPE type,
    const char *sourcestr
);
delegate IntPtr DSP_FREE_FUNC(
    IntPtr ptr,
    MEMORY_TYPE type,
    IntPtr sourcestr
);

Not supported for JavaScript.

ptr
Pointer to memory location to free.
type
Memory allocation type. (FMOD_MEMORY_TYPE)
sourcestr
String with the FMOD source code filename and line number in it. Only valid in logging versions of FMOD. (UTF-8 string)

The 'sourcestr' argument can be used via StringWrapper by using FMOD.StringWrapper sourceStr = new FMOD.StringWrapper(sourcestr);

Implementation Detail:

This function is a wrapper used by the system level allocator and can be called from any DSP instance.

See Also: FMOD_DSP_STATE, FMOD_DSP_ALLOC_FUNC, FMOD_DSP_REALLOC_FUNC

FMOD_DSP_GETBLOCKSIZE_FUNC

Function to query the number of samples the mixer will process each mix.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETBLOCKSIZE_FUNC(
    FMOD_DSP_STATE *dsp_state,
    unsigned int *blocksize
);
delegate RESULT DSP_GETBLOCKSIZE_FUNC(
    ref DSP_STATE dsp_state,
    ref uint blocksize
);
FMOD_DSP_GETBLOCKSIZE_FUNC(
    dsp_state,
    blocksize
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
blocksize Out

Maximum number of decompressed PCM samples the DSP unit can handle.

  • Units: Samples

Implementation Detail:

DSPs are requested to process blocks of varying length up to this size.

See Also: FMOD_DSP_STATE, System::getDSPBufferSize

FMOD_DSP_GETCLOCK_FUNC

Function to get the clock of the current DSP, as well as the subset of the input buffer that contains the signal.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETCLOCK_FUNC(
    FMOD_DSP_STATE *dsp_state,
    unsigned long long *clock,
    unsigned int *offset,
    unsigned int *length
);
delegate RESULT DSP_GETCLOCK_FUNC(
    ref DSP_STATE dsp_state,
    out ulong clock,
    out uint offset,
    out uint length
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
clock OutOpt

DSP clock value for the DSP node.

  • Units: Samples
offset OutOpt

The start offset of the audio data inside the input buffer.

  • Units: Samples
length OutOpt

The length of the audio data inside the input buffer.

  • Units: Samples

Implementation Detail:

FMOD mix blocks are block aligned, so when a delay such as ChannelControl::setDelay is used the audio may start and end part way through the buffer. The offset is where the audio starts inside the buffer, and the length is how long after the offset the audio continues for.

See Also: FMOD_DSP_STATE

FMOD_DSP_GETLISTENERATTRIBUTES_FUNC

Callback for getting the absolute listener attributes set via the API.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETLISTENERATTRIBUTES_FUNC(
    FMOD_DSP_STATE *dsp_state,
    int *numlisteners,
    FMOD_3D_ATTRIBUTES *attributes
);
delegate RESULT DSP_GETLISTENERATTRIBUTES_FUNC(
    ref DSP_STATE dsp_state,
    ref int numlisteners,
    IntPtr attributes
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
numlisteners OutOpt
The number of listeners.
attributes OutOpt
An array of 3D attributes corresponding to each listener. (FMOD_3D_ATTRIBUTES)

Implementation Detail:

Returned as left-handed coordinates.

See Also: FMOD_DSP_STATE

FMOD_DSP_GETPARAM_BOOL_CALLBACK

Get boolean parameter callback.

This callback is called when the user wants to get a boolean parameter value from a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETPARAM_BOOL_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  FMOD_BOOL *value,
  char *valuestr
);
delegate RESULT DSP_GETPARAM_BOOL_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  ref bool value,
  IntPtr valuestr
);
function FMOD_DSP_GETPARAM_BOOL_CALLBACK(
    dsp_state,
    index,
    value,
    valuestr
)
dsp_state
DSP Plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value Out

Parameter value.

  • Units: Boolean
valuestr OutOpt
String value of the parameter. Can be used to display an alternate representation of the number. For example "ON" or "OFF" instead of 1.0 and 0.0. The length of the buffer being passed in is always a maximum of FMOD_DSP_GETPARAM_VALUESTR_LENGTH bytes. (UTF-8 string)

Invoked by:

The 'valuestr' argument can be used via StringWrapper by using FMOD.StringWrapper valueStr = new FMOD.StringWrapper(valuestr);

See Also: FMOD_DSP_DESCRIPTION, FMOD_DSP_SETPARAM_BOOL_CALLBACK

FMOD_DSP_GETPARAM_DATA_CALLBACK

Get data parameter callback.

This callback is called when the user wants to get a data parameter value from a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETPARAM_DATA_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  void **data,
  unsigned int *length,
  char *valuestr
);
delegate RESULT DSP_GETPARAM_DATA_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  IntPtr data,
  ref uint length,
  IntPtr valuestr
);
function FMOD_DSP_GETPARAM_DATA_CALLBACK(
    dsp_state,
    index,
    data,
    length,
    valuestr
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
data Out
Parameter data.
length Out
Length of data.
valuestr OutOpt
String value of the parameter. Can be used to display an alternate representation of the number. For example "ON" or "OFF" instead of values values inside the binary data. The length of the buffer being passed in is always a maximum of FMOD_DSP_GETPARAM_VALUESTR_LENGTH bytes. (UTF-8 string)

Invoked by:

The 'valuestr' argument can be used via StringWrapper by using FMOD.StringWrapper valueStr = new FMOD.StringWrapper(valuestr);

See Also: DSP::setParameterData, FMOD_DSP_DESCRIPTION, FMOD_DSP_SETPARAM_DATA_CALLBACK

FMOD_DSP_GETPARAM_FLOAT_CALLBACK

Get float parameter callback.

This callback is called when the user wants to get a floating point parameter value from a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETPARAM_FLOAT_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  float *value,
  char *valuestr
);
delegate RESULT DSP_GETPARAM_FLOAT_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  ref float value,
  IntPtr valuestr
);
function FMOD_DSP_GETPARAM_FLOAT_CALLBACK(
    dsp_state,
    index,
    value,
    valuestr
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value Out
Parameter value.
valuestr OutOpt
String value of the parameter. Can be used to display an alternate representation of the number. For example "ON" or "OFF" instead of 1.0 and 0.0. The length of the buffer being passed in is always a maximum of FMOD_DSP_GETPARAM_VALUESTR_LENGTH bytes. (UTF-8 string)

Invoked by:

The 'valuestr' argument can be used via StringWrapper by using FMOD.StringWrapper valueStr = new FMOD.StringWrapper(valuestr);

See Also: FMOD_DSP_DESCRIPTION, FMOD_DSP_SETPARAM_FLOAT_CALLBACK

FMOD_DSP_GETPARAM_INT_CALLBACK

Get integer parameter callback.

This callback is called when the user wants to get an integer parameter value from a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETPARAM_INT_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  int *value,
  char *valuestr
);
delegate RESULT DSP_GETPARAM_INT_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  ref int value,
  IntPtr valuestr
);
function FMOD_DSP_GETPARAM_INT_CALLBACK(
    dsp_state,
    index,
    value,
    valuestr
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value Out
Parameter value.
valuestr OutOpt
String value of the parameter. Can be used to display an alternate representation of the number. For example "ON" or "OFF" instead of 1 and 0. The length of the buffer being passed in is always a maximum of FMOD_DSP_GETPARAM_VALUESTR_LENGTH bytes.

Invoked by:

The 'valuestr' argument can be used via StringWrapper by using FMOD.StringWrapper valueStr = new FMOD.StringWrapper(valuestr);

See Also: DSP::setParameterInt, FMOD_DSP_DESCRIPTION, FMOD_DSP_SETPARAM_INT_CALLBACK

FMOD_DSP_GETPARAM_VALUESTR_LENGTH

Length in bytes of the buffer pointed to by the valuestr argument of FMOD_DSP_GETPARAM_XXXX_CALLBACK functions.

C
C++
C#
JS

#define FMOD_DSP_GETPARAM_VALUESTR_LENGTH   32
FMOD.DSP_GETPARAM_VALUESTR_LENGTH = 32

Currently not supported for C#.

See Also: FMOD_DSP_GETPARAM_FLOAT_CALLBACK, FMOD_DSP_GETPARAM_INT_CALLBACK, FMOD_DSP_GETPARAM_BOOL_CALLBACK, FMOD_DSP_GETPARAM_DATA_CALLBACK

FMOD_DSP_GETSAMPLERATE_FUNC

Function to query the system sample rate.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETSAMPLERATE_FUNC(
    FMOD_DSP_STATE *dsp_state,
    int *rate
);
delegate RESULT DSP_GETSAMPLERATE_FUNC(
    ref DSP_STATE dsp_state,
    ref int rate
);
FMOD_DSP_GETSAMPLERATE_FUNC(
    dsp_state,
    rate
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
rate OutOpt

The system sample rate.

  • Units: Hertz

See Also: FMOD_DSP_STATE

FMOD_DSP_GETSPEAKERMODE_FUNC

Function to query the system speaker modes.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETSPEAKERMODE_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_SPEAKERMODE *speakermode_mixer,
    FMOD_SPEAKERMODE *speakermode_output
);
delegate RESULT DSP_GETSPEAKERMODE_FUNC(
    ref DSP_STATE dsp_state,
    ref int speakermode_mixer,
    ref int speakermode_output
);
FMOD_DSP_GETSPEAKERMODE_FUNC(
    dsp_state,
    speakermode_mixer,
    speakermode_output
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
speakermode_mixer OutOpt
The default speaker mode of the System. (FMOD_SPEAKERMODE)
speakermode_output OutOpt
The output device speaker mode. (FMOD_SPEAKERMODE)

Implementation detail:

If speakermode_mixer and speakermode_output are different then the System is downmixing or upmixing to the speakermode_output format.

See Also: FMOD_DSP_STATE, Upmix/Downmix Behavior

FMOD_DSP_GETUSERDATA_FUNC

Function to get the user data attached to this DSP.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_GETUSERDATA_FUNC(
    FMOD_DSP_STATE *dsp_state,
    void **userdata
);
delegate RESULT DSP_GETUSERDATA_FUNC(
    ref DSP_STATE dsp_state,
    out IntPtr userdata
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
userdata Out
User data set by calling DSP::setUserData or assignment via FMOD_DSP_DESCRIPTION::userdata.

See Also: FMOD_DSP_STATE

FMOD_DSP_LOG_FUNC

Function to write to the FMOD logging system.

C
C++
C#
JS

void F_CALL FMOD_DSP_LOG_FUNC(
    FMOD_DEBUG_FLAGS level,
    const char *file,
    int line,
    const char *function,
    const char *str,
    ...
);
delegate void DSP_LOG_FUNC(
    DEBUG_FLAGS level,
    IntPtr file,
    int line,
    IntPtr function,
    IntPtr str
);

Not supported for JavaScript.

level
Log type or level. (FMOD_DEBUG_FLAGS)
file
Source code file name from where the log is called. (UTF-8 string)
line
Line number in the source code file the function is being called from.
function
Name of the logging function. (UTF-8 string)
str
String to log. (UTF-8 string)

See Also: FMOD_DSP_STATE

FMOD_DSP_METERING_INFO

DSP metering info.

C
C++
C#
JS

typedef struct FMOD_DSP_METERING_INFO {
  int     numsamples;
  float   peaklevel[32];
  float   rmslevel[32];
  short   numchannels;
} FMOD_DSP_METERING_INFO;
struct DSP_METERING_INFO
{
  int     numsamples;
  float[] peaklevel;
  float[] rmslevel;
  short   numchannels;
}
FMOD_DSP_METERING_INFO
{
  numsamples,
  peaklevel,
  rmslevel,
  numchannels,
};
numsamples R/O
Number of samples considered for this metering info.
peaklevel R/O

Peak level per channel.

  • Units: Linear
rmslevel R/O

Rms level per channel.

  • Units: Linear
numchannels R/O
Number of channels.

See Also: FMOD_SPEAKER, DSP::getMeteringInfo

FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC

Function to calculate distance attenuation.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_DSP_PAN_3D_ROLLOFF_TYPE rolloff,
    float distance,
    float mindistance,
    float maxdistance,
    float *gain
);
delegate RESULT DSP_PAN_GETROLLOFFGAIN_FUNC(
    ref DSP_STATE dsp_state,
    DSP_PAN_3D_ROLLOFF_TYPE rolloff,
    float distance,
    float mindistance,
    float maxdistance,
    out float gain
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
rolloff
Rolloff type to apply to distance attenuation calculation. (FMOD_DSP_PAN_3D_ROLLOFF_TYPE)
distance

The distance from the DSP's position.

mindistance

Distance from the source where attenuation begins.

maxdistance

Distance from the source where attenuation ends.

gain Out

Gain modifier applied to signal at provided distance.

  • Units: Linear

See Also: FMOD_DSP_STATE

FMOD_DSP_PAN_SUMMONOMATRIX_FUNC

Function to calculate a mix matrix that downmixes the source speaker mode to mono.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_SUMMONOMATRIX_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_SPEAKERMODE sourceSpeakerMode,
    float lowFrequencyGain,
    float overallGain,
    float *matrix
);
delegate RESULT DSP_PAN_SUMMONOMATRIX_FUNC(
    ref DSP_STATE dsp_state,
    int sourceSpeakerMode,
    float lowFrequencyGain,
    float overallGain,
    IntPtr matrix
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
sourceSpeakerMode
The input speaker mode of to create a mono mix matrix for. (FMOD_SPEAKERMODE)
lowFrequencyGain

Gain modifier to apply just to the LFE channel.

  • Units: Linear
overallGain

Gain modifier to apply to each channel, including the LFE channel.

  • Units: Linear
matrix Out
Calculated mono mix matrix based on the given parameters.

See Also: FMOD_DSP_STATE, System::getSpeakerModeChannels, ChannelControl::setMixMatrix, Upmix/Downmix Behavior

FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC

Function to calculate a mix matrix that upmixes from mono to the target speaker mode.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_SPEAKERMODE targetSpeakerMode,
    float direction,
    float extent,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    float *matrix
);
delegate RESULT DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC(
    ref DSP_STATE dsp_state,
    int targetSpeakerMode,
    float direction,
    float extent,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    IntPtr matrix
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
targetSpeakerMode
The output speaker mode to create a mix matrix for. (FMOD_SPEAKERMODE)
direction

Angle from center point of panning circle where 0 is front center and -180 or +180 is rear speakers center point.

  • Units: Degrees
  • Range: [-180, 180]
extent

The amount the signal will be spread across the panning circle relative to direction, where 0 is not at all and 360 is spread between all speakers.

  • Units: Degrees
  • Range: [0, 360]
lowFrequencyGain

Gain modifier to apply just to the LFE channel.

  • Units: Linear
overallGain

Gain modifier to apply to each channel, including the LFE channel.

  • Units: Linear
matrixHop

The number of source channels in the matrix.

matrix Out
Calculated surround mix matrix based on the given parameters.

See Also: FMOD_DSP_STATE, ChannelControl::setMixMatrix, Upmix/Downmix Behavior

FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC

Function to calculate a mix matrix that downmixes from the source speaker mode to stereo.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_SPEAKERMODE sourceSpeakerMode,
    float pan,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    float *matrix
);
delegate RESULT DSP_PAN_SUMSTEREOMATRIX_FUNC(
    ref DSP_STATE dsp_state,
    int sourceSpeakerMode,
    float pan,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    IntPtr matrix
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
sourceSpeakerMode
The input speaker mode to create a stereo mix matrix for. (FMOD_SPEAKERMODE)
pan

The amount the signal will be spread across the left and right channels, where -100 is 100% left, and 100 is 100% right.

  • Units: Percentage
  • Range: [-100, 100]
lowFrequencyGain

Gain modifier to apply just to the LFE channel.

  • Units: Linear
overallGain

Gain modifier to apply to each channel, including the LFE channel.

  • Units: Linear
matrixHop

The number of source channels in the matrix.

matrix Out
Calculated stereo mix matrix based on the given parameters.

See Also: FMOD_DSP_STATE, ChannelControl::setMixMatrix, Upmix/Downmix Behavior

FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC

Function to calculate a mix matrix that upmixes from stereo to the target speaker mode.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC(
    FMOD_DSP_STATE *dsp_state,
     FMOD_SPEAKERMODE targetSpeakerMode,
     float direction,
     float extent,
     float rotation,
     float lowFrequencyGain,
     float overallGain,
     int matrixHop,
     float *matrix
);
delegate RESULT DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC(
    ref DSP_STATE dsp_state,
    int targetSpeakerMode,
    float direction,
    float extent,
    float rotation,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    IntPtr matrix
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
targetSpeakerMode
The target speaker mode to create a mix matrix for. (FMOD_SPEAKERMODE)
direction

Angle from center point of panning circle where 0 is front center and -180 or +180 is rear speakers center point.

  • Units: Degrees
  • Range: [-180, 180]
extent

The amount the signal will be spread across the panning circle relative to direction, where 0 is not at all and 360 is spread between all speakers.

  • Units: Degrees
  • Range: [0, 360]
rotation

The rotation of the channels from their original mapping, contained within the extent.

  • Units: Degrees
  • Range: [-180, 180]
lowFrequencyGain

Gain modifier to apply just to the LFE channel.

  • Units: Linear
overallGain

Gain modifier to apply to each channel, including the LFE channel.

  • Units: Linear
matrixHop

The number of source channels in the matrix.

matrix Out
Calculated surround mix matrix based on the given parameters.

See Also: FMOD_DSP_STATE, ChannelControl::setMixMatrix

FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC

Function to calculate a mix matrix that upmixes or downmixes from the source speaker mode to the target speaker mode.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC(
    FMOD_DSP_STATE *dsp_state,
    FMOD_SPEAKERMODE sourceSpeakerMode,
    FMOD_SPEAKERMODE targetSpeakerMode,
    float direction,
    float extent,
    float rotation,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    float *matrix,
    FMOD_DSP_PAN_SURROUND_FLAGS flags
);
delegate RESULT DSP_PAN_SUMSURROUNDMATRIX_FUNC(
    ref DSP_STATE dsp_state,
    int sourceSpeakerMode,
    int targetSpeakerMode,
    float direction,
    float extent,
    float rotation,
    float lowFrequencyGain,
    float overallGain,
    int matrixHop,
    IntPtr matrix,
    DSP_PAN_SURROUND_FLAGS flags
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
sourceSpeakerMode
The input speaker mode of the mix matrix to calculate. (FMOD_SPEAKERMODE)
targetSpeakerMode
The output speaker mode of the mix matrix to calculate. (FMOD_SPEAKERMODE)
direction

Angle from center point of panning circle where 0 is front center and -180 or +180 is rear speakers center point.

  • Units: Degrees
  • Range: [-180, 180]
extent

The amount the signal will be spread across the panning circle relative to direction, where 0 is not at all and 360 is spread between all speakers.

  • Units: Degrees
  • Range: [0, 360]
rotation

The rotation of the channels from their original mapping, contained within the extent.

  • Units: Degrees
  • Range: [-180, 180]
lowFrequencyGain

Gain modifier to apply just to the LFE channel.

  • Units: Linear
overallGain

Gain modifier to apply to each channel, including the LFE channel.

  • Units: Linear
matrixHop

The number of source channels in the matrix.

matrix Out
Calculated surround mix matrix based on the given parameters.

See Also: FMOD_DSP_STATE, ChannelControl::setMixMatrix

FMOD_DSP_PAN_SURROUND_FLAGS

Flags for the FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC function.

C
C++
C#
JS

typedef enum FMOD_DSP_PAN_SURROUND_FLAGS {
  FMOD_DSP_PAN_SURROUND_DEFAULT,
  FMOD_DSP_PAN_SURROUND_ROTATION_NOT_BIASED
} FMOD_DSP_PAN_SURROUND_FLAGS;
enum DSP_PAN_SURROUND_FLAGS
{
  DEFAULT,
  ROTATION_NOT_BIASED,
}
DSP_PAN_SURROUND_DEFAULT
DSP_PAN_SURROUND_ROTATION_NOT_BIASED
FMOD_DSP_PAN_SURROUND_DEFAULT
Output channel rotations are spread across the panning circle based on speaker positions.
FMOD_DSP_PAN_SURROUND_ROTATION_NOT_BIASED
Output channel rotations are spread evenly across the panning circle.

See Also: FMOD_DSP_STATE_PAN_FUNCTIONS

FMOD_DSP_PARAMETER_3DATTRIBUTES

3D attributes data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES {
  FMOD_3D_ATTRIBUTES   relative;
  FMOD_3D_ATTRIBUTES   absolute;
} FMOD_DSP_PARAMETER_3DATTRIBUTES;
struct DSP_PARAMETER_3DATTRIBUTES
{
  _3D_ATTRIBUTES relative;
  _3D_ATTRIBUTES absolute;
}
FMOD_DSP_PARAMETER_3DATTRIBUTES
{
  relative,
  absolute,
}
relative
Position of the sound relative to the listener. (FMOD_3D_ATTRIBUTES)
absolute
Position of the sound in world coordinates. (FMOD_3D_ATTRIBUTES)

The FMOD::Studio::System sets this parameter automatically when an FMOD::Studio::EventInstance position changes. However, if you are using the core FMOD::System and not the FMOD::Studio::System, you must set this DSP parameter explicitly.

Attributes must use a coordinate system with the positive Y axis being up and the positive X axis being right. The FMOD Engine converts passed-in coordinates to left-handed for the plug-in if the system was initialized with the FMOD_INIT_3D_RIGHTHANDED flag.

When using a listener attenuation position, the direction of the relative attributes will be relative to the listener position and the length will be the distance to the attenuation position.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, Studio::System::setListenerAttributes, Controlling a Spatializer DSP.

FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI

3D attributes data structure for multiple listeners.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI {
  int                  numlisteners;
  FMOD_3D_ATTRIBUTES   relative[FMOD_MAX_LISTENERS];
  float                weight[FMOD_MAX_LISTENERS];
  FMOD_3D_ATTRIBUTES   absolute;
} FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI;
struct DSP_PARAMETER_3DATTRIBUTES_MULTI
{
  int               numlisteners;
  _3D_ATTRIBUTES[]  relative;
  float[]           weight;
  _3D_ATTRIBUTES    absolute;
}
FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI
{
  numlisteners,
};
numlisteners
Number of listeners.
relative
Position of the sound relative to the listeners. (FMOD_3D_ATTRIBUTES)
weight
Weighting of the listeners where 0 means listener has no contribution and 1 means full contribution.
absolute
Position of the sound in world coordinates. (FMOD_3D_ATTRIBUTES)

The FMOD::Studio::System sets this parameter automatically when an FMOD::Studio::EventInstance position changes. However, if you are using the core API's FMOD::System and not the FMOD::Studio::System, you must set this DSP parameter explicitly.

Attributes must use a coordinate system with the positive Y axis being up and the positive X axis being right. The FMOD Engine converts passed in coordinates to left-handed for the plug-in if the System was initialized with the FMOD_INIT_3D_RIGHTHANDED flag.

When using a listener attenuation position, the direction of the relative attributes will be relative to the listener position and the length will be the distance to the attenuation position.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, Studio::System::setListenerAttributes, Controlling a Spatializer DSP.

FMOD_DSP_PARAMETER_ATTENUATION_RANGE

Attenuation range parameter data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_ATTENUATION_RANGE {
  float   min;
  float   max;
} FMOD_DSP_PARAMETER_ATTENUATION_RANGE;
struct DSP_PARAMETER_ATTENUATION_RANGE
{
  float min;
  float max;
}
FMOD_DSP_PARAMETER_ATTENUATION_RANGE
{
  min,
  max,
};
min R/O
Minimum distance for attenuation.
max R/O
Maximum distance for attenuation.

The FMOD::Studio::System will set this parameter automatically if an FMOD::Studio::EventInstance min or max distance changes.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_DATA_TYPE

Data parameter types.

C
C++
C#
JS

typedef enum FMOD_DSP_PARAMETER_DATA_TYPE {
  FMOD_DSP_PARAMETER_DATA_TYPE_USER = 0,
  FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1,
  FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2,
  FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3,
  FMOD_DSP_PARAMETER_DATA_TYPE_FFT = -4,
  FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5,
  FMOD_DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6,
  FMOD_DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE = -7,
  FMOD_DSP_PARAMETER_DATA_TYPE_FINITE_LENGTH = -8
} FMOD_DSP_PARAMETER_DATA_TYPE;
enum DSP_PARAMETER_DATA_TYPE
{
  DSP_PARAMETER_DATA_TYPE_USER = 0,
  DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1,
  DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2,
  DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3,
  DSP_PARAMETER_DATA_TYPE_FFT = -4,
  DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5,
  DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6,
  DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE = -7,
  DSP_PARAMETER_DATA_TYPE_FINITE_LENGTH = -8
}
FMOD.DSP_PARAMETER_DATA_TYPE_USER = 0
FMOD.DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1
FMOD.DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2
FMOD.DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3
FMOD.DSP_PARAMETER_DATA_TYPE_FFT = -4
FMOD.DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5
FMOD.DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6,
FMOD.DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE = -7
FMOD.DSP_PARAMETER_DATA_TYPE_FINITE_LENGTH = -8
FMOD_DSP_PARAMETER_DATA_TYPE_USER
Default data type. All user data types should be 0 or above.
FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN
Data type for FMOD_DSP_PARAMETER_OVERALLGAIN parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES
Data type for FMOD_DSP_PARAMETER_3DATTRIBUTES parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN
Data type for FMOD_DSP_PARAMETER_SIDECHAIN parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_FFT
Data type for FMOD_DSP_PARAMETER_FFT parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI
Data type for FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE
Data type for FMOD_DSP_PARAMETER_ATTENUATION_RANGE parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE
Data type for FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE parameters. There should be a maximum of one per DSP.
FMOD_DSP_PARAMETER_DATA_TYPE_FINITE_LENGTH
Data type for FMOD_DSP_PARAMETER_FINITE_LENGTH parameters. There should be a maximum of one per DSP.

See Also: FMOD_DSP_PARAMETER_DESC_DATA, DSP::getParameterData, DSP::setParameterData

FMOD_DSP_PARAMETER_DESC

Base structure for DSP parameter descriptions.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DESC {
  FMOD_DSP_PARAMETER_TYPE         type;
  char                            name[16];
  char                            label[16];
  const char                     *description;
  union
  {
      FMOD_DSP_PARAMETER_DESC_FLOAT   floatdesc;
      FMOD_DSP_PARAMETER_DESC_INT     intdesc;
      FMOD_DSP_PARAMETER_DESC_BOOL    booldesc;
      FMOD_DSP_PARAMETER_DESC_DATA    datadesc;
  }
} FMOD_DSP_PARAMETER_DESC;
struct DSP_PARAMETER_DESC
{
  DSP_PARAMETER_TYPE         type;
  char[]                     name;
  char[]                     label;
  string                     description;
  DSP_PARAMETER_DESC_UNION   desc;
}
FMOD_DSP_PARAMETER_DESC
{
  type,
  name,
  label,
  description,
};
type
Parameter type. (FMOD_DSP_PARAMETER_TYPE)
name
Parameter Name.
label
Unit type label.
description
Description of the parameter.
floatdesc
Floating point format description used when type is FMOD_DSP_PARAMETER_TYPE_FLOAT. (FMOD_DSP_PARAMETER_DESC_FLOAT)
intdesc
Integer format description used when type is FMOD_DSP_PARAMETER_TYPE_INT. (FMOD_DSP_PARAMETER_DESC_INT)
booldesc
Boolean format description used when type is FMOD_DSP_PARAMETER_TYPE_BOOL. (FMOD_DSP_PARAMETER_DESC_BOOL)
datadesc
Data format description used when type is FMOD_DSP_PARAMETER_TYPE_DATA. (FMOD_DSP_PARAMETER_DESC_DATA)

See Also: System::createDSP, DSP::setParameterFloat, DSP::getParameterFloat, DSP::setParameterInt, DSP::getParameterInt, DSP::setParameterBool, DSP::getParameterBool, DSP::setParameterData, DSP::getParameterData, FMOD_DSP_PARAMETER_DESC_FLOAT, FMOD_DSP_PARAMETER_DESC_INT, FMOD_DSP_PARAMETER_DESC_BOOL, FMOD_DSP_PARAMETER_DESC_DATA, FMOD_DSP_PARAMETER_DATA_TYPE

FMOD_DSP_PARAMETER_DESC_BOOL

Boolean parameter description.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DESC_BOOL {
  FMOD_BOOL            defaultval;
  const char* const*   valuenames;
} FMOD_DSP_PARAMETER_DESC_BOOL;
struct DSP_PARAMETER_DESC_BOOL
{
  bool      defaultval;
  IntPtr    valuenames;
}
FMOD_DSP_PARAMETER_DESC_BOOL
{
  defaultval,
};
defaultval

Default parameter value.

  • Units: Boolean
valuenames Opt
Names for false and true, respectively (UTF-8 string). There should be two strings.

See Also: System::createDSP, DSP::setParameterBool, DSP::getParameterBool, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_DESC_DATA

Data parameter description.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DESC_DATA {
  int   datatype;
} FMOD_DSP_PARAMETER_DESC_DATA;
struct DSP_PARAMETER_DESC_DATA
{
  int   datatype;
}
FMOD_DSP_PARAMETER_DESC_DATA
{
  datatype,
};
datatype
Type of data.

See Also: System::createDSP, DSP::setParameterData, DSP::getParameterData, FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_DESC_FLOAT

Float parameter description.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DESC_FLOAT {
  float                              min;
  float                              max;
  float                              defaultval;
  FMOD_DSP_PARAMETER_FLOAT_MAPPING   mapping;
} FMOD_DSP_PARAMETER_DESC_FLOAT;
struct DSP_PARAMETER_DESC_FLOAT
{
  float                       min;
  float                       max;
  float                       defaultval;
  DSP_PARAMETER_FLOAT_MAPPING mapping;
}
FMOD_DSP_PARAMETER_DESC_FLOAT
{
  min,
  max,
  defaultval,
};
min
Minimum value.
max
Maximum value.
defaultval
Default value.
mapping
How the values are distributed across dials and automation curves. (FMOD_DSP_PARAMETER_FLOAT_MAPPING)

See Also: System::createDSP, DSP::setParameterFloat, DSP::getParameterFloat, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_DESC_INT

Integer parameter description.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DESC_INT {
  int                  min;
  int                  max;
  int                  defaultval;
  FMOD_BOOL            goestoinf;
  const char* const*   valuenames;
} FMOD_DSP_PARAMETER_DESC_INT;
struct DSP_PARAMETER_DESC_INT
{
  int    min;
  int    max;
  int    defaultval;
  bool   goestoinf;
  IntPtr valuenames;
}
FMOD_DSP_PARAMETER_DESC_INT
{
  min,
  max,
  defaultval,
  goestoinf,
};
min
Minimum value.
max
Maximum value.
defaultval
Default value.
goestoinf

Whether the last value represents infinity.

  • Units: Boolean
valuenames Opt
Names for each value (UTF-8 string). There should be as many strings as there are possible values (max - min + 1).

See Also: System::createDSP, DSP::setParameterInt, DSP::getParameterInt, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE

Dynamic response data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE {
  int     numchannels;
  float   rms[32];
} FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE;
struct DSP_PARAMETER_DYNAMIC_RESPONSE
{
  int numchannels;
  float[] rms;
}
DSP_PARAMETER_DYNAMIC_RESPONSE
{
  numchannels,
  rms,
}
numchannels R/O
The number of channels recorded in the rms array.
rms R/O

The RMS (Root Mean Square) averaged gain factor applied per channel for the last processed block of audio.

  • Units: Linear

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, FMOD_DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE

FMOD_DSP_PARAMETER_FFT

FFT parameter data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_FFT {
  int     length;
  int     numchannels;
  float   *spectrum[32];
} FMOD_DSP_PARAMETER_FFT;
struct DSP_PARAMETER_FFT
{
  int       length;
  int       numchannels;
  float[][] spectrum;
  void getSpectrum(ref float[][] buffer);
  void getSpectrum(int channel, ref float[] buffer);
}
FMOD_DSP_PARAMETER_FFT
{
  length,
  numchannels,
  spectrum
};
length R/O
Number of entries in this spectrum window. Divide this by the output rate to get the hz per entry.
numchannels R/O
Number of channels in spectrum.
spectrum R/O
Per channel spectrum arrays. See remarks for more.
getSpectrum C#
Fill the provided buffer with the spectrum data to avoid garbage collection.
getSpectrum C#
Fill the provided buffer with the spectrum data for the specified channel to avoid garbage collection.

Notes on the spectrum data member. Values inside the float buffer are typically between 0 and 1.0.

Each top level array represents one PCM channel of data.

Address data as spectrum[channel][bin]. A bin is 1 fft window entry.

Only read/display half of the buffer typically for analysis as the 2nd half is usually the same data reversed due to the nature of the way FFT works.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, FMOD_DSP_PARAMETER_DATA_TYPE_FFT, FMOD_DSP_TYPE, FMOD_DSP_FFT

FMOD_DSP_PARAMETER_FINITE_LENGTH

Length data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_FINITE_LENGTH
{
  FMOD_BOOL finite;
} FMOD_DSP_PARAMETER_FINITE_LENGTH;
struct DSP_PARAMETER_FINITE_LENGTH
{
  int finite;
}
DSP_PARAMETER_FINITE_LENGTH
{
  finite,
}
finite R/O

Whether the DSP's playback length is finite.

  • Units: Boolean

This data structure is used by the Studio API to detect whether the DSP will stop by itself or continue playing forever.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, FMOD_DSP_PARAMETER_DATA_TYPE_FINITE_LENGTH

FMOD_DSP_PARAMETER_FLOAT_MAPPING

Structure to define a mapping for a DSP unit's float parameter.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING {
  FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE               type;
  FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR   piecewiselinearmapping;
} FMOD_DSP_PARAMETER_FLOAT_MAPPING;
struct DSP_PARAMETER_FLOAT_MAPPING
{
  DSP_PARAMETER_FLOAT_MAPPING_TYPE type;
  DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping;
}
FMOD_DSP_PARAMETER_FLOAT_MAPPING
{
  type,
  piecewiselinearmapping
};
type
Mapping type (FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE)
piecewiselinearmapping
Piecewise linear mapping type. (FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR)

See Also: FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE, FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR, FMOD_DSP_PARAMETER_DESC_FLOAT

FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR

Structure to define a piecewise linear mapping.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR {
  int     numpoints;
  float   *pointparamvalues;
  float   *pointpositions;
} FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR;
struct DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR
{
  int numpoints;
  IntPtr pointparamvalues;
  IntPtr pointpositions;
}
FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR
{
  numpoints,
};
numpoints
Number of pairs in the piecewise mapping (at least 2).
pointparamvalues
Values in the parameter's units for each point
pointpositions
Positions along the control's scale (e.g. dial angle) corresponding to each parameter value. The range of this scale is arbitrary and all positions will be relative to the minimum and maximum values (e.g. [0,1,3] is equivalent to [1,2,4] and [2,4,8]). If this array is zero, pointparamvalues will be distributed with equal spacing.

See Also: FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE, FMOD_DSP_PARAMETER_FLOAT_MAPPING

FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE

DSP float parameter mappings. These determine how values are mapped across dials and automation curves.

C
C++
C#
JS

typedef enum FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE {
  FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR,
  FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO,
  FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR
} FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE;
enum DSP_PARAMETER_FLOAT_MAPPING_TYPE
{
  DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR = 0,
  DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO,
  DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR,
}
FMOD.DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR
FMOD.DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO
FMOD.DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR
FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR
Values mapped linearly across range.
FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO
A mapping is automatically chosen based on range and units. See remarks.
FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR
Values mapped in a piecewise linear fashion defined by FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR.

FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO generates a mapping based on range and units. For example, if the units are in Hertz and the range is with-in the audio spectrum, a Bark scale will be chosen. Logarithmic scales may also be generated for ranges above zero spanning several orders of magnitude.

See Also: FMOD_DSP_PARAMETER_FLOAT_MAPPING

FMOD_DSP_PARAMETER_OVERALLGAIN

Overall gain parameter data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_OVERALLGAIN {
  float   linear_gain;
  float   linear_gain_additive;
} FMOD_DSP_PARAMETER_OVERALLGAIN;
struct DSP_PARAMETER_OVERALLGAIN
{
  float linear_gain;
  float linear_gain_additive;
}
FMOD_DSP_PARAMETER_OVERALLGAIN
{
  linear_gain,
  linear_gain_additive,
};
linear_gain R/O
Overall linear gain of the effect on the direct signal path.
linear_gain_additive R/O
Additive gain for parallel signal paths.

This parameter is read by the system to determine the effect's gain for voice virtualization.

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC, Virtual Voice System.

FMOD_DSP_PARAMETER_SIDECHAIN

Side chain parameter data structure.

C
C++
C#
JS

typedef struct FMOD_DSP_PARAMETER_SIDECHAIN {
  FMOD_BOOL   sidechainenable;
} FMOD_DSP_PARAMETER_SIDECHAIN;
struct DSP_PARAMETER_SIDECHAIN
{
  int sidechainenable;
}
FMOD_DSP_PARAMETER_SIDECHAIN
{
  sidechainenable,
};
sidechainenable

Whether sidechains are enabled.

  • Units: Boolean

See Also: FMOD_DSP_PARAMETER_DATA_TYPE, FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PARAMETER_TYPE

DSP parameter types.

C
C++
C#
JS

typedef enum FMOD_DSP_PARAMETER_TYPE {
  FMOD_DSP_PARAMETER_TYPE_FLOAT,
  FMOD_DSP_PARAMETER_TYPE_INT,
  FMOD_DSP_PARAMETER_TYPE_BOOL,
  FMOD_DSP_PARAMETER_TYPE_DATA,
  FMOD_DSP_PARAMETER_TYPE_MAX
} FMOD_DSP_PARAMETER_TYPE;
enum DSP_PARAMETER_TYPE
{
  FLOAT = 0,
  INT,
  BOOL,
  DATA,
  MAX
}
FMOD.DSP_PARAMETER_TYPE_FLOAT
FMOD.DSP_PARAMETER_TYPE_INT
FMOD.DSP_PARAMETER_TYPE_BOOL
FMOD.DSP_PARAMETER_TYPE_DATA
FMOD.DSP_PARAMETER_TYPE_MAX
FMOD_DSP_PARAMETER_TYPE_FLOAT
FMOD_DSP_PARAMETER_DESC will use the FMOD_DSP_PARAMETER_DESC_FLOAT.
FMOD_DSP_PARAMETER_TYPE_INT
FMOD_DSP_PARAMETER_DESC will use the FMOD_DSP_PARAMETER_DESC_INT.
FMOD_DSP_PARAMETER_TYPE_BOOL
FMOD_DSP_PARAMETER_DESC will use the FMOD_DSP_PARAMETER_DESC_BOOL.
FMOD_DSP_PARAMETER_TYPE_DATA
FMOD_DSP_PARAMETER_DESC will use the FMOD_DSP_PARAMETER_DESC_DATA.
FMOD_DSP_PARAMETER_TYPE_MAX
Maximum number of DSP parameter types.

See Also: FMOD_DSP_PARAMETER_DESC

FMOD_DSP_PROCESS_CALLBACK

Process callback.

This callback receives an input signal, and allows the user to filter or process the data and write it to the output. This is an alternative to the FMOD_DSP_READ_CALLBACK and FMOD_DSP_SHOULDIPROCESS_CALLBACK.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_PROCESS_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  unsigned int length,
  const FMOD_DSP_BUFFER_ARRAY *inbufferarray,
  FMOD_DSP_BUFFER_ARRAY *outbufferarray,
  FMOD_BOOL inputsidle,
  FMOD_DSP_PROCESS_OPERATION op
);
delegate RESULT DSP_PROCESS_CALLBACK
(
  ref DSP_STATE dsp_state,
  uint length,
  ref DSP_BUFFER_ARRAY inbufferarray,
  ref DSP_BUFFER_ARRAY outbufferarray,
  bool inputsidle,
  DSP_PROCESS_OPERATION op
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
length

Length of the incoming and outgoing buffer.

  • Units: Samples
inbufferarray
Description of the incoming signal. (FMOD_DSP_BUFFER_ARRAY)
outbufferarray
Description of the outgoing signal. (FMOD_DSP_BUFFER_ARRAY)
inputsidle

This is true if no audio is being fed to this unit.

  • Units: Boolean
op
Operation type. (FMOD_DSP_PROCESS_OPERATION)

Invoked by:

For a process update to be called it would have to be enabled, and this is done with DSP::setActive. If ChannelControl::addDSP is used the unit is automatically set to active.

Implementation Detail:

This callback can be used to specify the output channel format at runtime rather than create time, and also supports multiple input/output buffers.

This callback will be called twice per mix as it has a dual purpose. Once will be with op = FMOD_DSP_PROCESS_QUERY, and then depending on the return value of the query, if it is FMOD_OK it will call it again with FMOD_DSP_PROCESS_PERFORM.

Return FMOD_ERR_DSP_SILENCE if the effect is generating silence, so FMOD's mixer can optimize the signal path and not process it any more.

Example:

The following example demonstrates how to copy the input buffer to the output buffer at half volume inside a DSP process callback:

FMOD_RESULT F_CALL Process(FMOD_DSP_STATE *dsp_state, unsigned int length, const FMOD_DSP_BUFFER_ARRAY *inbufferarray, FMOD_DSP_BUFFER_ARRAY *outbufferarray, FMOD_BOOL inputsidle, FMOD_DSP_PROCESS_OPERATION op)
{
    if (op == FMOD_DSP_PROCESS_QUERY)
    {
        if (outbufferarray && inbufferarray)
        {
            if (outbufferarray[0].buffernumchannels[0] != inbufferarray[0].buffernumchannels[0])
            {
                FMOD_ERR_DSP_SILENCE;
            }
        }
        if (inputsidle)
        {
            return FMOD_ERR_DSP_DONTPROCESS;
        }
    }
    else
    {
        int numchannels = outbufferarray[0].buffernumchannels[0];
        float *input = inbufferarray[0].buffers[0];
        float *output = outbufferarray[0].buffers[0];

        for (unsigned int sample = 0; sample < length; sample++)
        {
            for (int channel = 0; channel < numchannels; channel++)
            {
                output[sample * numchannels + channel] = input[sample * numchannels + channel] * 0.5f;
            }
        }
    }

    return FMOD_OK;
}
[AOT.MonoPInvokeCallback(typeof(FMOD.DSP_PROCESS_CALLBACK))]
static RESULT Process(ref DSP_STATE dsp_state, uint length, ref DSP_BUFFER_ARRAY inbufferarray, ref DSP_BUFFER_ARRAY outbufferarray, bool inputsidle, DSP_PROCESS_OPERATION op)
{
    if (op == DSP_PROCESS_OPERATION.PROCESS_QUERY)
    {
        if (inbufferarray.numchannels != outbufferarray.numchannels)
        {
            return RESULT.ERR_DSP_SILENCE;
        }
        if (inputsidle)
        {
            return RESULT.ERR_DSP_DONTPROCESS;
        }
    }
    else if (op == DSP_PROCESS_OPERATION.PROCESS_PERFORM)
    {
        int numchannels = outbufferarray.numchannels;
        float[] input = new float[length * numchannels];
        float[] output = new float[length * numchannels];

        Marshal.Copy(inbufferarray.buffer, input, 0, (int)length * numchannels);

        for (int sample = 0; sample < length; sample++)
        {
            for (int channel = 0; channel < numchannels; channel++)
            {
                output[sample * numchannels + channel] = input[sample * numchannels + channel] * 0.5f;
            }
        }

        Marshal.Copy(output, 0, outbufferarray.buffer, (int)length * numchannels);
    }

    return RESULT.OK;
}

Not supported for JavaScript.

See Also: FMOD_DSP_READ_CALLBACK, FMOD_DSP_SHOULDIPROCESS_CALLBACK, FMOD_DSP_DESCRIPTION

FMOD_DSP_PROCESS_OPERATION

Process operation type.

C
C++
C#
JS

typedef enum FMOD_DSP_PROCESS_OPERATION {
  FMOD_DSP_PROCESS_PERFORM,
  FMOD_DSP_PROCESS_QUERY
} FMOD_DSP_PROCESS_OPERATION;
enum DSP_PROCESS_OPERATION
{
  PROCESS_PERFORM = 0,
  PROCESS_QUERY
}

Not supported for JavaScript.

FMOD_DSP_PROCESS_PERFORM
Process the incoming audio in inbufferarray and output to outbufferarray.
FMOD_DSP_PROCESS_QUERY
The DSP is being queried for the expected output format and whether it needs to process audio or should be bypassed. The function should return FMOD_OK, or FMOD_ERR_DSP_DONTPROCESS or FMOD_ERR_DSP_SILENCE if audio can pass through unprocessed. See remarks for more. If audio is to be processed, outbufferarray must be filled with the expected output format, channel count and mask.

A process callback will be called twice per mix for a DSP unit. Once with the FMOD_DSP_PROCESS_QUERY command, then conditionally, FMOD_DSP_PROCESS_PERFORM.

FMOD_DSP_PROCESS_QUERY is to be handled only by filling out the outbufferarray information, and returning a relevant return code.

It should not really do any logic besides checking and returning one of the following codes:

If audio is to be processed, outbufferarray must be filled with the expected output format, channel count and mask. Mask can be 0.

FMOD_DSP_PROCESS_PERFORM is to be handled by reading the data from the input, processing it, and writing it to the output. Always write to the output buffer and fill it fully to avoid unpredictable audio output.

Always return FMOD_OK, the return value is ignored from the process stage.

See Also: FMOD_DSP_PROCESS_CALLBACK, FMOD_DSP_DESCRIPTION

FMOD_DSP_READ_CALLBACK

DSP read callback.

This callback receives an input signal and allows the user of the plug-in to filter or process the data and write it to the output.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_READ_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  float *inbuffer,
  float *outbuffer,
  unsigned int length,
  int inchannels,
  int *outchannels
);
delegate RESULT DSP_READ_CALLBACK
(
  ref DSP_STATE dsp_state,
  IntPtr inbuffer,
  IntPtr outbuffer,
  uint length,
  int inchannels,
  ref int outchannels
);
function FMOD_DSP_READ_CALLBACK(
    dsp_state,
    inbuffer,
    outbuffer,
    length,
    inchannels,
    outchannels
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
inbuffer
Incoming floating point -1.0 to +1.0 ranged data. Data will be interleaved if inchannels is greater than 1.
outbuffer
Outgoing floating point -1.0 to +1.0 ranged data. The DSP writer must write to this pointer else there will be silence. Data must be interleaved if outchannels is greater than 1.
length

Length of the incoming and outgoing buffers.

  • Units: Samples
inchannels
Number of channels of interleaved PCM data in the inbuffer parameter. Example: 1 = mono, 2 = stereo, 6 = 5.1.
outchannels
Number of channels of interleaved PCM data in the outbuffer parameter. Example: 1 = mono, 2 = stereo, 6 = 5.1.

Invoked by:

For a read update to be called it would have to be enabled, and this is done with DSP::setActive. If ChannelControl::addDSP is used the unit is automatically set to active.

Implementation Detail:

The range of -1 to 1 is a soft limit. In the case of the inbuffer it is not guaranteed to be in that range, and in the case of the outbuffer FMOD will accept values outside that range. However all values will be clamped to the range of -1 to 1 in the final mix.

This callback will not be called if the preceding FMOD_DSP_SHOULDIPROCESS_CALLBACK is returning FMOD_ERR_DSP_DONTPROCESS. Return FMOD_ERR_DSP_SILENCE if the effect is generating silence, so FMOD's mixer can optimize the signal path and not process it any more.

NOTE: Effects that do not stop processing via FMOD_DSP_SHOULDIPROCESS_CALLBACK may keep the signal chain alive when it is not desirable to do so. FMOD Studio events may return that they are still playing when they should be stopped.

Example:

The following example demonstrates how to copy the input buffer to the output buffer at half volume inside a DSP read callback:

FMOD_RESULT F_CALL Read(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels)
{
    for (unsigned int sample = 0; sample < length; sample++)
    {
        for (int channel = 0; channel < inchannels; channel++)
        {
            outbuffer[sample * *outchannels + channel] = inbuffer[sample * inchannels + channel] * 0.5f;
        }
    }

    return FMOD_OK;
}
[AOT.MonoPInvokeCallback(typeof(FMOD.DSP_READ_CALLBACK))]
static RESULT Read(ref DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels)
{
    float[] input = new float[length * inchannels];
    float[] output = new float[length * outchannels];

    Marshal.Copy(inbuffer, input, 0, (int)length * inchannels);

    for (int sample = 0; sample < length; sample++)
    {
        for (int channel = 0; channel < outchannels; channel++)
        {
            output[sample * outchannels + channel] = input[sample * outchannels + channel] * 0.5f;
        }
    }

    Marshal.Copy(output, 0, outbuffer, (int)length * outchannels);

    return RESULT.OK;
}
function Read(dsp_state, inbuffer, outbuffer, length, inchannels, outchannels)
{
    for (var sample = 0; sample < length; sample++)
    {
        for (var channel = 0; channel < outchannels; channel++)
        {
            let val = FMOD.getValue(inbuffer + (((sample * inchannels) + channel) * 4), 'float') * 0.5;

            FMOD.setValue(outbuffer + (((sample * outchannels) + channel) * 4), val, 'float');
            dsp_state.plugindata.buffer[(sample * outchannels) + channel] = val;
        }
    }

    return FMOD.OK;
}

See Also: FMOD_DSP_SHOULDIPROCESS_CALLBACK, FMOD_DSP_DESCRIPTION, DSP::setActive, FMOD_RESULT

FMOD_DSP_REALLOC_FUNC

Function to reallocate memory using the FMOD memory system.

C
C++
C#
JS

void * F_CALL FMOD_DSP_REALLOC_FUNC(
    void *ptr,
    unsigned int size,
    FMOD_MEMORY_TYPE type,
    const char *sourcestr
);
delegate IntPtr DSP_REALLOC_FUNC(
    IntPtr ptr,
    uint size,
    MEMORY_TYPE type,
    IntPtr sourcestr
);

Not supported for JavaScript.

ptr
Memory location to reallocate.
size

Allocation size.

  • Units: Bytes
type
Memory allocation type. (FMOD_MEMORY_TYPE)
sourcestr
String with the FMOD source code filename and line number in it. Only valid in logging versions of FMOD. (UTF-8 string)

The 'sourcestr' argument can be used via StringWrapper by using FMOD.StringWrapper sourceStr = new FMOD.StringWrapper(sourcestr);

Implementation Detail:

This function is a wrapper used by the system level allocator and can be called from any DSP instance. Returns a pointer to a region of reallocated memory, or 0 on a failure.

See Also: FMOD_DSP_STATE, FMOD_DSP_ALLOC_FUNC, FMOD_DSP_FREE_FUNC

FMOD_DSP_RELEASE_CALLBACK

DSP release callback.

This callback is called when the user of the plug-in releases a DSP unit instance.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_RELEASE_CALLBACK(
  FMOD_DSP_STATE *dsp_state
);
delegate RESULT DSP_RELEASE_CALLBACK
(
  ref DSP_STATE dsp_state
);
function FMOD_DSP_RELEASE_CALLBACK(
    dsp_state,
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)

Invoked by:

Implementation Detail:

This callback is typically used to free any resources allocated during the course of the lifetime of the DSP instance or perform any shut down code needed to clean up the DSP unit.

See Also: FMOD_DSP_DESCRIPTION, FMOD_DSP_CREATE_CALLBACK

FMOD_DSP_RESET_CALLBACK

DSP reset callback.

This callback function is called to allow a DSP effect to reset its internal state.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_RESET_CALLBACK(
  FMOD_DSP_STATE *dsp_state
);
delegate RESULT DSP_RESET_CALLBACK
(
  ref DSP_STATE dsp_state
)
function FMOD_DSP_RESET_CALLBACK(
    dsp_state,
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)

Invoked by:

This callback is called on all plug-ins inside an event whenever the event is started (for example by Studio::EventInstance::start).

It is also useful if (for example) an effect is still holding audio data for a sound that has stopped, and is being relocated to a new sound. Resetting the unit would clear any buffers and get it ready for new sound data.

Note that this callback should not change any public parameters that are exposed via FMOD_DSP_DESCRIPTION::paramdesc, but should instead reset the internal state to match the public parameter values.

See Also: FMOD_DSP_DESCRIPTION

FMOD_DSP_SETPARAM_BOOL_CALLBACK

Set boolean parameter callback.

This callback is called when the user of the plug-in wants to set a boolean parameter for a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SETPARAM_BOOL_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  FMOD_BOOL value
);
delegate RESULT DSP_SETPARAM_BOOL_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  bool value
);
function FMOD_DSP_SETPARAM_BOOL_CALLBACK(
    dsp_state,
    index,
    value
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value

Parameter value.

  • Units: Boolean

Invoked by:

See Also: DSP::getParameterBool, FMOD_DSP_DESCRIPTION, FMOD_DSP_GETPARAM_BOOL_CALLBACK

FMOD_DSP_SETPARAM_DATA_CALLBACK

Set data parameter callback.

This callback is called when the user of the plug-in wants to set a binary data parameter for a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SETPARAM_DATA_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  void *data,
  unsigned int length
);
delegate RESULT DSP_SETPARAM_DATA_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  IntPtr data,
  uint length
);
function FMOD_DSP_SETPARAM_DATA_CALLBACK(
    dsp_state,
    index,
    data,
    length
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
data
Parameter data. Binary data the size of length parameter.
length Opt

Size of the binary data parameter.

  • Units: Bytes

Certain data types are predefined by the system and can be specified via the FMOD_DSP_PARAMETER_DESC_DATA, see FMOD_DSP_PARAMETER_DATA_TYPE

Invoked by:

See Also: DSP::getParameterData, FMOD_DSP_DESCRIPTION, FMOD_DSP_GETPARAM_DATA_CALLBACK

FMOD_DSP_SETPARAM_FLOAT_CALLBACK

Set float parameter callback.

This callback is called when the user wants to set a float parameter for a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SETPARAM_FLOAT_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  float value
);
delegate RESULT DSP_SETPARAM_FLOAT_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  ref float value
);
function FMOD_DSP_SETPARAM_FLOAT_CALLBACK(
    dsp_state,
    index,
    value
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value
Parameter value.

Invoked by:

Range checking is not needed. FMOD will clamp the incoming value to the specified min/max.

See Also: DSP::getParameterFloat, FMOD_DSP_DESCRIPTION, FMOD_DSP_GETPARAM_FLOAT_CALLBACK

FMOD_DSP_SETPARAM_INT_CALLBACK

Set integer parameter callback.

This callback is called when the user of the plug-in wants to set an integer parameter for a DSP unit.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SETPARAM_INT_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int index,
  int value
);
delegate RESULT DSP_SETPARAM_INT_CALLBACK
(
  ref DSP_STATE dsp_state,
  int index,
  int value
);
function FMOD_DSP_SETPARAM_INT_CALLBACK(
    dsp_state,
    index,
    value
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
index
Parameter index.
value
Parameter value.

Invoked by:

Range checking is not needed. FMOD will clamp the incoming value to the specified min/max.

See Also: DSP::setParameterInt, FMOD_DSP_DESCRIPTION, FMOD_DSP_GETPARAM_INT_CALLBACK

FMOD_DSP_SETPOSITION_CALLBACK

DSP set position callback.

This callback is called when the user of the plug-in wants to set a PCM position for a DSP.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SETPOSITION_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  unsigned int pos
);
delegate RESULT DSP_SETPOSITION_CALLBACK
(
  ref DSP_STATE dsp_state,
  uint pos
);
function FMOD_DSP_SETPOSITION_CALLBACK(
    dsp_state,
    pos
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
pos

Target position in the audio signal. (FMOD_TIMEUNIT_PCM).

  • Units: Samples

Invoked by:

This callback is typically used for DSP units that behave as an audio signal with a relative position. This type of callback is only called if the DSP has been played with System::playDSP.

See Also: FMOD_DSP_DESCRIPTION

FMOD_DSP_SHOULDIPROCESS_CALLBACK

DSP 'should I process?' callback.

This callback is called to allow you to tell the FMOD mixer whether the FMOD_DSP_READ_CALLBACK callback should be called or not. This can be used as an optimization to reduce CPU overhead.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SHOULDIPROCESS_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  FMOD_BOOL inputsidle,
  unsigned int length,
  FMOD_CHANNELMASK inmask,
  int inchannels,
  FMOD_SPEAKERMODE speakermode
);
delegate RESULT DSP_SHOULDIPROCESS_CALLBACK
(
  ref DSP_STATE dsp_state,
  bool inputsidle,
  uint length,
  CHANNELMASK inmask,
  int inchannels,
  SPEAKERMODE speakermode
);
function FMOD_DSP_SHOULDIPROCESS_CALLBACK(
    dsp_state,
    inputsidle,
    length,
    inmask,
    inchannels,
    speakermode
)
dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
inputsidle

This is true if no audio is being fed to this unit.

  • Units: Boolean
length

Length of the incoming and outgoing buffer.

  • Units: Samples
inmask
Deprecated. (FMOD_CHANNELMASK)
inchannels
Number of input channels.
speakermode
Speakermode that corresponds to the channel count and channel mask. (FMOD_SPEAKERMODE)

Invoked by:

Implementation Detail:

An example of an effect that would continue processing silence would be an echo or reverb effect that needs to play a tail sound until it fades out to silence. At that point it could return FMOD_ERR_DSP_SILENCE as well.

Typically inmask and speakermode parameters are not important to a plug-in unless it cares about speaker positioning. If it processes any data regardless of channel format coming in, it can safely ignore these two parameters.

If the effect produces silence such as when it is receiving no signal, then FMOD_ERR_DSP_SILENCE can be returned in the FMOD_DSP_SHOULDIPROCESS_CALLBACK callback. If the effect does not modify the sound in any way with the current effect parameter settings, then FMOD_ERR_DSP_DONTPROCESS can be returned.
Either of these return values will cause FMOD's mixer to skip the FMOD_DSP_READ_CALLBACK callback.

NOTE: Effects that do not stop processing may keep the signal chain alive when it is not desirable. In the case of FMOD Studio, it may result in events that keep playing indefinitely.

The following code can be used for DSP effects that have no tail:

static FMOD_RESULT F_CALL shouldIProcess(FMOD_DSP_STATE *dsp_state, bool inputsidle, unsigned int length, FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE speakermode)
{
    if (inputsidle)
    {
        return FMOD_ERR_DSP_SILENCE;
    }
    return FMOD_OK;
}

See Also: FMOD_DSP_READ_CALLBACK, FMOD_DSP_DESCRIPTION, FMOD_RESULT

FMOD_DSP_STATE

DSP plug-in structure that is passed into each callback.

C
C++
C#
JS

typedef struct FMOD_DSP_STATE {
  void                      *instance;
  void                      *plugindata;
  FMOD_CHANNELMASK           channelmask;
  FMOD_SPEAKERMODE           source_speakermode;
  float                     *sidechaindata;
  int                        sidechainchannels;
  FMOD_DSP_STATE_FUNCTIONS   *functions;
  int                        systemobject;
} FMOD_DSP_STATE;
struct DSP_STATE
{
  IntPtr     instance;
  IntPtr     plugindata;
  uint       channelmask;
  int        source_speakermode;
  IntPtr     sidechaindata;
  int        sidechainchannels;
  IntPtr     functions;
  int        systemobject;
}
FMOD_DSP_STATE
{
  instance,
  plugindata,
  channelmask,
  source_speakermode,
  sidechaindata,
  sidechainchannels,
  functions,
  systemobject,
};
instance R/O
Internal instance pointer.
plugindata
Data that the plug-in writer wants to attach to this object.
channelmask R/O
Specifies which speakers the DSP effect is active on. (FMOD_CHANNELMASK)
source_speakermode R/O
Specifies which speaker mode the signal originated. (FMOD_SPEAKERMODE)
sidechaindata R/O
Sidechain mix result.
sidechainchannels R/O
Number of channels in the sidechain buffer.
functions R/O
Struct containing functions to give plug-in developers the ability to query system state and access system level functionality and helpers. (FMOD_DSP_STATE_FUNCTIONS)
systemobject R/O
FMOD::System object index, relating to the System object that created this DSP.

'systemobject' is an integer associated with the system object that created the DSP or registered the DSP plug-in. If there is only one system object, this integer is always 0. If the DSP was created or registered by a second system object, the integer would be 1, and so on.
FMOD_DSP_STATE_FUNCTIONS::getsamplerate/getblocksize/getspeakermode could return different results, so it could be relevant to plug-in developers who want to monitor which object is being used.

Implementation Detail:

Unlike FMOD_DSP_DESCRIPTION::userdata, plugindata cannot be written to by the user, and is an ideal place to store the plug-in's state. The recommended pattern is to create the plugindata inside the FMOD_DSP_CREATE_CALLBACK, free it inside the FMOD_DSP_RELEASE_CALLBACK.

Here is an example of a simple oscillator that uses the plugindata to store the state required to generate a sine wave.

#define TWO_PI (2.0f * 3.14159265358979323846f)

typedef struct
{
    unsigned int step[16];
} dsp_data;

FMOD_RESULT F_CALL Read(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels)
{
    dsp_data *data = (dsp_data *)dsp_state->plugindata;
    int samplerate;
    dsp_state->functions->getsamplerate(dsp_state, &samplerate);

    for (unsigned int sample = 0; sample < length; sample++)
    {
        for (int channel = 0; channel < inchannels; channel++)
        {
            outbuffer[sample * *outchannels + channel] = sinf((440.0f * TWO_PI * data->step[channel]++) / (float)samplerate);
        }
    }

    return FMOD_OK;
}

FMOD_RESULT F_CALL Create(FMOD_DSP_STATE *dsp_state)
{
    dsp_data *data = (dsp_data *)calloc(sizeof(dsp_data), 1);
    if (!data)
    {
        return FMOD_ERR_MEMORY;
    }
    memset(data, 0, sizeof(data));
    dsp_state->plugindata = data;

    return FMOD_OK;
}

FMOD_RESULT F_CALL Release(FMOD_DSP_STATE *dsp_state)
{
    if (dsp_state->plugindata)
    {
        dsp_data *data = (dsp_data *)dsp_state->plugindata;
        free(data);
    }

    return FMOD_OK;
}
class dsp_data
{
    public uint[] step;
}

[AOT.MonoPInvokeCallback(typeof(FMOD.DSP_READ_CALLBACK))]
static RESULT CaptureDSPReadCallback(ref FMOD.DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels)
{
    float[] input = new float[length * inchannels];
    float[] output = new float[length * outchannels];

    GCHandle dataHandle = GCHandle.FromIntPtr(dsp_state.plugindata);
    dsp_data data = dataHandle.Target as dsp_data;

    int samplerate = 0;
    dsp_state.functions.getsamplerate(ref dsp_state, ref samplerate);

    for (int sample = 0; sample < length; sample++)
    {
        for (int channel = 0; channel < outchannels; channel++)
        {
            output[sample * outchannels + channel] = MathF.Sin((440.0f * MathF.PI * 2 * data.step[channel]++) / (float)samplerate);
        }
    }

    Marshal.Copy(output, 0, outbuffer, (int)length * outchannels);

    return RESULT.OK;
}

[AOT.MonoPInvokeCallback(typeof(FMOD.DSP_CREATE_CALLBACK))]
static RESULT CaptureDSPCreateCallback(ref FMOD.DSP_STATE dsp_state)
{
    dsp_data data = new dsp_data();
    data.step = new uint[16];
    dsp_state.plugindata = GCHandle.ToIntPtr(GCHandle.Alloc(data));

    return RESULT.OK;
}

[AOT.MonoPInvokeCallback(typeof(FMOD.DSP_RELEASE_CALLBACK))]
static RESULT CaptureDSPReleaseCallback(ref FMOD.DSP_STATE dsp_state)
{
    GCHandle.FromIntPtr(dsp_state.plugindata).Free();

    return RESULT.OK;
}
function Read(dsp_state, inbuffer, outbuffer, length, inchannels, outchannels)
{
    let outval = {};
    result = dsp_state.functions.getsamplerate(dsp_state, outval);
    CHECK_RESULT(result);

    for (var sample = 0; sample < length; sample++)
    {
        for (var channel = 0; channel < outchannels; channel++)
        {
            let val = Math.sin((440.0 * 2 * Math.PI * dsp_state.plugindata.step[channel]++) / outval.val);
            FMOD.setValue(outbuffer + (((sample * outchannels) + channel) * 4), val, 'float');
        }
    }

    return FMOD.OK;
}

function Create(dsp_state)
{
    dsp_state.plugindata =
    {
        step: []
    };
    for(let i = 0; i < 16; i++)
    {
        dsp_state.plugindata.step[i] = 0;
    }

    return FMOD.OK;
}

function Release(dsp_state)
{
    // No need to clean up memory in js
    return FMOD.OK;
}

See Also: FMOD_DSP_DESCRIPTION, FMOD_DSP_STATE_FUNCTIONS

FMOD_DSP_STATE_DFT_FUNCTIONS

Struct containing DFT functions to enable a plug-in to perform optimized time-frequency domain conversion.

C
C++
C#
JS

typedef struct FMOD_DSP_STATE_DFT_FUNCTIONS {
  FMOD_DSP_DFT_FFTREAL_FUNC    fftreal;
  FMOD_DSP_DFT_IFFTREAL_FUNC   inversefftreal;
} FMOD_DSP_STATE_DFT_FUNCTIONS;
struct DSP_STATE_DFT_FUNCTIONS
{
  DSP_DFT_FFTREAL_FUNC  fftreal;
  DSP_DFT_IFFTREAL_FUNC inversefftreal;
}

Not supported for JavaScript.

fftreal R/O
Function for performing an FFT on a real signal. (FMOD_DSP_DFT_FFTREAL_FUNC)
inversefftreal R/O
Function for performing an inverse FFT to get a real signal. (FMOD_DSP_DFT_IFFTREAL_FUNC)

Implementation Detail:

All function pointers will remain valid for the lifetime of the system.

See Also: FMOD_DSP_STATE_FUNCTIONS, FFT

FMOD_DSP_STATE_FUNCTIONS

Struct containing functions to give plug-in developers the ability to query system state and access system level functionality and helpers.

C
C++
C#
JS

typedef struct FMOD_DSP_STATE_FUNCTIONS {
  FMOD_DSP_ALLOC_FUNC                   alloc;
  FMOD_DSP_REALLOC_FUNC                 realloc;
  FMOD_DSP_FREE_FUNC                    free;
  FMOD_DSP_GETSAMPLERATE_FUNC           getsamplerate;
  FMOD_DSP_GETBLOCKSIZE_FUNC            getblocksize;
  FMOD_DSP_STATE_DFT_FUNCTIONS         *dft;
  FMOD_DSP_STATE_PAN_FUNCTIONS         *pan;
  FMOD_DSP_GETSPEAKERMODE_FUNC          getspeakermode;
  FMOD_DSP_GETCLOCK_FUNC                getclock;
  FMOD_DSP_GETLISTENERATTRIBUTES_FUNC   getlistenerattributes;
  FMOD_DSP_LOG_FUNC                     log;
  FMOD_DSP_GETUSERDATA_FUNC             getuserdata;
} FMOD_DSP_STATE_FUNCTIONS;
struct DSP_STATE_FUNCTIONS
{
  DSP_ALLOC_FUNC                  alloc;
  DSP_REALLOC_FUNC                realloc;
  DSP_FREE_FUNC                   free;
  DSP_GETSAMPLERATE_FUNC          getsamplerate;
  DSP_GETBLOCKSIZE_FUNC           getblocksize;
  IntPtr                          dft;
  IntPtr                          pan;
  DSP_GETSPEAKERMODE_FUNC         getspeakermode;
  DSP_GETCLOCK_FUNC               getclock;
  DSP_GETLISTENERATTRIBUTES_FUNC  getlistenerattributes;
  DSP_LOG_FUNC                    log;
  DSP_GETUSERDATA_FUNC            getuserdata;
}
DSP_STATE_FUNCTIONS
{
  getsamplerate,
  getblocksize,
  getspeakermode
}
alloc R/O
Function to allocate memory using the FMOD memory system. (FMOD_DSP_ALLOC_FUNC)
realloc R/O
Function to reallocate memory using the FMOD memory system. (FMOD_DSP_REALLOC_FUNC)
free R/O
Function to free memory allocated with FMOD_DSP_ALLOC_FUNC. (FMOD_DSP_FREE_FUNC)
getsamplerate R/O
Function to query the system sample rate. (FMOD_DSP_GETSAMPLERATE_FUNC)
getblocksize R/O
Function to query the system block size. DSPs are requested to process blocks of varying length up to this size. (FMOD_DSP_GETBLOCKSIZE_FUNC)
dft R/O
Struct containing DFT functions to enable a plug-in to perform optimized time-frequency domain conversion. (FMOD_DSP_STATE_DFT_FUNCTIONS)
pan R/O
Struct containing panning helper functions for spatialization plug-ins. (FMOD_DSP_STATE_PAN_FUNCTIONS)
getspeakermode R/O
Function to query the system speaker modes. One is the mixer's default speaker mode, the other is the output mode the system is downmixing or upmixing to. (FMOD_DSP_GETSPEAKERMODE_FUNC)
getclock R/O
Function to get the clock of the current DSP, as well as the subset of the input buffer that contains the signal. (FMOD_DSP_GETCLOCK_FUNC)
getlistenerattributes R/O
Callback for getting the absolute listener attributes set via the API (returned as left-handed coordinates). (FMOD_DSP_GETLISTENERATTRIBUTES_FUNC)
log R/O
Function to write to the FMOD logging system. (FMOD_DSP_LOG_FUNC)
getuserdata R/O
Function to get the user data attached to this DSP. See FMOD_DSP_DESCRIPTION::userdata. (FMOD_DSP_GETUSERDATA_FUNC)

Implementation Detail:

All function pointers will remain valid for the lifetime of the system.

See Also: FMOD_DSP_STATE, FMOD_DSP_STATE_DFT_FUNCTIONS, FMOD_DSP_STATE_PAN_FUNCTIONS

FMOD_DSP_STATE_PAN_FUNCTIONS

Struct containing panning helper functions for spatialization plug-ins.

C
C++
C#
JS

typedef struct FMOD_DSP_STATE_PAN_FUNCTIONS {
  FMOD_DSP_PAN_SUMMONOMATRIX_FUNC               summonomatrix;
  FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC             sumstereomatrix;
  FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC           sumsurroundmatrix;
  FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC     summonotosurroundmatrix;
  FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC   sumstereotosurroundmatrix;
  FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC              getrolloffgain;
} FMOD_DSP_STATE_PAN_FUNCTIONS;
struct DSP_STATE_PAN_FUNCTIONS
{
  DSP_PAN_SUMMONOMATRIX_FUNC             summonomatrix;
  DSP_PAN_SUMSTEREOMATRIX_FUNC           sumstereomatrix;
  DSP_PAN_SUMSURROUNDMATRIX_FUNC         sumsurroundmatrix;
  DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC   summonotosurroundmatrix;
  DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC sumstereotosurroundmatrix;
  DSP_PAN_GETROLLOFFGAIN_FUNC            getrolloffgain;
}

Not supported for JavaScript.

summonomatrix R/O
Function to calculate a mono mix matrix scaled by the gain value. (FMOD_DSP_PAN_SUMMONOMATRIX_FUNC)
sumstereomatrix R/O
Function to calculate a stereo mix matrix with given pan and gain values. (FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC)
sumsurroundmatrix R/O
Function to calculate a surround mix matrix with the given positional information. (FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC)
summonotosurroundmatrix R/O
Function to calculate a surround mix matrix for mono input signals. (FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC)
sumstereotosurroundmatrix R/O
Function to calculate a surround mix matrix for stereo input signals. (FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC)
getrolloffgain R/O
Function to calculate distance attenuation. (FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC)

Implementation Detail:

All function pointers will remain valid for the lifetime of the system.

See Also: FMOD_DSP_STATE_FUNCTIONS, FMOD_DSP_PAN_SURROUND_FLAGS, ChannelControl::setMixMatrix

FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK

System level DSP type deregister callback.

The callback is called as a one time deregistration of a DSP plug-in type, rather than of an individual DSP instance.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK(
  FMOD_DSP_STATE *dsp_state
);
delegate RESULT DSP_SYSTEM_DEREGISTER_CALLBACK
(
  ref DSP_STATE dsp_state
);
function FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK(
    dsp_state
)
dsp_state
A partially-valid DSP plug-in state object with a null instance pointer. (FMOD_DSP_STATE)

Invoked by:

This callback is called after all instances of the plug-in type have been released.

The callback is not associated with any DSP instance, so the instance member of FMOD_DSP_STATE will be 0 / NULL. Only 'systemobject' and 'callbacks' are valid for use.

See Also: FMOD_DSP_DESCRIPTION

FMOD_DSP_SYSTEM_MIX_CALLBACK

System level DSP type mix callback.

The function can be used as a global pre/mid/post mix function for this type of DSP, rather than of an individual DSP instance.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SYSTEM_MIX_CALLBACK(
  FMOD_DSP_STATE *dsp_state,
  int stage
);
delegate RESULT DSP_SYSTEM_MIX_CALLBACK
(
  ref DSP_STATE dsp_state,
  int stage
);
function FMOD_DSP_SYSTEM_MIX_CALLBACK(
    dsp_state,
    stage
)
dsp_state
A partially-valid DSP plug-in state object with a null instance pointer. (FMOD_DSP_STATE)
stage
0 = premix, or before the mixer has executed. 1 = postmix, or after the mix has been executed. 2 = midmix, after clocks calculation before the main mix has occurred.

Invoked by:

The callback is not associated with any DSP instance, so the instance member of FMOD_DSP_STATE will be 0 / NULL. Only 'systemobject' and 'callbacks' are valid for use.
The callback is triggered automatically by the mixer and is not triggered by any API function.

See Also: FMOD_DSP_DESCRIPTION

FMOD_DSP_SYSTEM_REGISTER_CALLBACK

System level DSP type registration callback.

The callback is called as a one time initialization to set up the DSP plug-in type, rather than of an individual DSP instance.

C
C++
C#
JS

FMOD_RESULT F_CALL FMOD_DSP_SYSTEM_REGISTER_CALLBACK(
  FMOD_DSP_STATE *dsp_state
);
delegate RESULT DSP_SYSTEM_REGISTER_CALLBACK
(
  ref DSP_STATE dsp_state
);
function FMOD_DSP_SYSTEM_REGISTER_CALLBACK(
    dsp_state
)
dsp_state
A partially-valid DSP plug-in state object with a null instance pointer. (FMOD_DSP_STATE)

Invoked by:

This callback is called before any instances of the plug-in type have been created.

The callback is not associated with any DSP instance, so the instance member of FMOD_DSP_STATE will be 0 / NULL. Only 'systemobject' and 'callbacks' are valid for use.

See Also: FMOD_DSP_DESCRIPTION

FMOD_PLUGIN_SDK_VERSION

The plug-in SDK version.

C
C++
C#
JS

#define FMOD_PLUGIN_SDK_VERSION   110
FMOD.PLUGIN_SDK_VERSION = 110

Currently not supported for C#.

See Also: FMOD_DSP_DESCRIPTION