FMOD Engine User Manual 2.03

9. Plug-in API Reference | DSP

An interface that manages DSP plug-ins.

System:

Parameter API:




General:





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_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;
}
FMOD_DSP_BUFFER_ARRAY
{
  numbuffers,
  speakermode,
};
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#
Number of channels for the buffer.
buffer C#
Memory for the buffer.

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
);

Not supported for JavaScript.

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_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
DSP name.
version
Plug-in's version number.
numinputbuffers
Number of input buffers to process. Use 0 for DSPs that only generate sound and 1 for effects that process incoming sound.
numoutputbuffers
Number of audio output buffers. Only one output buffer is currently supported.
create Opt
Create callback. This is called when DSP unit is created. Set callback invoked by (FMOD_DSP_CREATE_CALLBACK)
release Opt
Release callback. This is called just before the unit is freed so the user can do any cleanup needed for the unit. Set callback invoked by (FMOD_DSP_RELEASE_CALLBACK)
reset
Reset callback. This is called by the user to reset any history buffers that may need resetting for a filter, when it is to be used or re-used for the first time to its initial clean state. Use to avoid clicks or artifacts. (FMOD_DSP_RESET_CALLBACK)
read Opt
Read callback. Processing is done here. Set callback invoked by (FMOD_DSP_READ_CALLBACK)
process Opt
Process callback. 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. Set callback invoked by (FMOD_DSP_PROCESS_CALLBACK)
setposition Opt
Set position callback. This is called if the unit wants to update its position info but not process data, or reset a cursor position internally if it is reading data from a certain source. Set callback invoked by (FMOD_DSP_SETPOSITION_CALLBACK)
numparameters
Number of parameters used in this filter. The user finds this with DSP::getNumParameters
paramdesc
Variable number of parameter structures. (FMOD_DSP_PARAMETER_DESC)
setparameterfloat Opt
Set callback invoked by DSP::setParameterFloat.(FMOD_DSP_SETPARAM_FLOAT_CALLBACK)
setparameterint Opt
Set callback invoked by DSP::setParameterInt.(FMOD_DSP_SETPARAM_INT_CALLBACK)
setparameterbool Opt
Set callback invoked by DSP::setParameterBool. (FMOD_DSP_SETPARAM_BOOL_CALLBACK)
setparameterdata Opt
Set callback invoked by DSP::setParameterData. (FMOD_DSP_SETPARAM_DATA_CALLBACK)
getparameterfloat Opt
Set callback invoked by DSP::getParameterFloat. (FMOD_DSP_GETPARAM_FLOAT_CALLBACK)
getparameterint Opt
Set callback invoked by DSP::getParameterInt. (FMOD_DSP_GETPARAM_INT_CALLBACK)
getparameterbool Opt
Set callback invoked by DSP::getParameterBool. (FMOD_DSP_GETPARAM_BOOL_CALLBACK)
getparameterdata Opt
Set callback invoked by DSP::getParameterData. (FMOD_DSP_GETPARAM_DATA_CALLBACK)
shouldiprocess
This is called before processing. 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 count down timer to allow effect tails to process before idling! (FMOD_DSP_SHOULDIPROCESS_CALLBACK)
userdata Opt
User data.
sys_register Opt
Register callback. This is called when DSP unit is loaded/registered. Useful for 'global'/per system object init for plug-in. Set callback invoked by (FMOD_DSP_SYSTEM_REGISTER_CALLBACK)
sys_deregister Opt
Deregister callback. This is called when DSP unit is unloaded/deregistered. Useful as 'global'/per system object shutdown for plug-in. Set callback invoked by (FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK)
sys_mix Opt
System mix stage callback. This is called when the mixer starts to execute or is just finishing executing. Useful for 'global'/per system object once a mix update calls for a plug-in. Set callback invoked by (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 independant 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.

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_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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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

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_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_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,
}
FMOD.DSP_PAN_SURROUND_DEFAULT
FMOD.DSP_PAN_SURROUND_ROTATION_NOT_BIASED
FMOD_DSP_PAN_SURROUND_DEFAULT
TBD.
FMOD_DSP_PAN_SURROUND_ROTATION_NOT_BIASED
TBD.

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;
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
}
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_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.

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 infiniy.

  • 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_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.

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
}
FMOD.DSP_PROCESS_PERFORM
FMOD.DSP_PROCESS_QUERY
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 outputarray 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
);

Not supported for JavaScript.

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 preceeding 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 no 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.

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

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
);

Not supported for JavaScript.

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_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
)

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

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
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (FMOD_DSP_STATE)
pos

Target position in channel stream. (FMOD_TIMEUNIT_PCM).

  • Units: Samples

Invoked by:

This callback is typically used for DSP units that behave as an audio stream 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
);

Not supported for JavaScript.

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 plugin 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.

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;
}
FMOD_DSP_STATE_DFT_FUNCTIONS
{
};
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)

See Also: FMOD_DSP_STATE_FUNCTIONS

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
{
};
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)

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;
}
FMOD_DSP_STATE_PAN_FUNCTIONS
{
};
summonomatrix R/O
TBD. (FMOD_DSP_PAN_SUMMONOMATRIX_FUNC)
sumstereomatrix R/O
TBD. (FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC)
sumsurroundmatrix R/O
TBD. (FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC)
summonotosurroundmatrix R/O
TBD. (FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC)
sumstereotosurroundmatrix R/O
TBD. (FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC)
getrolloffgain R/O
TBD. (FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC)

See Also: FMOD_DSP_STATE_FUNCTIONS, FMOD_DSP_PAN_SURROUND_FLAGS

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
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (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
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (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
);

Not supported for JavaScript.

dsp_state
DSP plug-in state. (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

Currently not supported for C#.

See Also: FMOD_DSP_DESCRIPTION