FMOD Engine User Manual 2.03
A digital signal processor is one node within a graph that transforms input audio signals into an output stream.
Create with System::createDSP, System::createDSPByType or System::createDSPByPlugin.
Connections:
Parameters:
Channel format:
Metering:
Processing:
General:
Adds a DSP unit as an input to this object.
FMOD_RESULT DSP::addInput(
DSP *input,
DSPConnection **connection = nullptr,
FMOD_DSPCONNECTION_TYPE type = FMOD_DSPCONNECTION_TYPE_STANDARD
);
Type of connection between the two units. (FMOD_DSPCONNECTION_TYPE)
When a DSP has multiple inputs the signals are automatically mixed together, sent to the unit's output(s).
The returned connection will remain valid until the units are disconnected.
When type is FMOD_DSPCONNECTION_TYPE_PREALLOCATED (or when calling DSP::addInputPreallocated in C#), you should use the connection parameter to provide a valid DSPConnection handle that was created by System::createDSPConnection. In this case, the input will be connected using the provided connection rather than a newly allocated one.
See Also: DSP::getInput, DSP::getNumInputs, DSP::getOutput, DSP::getNumOutputs
Adds a preallocated DSP unit as an input to this object.
FMOD_RESULT DSP::addInputPreallocated(
DSP *input,
DSPConnection **connection = nullptr
);
When a DSP has multiple inputs the signals are automatically mixed together, sent to the unit's output(s).
The returned connection will remain valid until the units are disconnected.
You should use the connection parameter to provide a valid DSPConnection handle that was created by System::createDSPConnection. In this case, the input will be connected using the provided connection rather than a newly allocated one.
See Also: DSP::getInput, DSP::getNumInputs, DSP::getOutput, DSP::getNumOutputs, DSP::addInput
Callback for DSP notifications.
FMOD_RESULT F_CALL FMOD_DSP_CALLBACK(
FMOD_DSP *dsp,
FMOD_DSP_CALLBACK_TYPE type,
void *data
);
The 'dsp' argument can be cast to FMOD::DSP *.
See Also: Callback Behavior, DSP::setCallback
Types of callback called by a DSP.
typedef enum FMOD_DSP_CALLBACK_TYPE {
FMOD_DSP_CALLBACK_DATAPARAMETERRELEASE,
FMOD_DSP_CALLBACK_MAX
} FMOD_DSP_CALLBACK_TYPE;
data: FMOD_DSP_DATA_PARAMETER_INFO.Callbacks are called from the game thread when set from the Core API or Studio API in synchronous mode, and from the Studio Update Thread when in default / async mode.
See Also: Callback Behavior, DSP::setCallback
Describes the value of a DSP's data parameter.
typedef struct FMOD_DSP_DATA_PARAMETER_INFO {
void *data;
unsigned int length;
int index;
} FMOD_DSP_DATA_PARAMETER_INFO;
This data is passed to the DSP callback function when type is FMOD_DSP_CALLBACK_DATAPARAMETERRELEASE. The callback should free the data pointer if it is no longer required.
See Also: FMOD_DSP_CALLBACK
Disconnects all inputs and/or outputs.
FMOD_RESULT DSP::disconnectAll(
bool inputs,
bool outputs
);
Whether all inputs should be disconnected.
Whether all outputs should be disconnected.
This is a convenience function that is faster than disconnecting all inputs and outputs individually.
See Also: DSP::disconnectFrom
Disconnect the specified input DSP.
FMOD_RESULT DSP::disconnectFrom(
DSP *target,
DSPConnection *connection = nullptr
);
If target had only one output, after this operation that entire sub graph will no longer be connected to the DSP graph.
After this operation connection is no longer valid.
See Also: DSP::addInput, DSP::disconnectAll
Retrieves the processing active state.
FMOD_RESULT DSP::getActive(
bool *active
);
Active state.
If active is False, processing of this unit and its inputs are stopped.
A DSP is inactive when first created. It is automatically activated when ChannelControl::addDSP is used; otherwise, it must be set to active manually.
See Also: DSP::setActive, DSP::setBypass
Retrieves the processing bypass state.
FMOD_RESULT DSP::getBypass(
bool *bypass
);
Bypass state.
If bypass is true, processing of this unit is skipped but it continues to process its inputs.
See Also: DSP::setBypass, DSP::setActive
Retrieves the PCM input format this DSP will receive when processing.
FMOD_RESULT DSP::getChannelFormat(
FMOD_CHANNELMASK *channelmask,
int *numchannels,
FMOD_SPEAKERMODE *source_speakermode
);
See Also: DSP::setChannelFormat
Retrieves statistics on the mixer thread CPU usage for this unit.
FMOD_RESULT DSP::getCPUUsage(
unsigned int *exclusive,
unsigned int *inclusive
);
CPU time spent processing just this unit during the last mixer update.
CPU time spent processing this unit and all of its input during the last mixer update.
FMOD_INIT_PROFILE_ENABLE with System::init is required to call this function.
Retrieve the index of the first data parameter of a particular data type.
FMOD_RESULT DSP::getDataParameterIndex(
int datatype,
int *index
);
datatype after the function is called. Will be -1 if no matches were found.This function returns FMOD_OK if a parameter of matching type is found and FMOD_ERR_INVALID_PARAM if no matches were found.
The return code can be used to check whether the DSP supports specific functionality through data parameters of certain types without the need to provide index.
Retrieves the idle state.
FMOD_RESULT DSP::getIdle(
bool *idle
);
Idle state.
A DSP is considered idle when it stops receiving input signals and all internal processing of stored input has been exhausted.
Different DSP types can have different idle behavior. A reverb or echo DSP may take longer to go idle after it stops receiving a valid signal than a DSP with a shorter tail length, such as an EQ filter.
Retrieves information about this DSP unit.
FMOD_RESULT DSP::getInfo(
char *name,
unsigned int *version,
int *channels,
int *configwidth,
int *configheight
);
See Also: DSP::showConfigDialog
Retrieves the DSP unit at the specified index in the input list.
FMOD_RESULT DSP::getInput(
int index,
DSP **input,
DSPConnection **inputconnection
);
Offset into this DSP's input list.
index. (DSP)input. (DSPConnection)This will flush the DSP queue (which blocks against the mixer) to ensure the input list is correct, avoid this during time sensitive operations.
The returned connection will remain valid until the units are disconnected.
See Also: DSP::addInput, DSP::getOutput
Retrieves the input and output signal metering enabled states.
FMOD_RESULT DSP::getMeteringEnabled(
bool *inputEnabled,
bool *outputEnabled
);
Metering enabled state for the input signal.
Metering enabled state for the output signal.
Input metering is pre processing, while output metering is post processing.
Enabled metering allows DSP::getMeteringInfo to return metering information and allows FMOD profiling tools to visualize the levels.
FMOD_INIT_PROFILE_METER_ALL with System::init will automatically turn on metering for all DSP units inside the dsp graph.
See Also: DSP::setMeteringEnabled
Retrieve the signal metering enabled metering information.
FMOD_RESULT DSP::getMeteringInfo(
FMOD_DSP_METERING_INFO *inputInfo,
FMOD_DSP_METERING_INFO *outputInfo
);
Requesting metering information when it hasn't been enabled will result in FMOD_ERR_BADCOMMAND.
FMOD_INIT_PROFILE_METER_ALL with System::init will automatically enable metering for all DSP units.
See Also: DSP::setMeteringEnabled, DSP::getMeteringEnabled
Retrieves the number of DSP units in the input list.
FMOD_RESULT DSP::getNumInputs(
int *numinputs
);
This flushes the DSP queue (which blocks against the mixer) to ensure the input list is correct. You should avoid doing this during time-sensitive operations.
See Also: DSP::getNumOutputs, DSP::getInput
Retrieves the number of DSP units in the output list.
FMOD_RESULT DSP::getNumOutputs(
int *numoutputs
);
This flushes the DSP queue (which blocks against the mixer) to ensure the output list is correct. You should avoid doing this during time-sensitive operations.
See Also: DSP::getNumInputs, DSP::getOutput
Retrieves the number of parameters exposed by this unit.
FMOD_RESULT DSP::getNumParameters(
int *numparams
);
Use this to enumerate all parameters of a DSP unit with DSP::getParameterInfo.
See Also: DSP::setParameterFloat, DSP::setParameterInt, DSP::setParameterBool, DSP::setParameterData
Retrieves the DSP unit at the specified index in the output list.
FMOD_RESULT DSP::getOutput(
int index,
DSP **output,
DSPConnection **outputconnection
);
Offset into this DSP's output list.
index. (DSP)output. (DSPConnection)This flushes the DSP queue (which blocks against the mixer) to ensure the output list is correct. You should avoid doing this during time-sensitive operations.
The returned connection will remain valid until the units are disconnected.
See Also: DSP::addInput, DSP::getInput
Retrieves the output format this DSP produces when processing based on the input specified.
FMOD_RESULT DSP::getOutputChannelFormat(
FMOD_CHANNELMASK inmask,
int inchannels,
FMOD_SPEAKERMODE inspeakermode,
FMOD_CHANNELMASK *outmask,
int *outchannels,
FMOD_SPEAKERMODE *outspeakermode
);
See Also: DSP::setChannelFormat, DSP::getChannelFormat
Retrieves a boolean parameter by index.
FMOD_RESULT DSP::getParameterBool(
int index,
bool *value,
char *valuestr,
int valuestrlen
);
Parameter index.
Parameter boolean data.
value. (UTF-8 string)Length of valuestr.
See Also: DSP::setParameterBool, DSP::getParameterInfo
Retrieves a binary data parameter by index.
FMOD_RESULT DSP::getParameterData(
int index,
void **data,
unsigned int *length,
char *valuestr,
int valuestrlen
);
Parameter index.
Length of data.
data. (UTF-8 string)Length of valuestr.
See Also: DSP::setParameterData, DSP::getParameterInfo
Retrieves a floating point parameter by index.
FMOD_RESULT DSP::getParameterFloat(
int index,
float *value,
char *valuestr,
int valuestrlen
);
Parameter index.
value. (UTF-8 string)Length of valuestr.
See Also: DSP::setParameterFloat, DSP::getParameterInfo
Retrieve information about a specified parameter.
FMOD_RESULT DSP::getParameterInfo(
int index,
FMOD_DSP_PARAMETER_DESC **desc
);
Parameter index.
index. (FMOD_DSP_PARAMETER_DESC)See Also: DSP::setParameterFloat, DSP::setParameterInt, DSP::setParameterBool, DSP::setParameterData
Retrieves an integer parameter by index.
FMOD_RESULT DSP::getParameterInt(
int index,
int *value,
char *valuestr,
int valuestrlen
);
Parameter index.
value. (UTF-8 string)Length of valuestr.
See Also: DSP::setParameterInt, DSP::getParameterInfo
Retrieves the parent System object.
FMOD_RESULT DSP::getSystemObject(
System **system
);
See Also: System::createDSP, System::createDSPByType
Retrieves the pre-defined type of a FMOD registered DSP unit.
FMOD_RESULT DSP::getType(
FMOD_DSP_TYPE *type
);
This is only valid for the DSP types built in to the FMOD Engine. For user-created plug-in DSPs, it instead returns FMOD_DSP_TYPE_UNKNOWN.
Retrieves a user value associated with this object.
FMOD_RESULT DSP::getUserData(
void **userdata
);
This function allows arbitrary user data to be retrieved from this object. See the User Data section of the glossary for an example of how to get and set user data.
Retrieves the scale of the wet and dry signal components.
FMOD_RESULT DSP::getWetDryMix(
float *prewet,
float *postwet,
float *dry
);
Level of the 'Dry' (pre-processed signal) mix that is processed by the DSP. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
Level of the 'Wet' (post-processed signal) mix that is output. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
Level of the 'Dry' (pre-processed signal) mix that is output. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
See Also: DSP::setWetDryMix
Releases a DSP unit, freeing the memory used by that object.
FMOD_RESULT DSP::release();
If DSP is not removed from the graph with ChannelControl::removeDSP after being added with ChannelControl::addDSP, it will not release and will instead return FMOD_ERR_DSP_INUSE.
See Also: System::createDSP
Reset a DSP's internal state, making it ready for a new input signal.
FMOD_RESULT DSP::reset();
This will clear all internal state derived from input signal while retaining any set parameter values. The intended use of the function is to avoid audible artifacts if moving the DSP from one part of the DSP graph to another.
Sets the processing active state.
FMOD_RESULT DSP::setActive(
bool active
);
Active state.
If active is false, processing of this unit and its inputs are stopped.
When created, a DSP is inactive. It is automatically activated when ChannelControl::addDSP is used; otherwise, it must be set to active manually.
See Also: DSP::getActive, DSP::setBypass, DSP::getBypass
Sets the processing bypass state.
FMOD_RESULT DSP::setBypass(
bool bypass
);
Bypass state.
If bypass is true, processing of this unit is skipped but it continues to process its inputs.
See Also: DSP::getBypass, DSP::setActive, DSP::getActive
Sets the callback for DSP notifications.
FMOD_RESULT DSP::setCallback(
FMOD_DSP_CALLBACK callback
);
See Also: Callback Behavior, FMOD_DSP_CALLBACK_TYPE
Sets the PCM input format this DSP is to receive when processing.
FMOD_RESULT DSP::setChannelFormat(
FMOD_CHANNELMASK channelmask,
int numchannels,
FMOD_SPEAKERMODE source_speakermode
);
Number of channels to be processed.
Setting the number of channels on a unit forces either a down or up mix to that channel count before processing the DSP read/process callback.
See Also: DSP::getChannelFormat
Sets the input and output signal metering enabled states.
FMOD_RESULT DSP::setMeteringEnabled(
bool inputEnabled,
bool outputEnabled
);
Metering enabled state for the input signal.
Metering enabled state for the output signal.
Input metering is pre processing, while output metering is post processing.
Enabled metering allows DSP::getMeteringInfo to return metering information and allows FMOD profiling tools to visualize the levels.
FMOD_INIT_PROFILE_METER_ALL with System::init will automatically turn on metering for all DSP units inside the DSP graph.
This function must have inputEnabled and outputEnabled set to true if being used by the Studio API, such as in the Unity or Unreal Engine integrations, in order to avoid conflict with FMOD Studio's live update feature.
See Also: DSP::getMeteringEnabled
Sets a boolean parameter by index.
FMOD_RESULT DSP::setParameterBool(
int index,
bool value
);
Parameter index.
Parameter value.
See Also: DSP::getParameterInfo, DSP::getParameterBool
Sets a binary data parameter by index.
FMOD_RESULT DSP::setParameterData(
int index,
void *data,
unsigned int length
);
Parameter index.
Length of data.
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
See Also: DSP::getParameterInfo, DSP::getParameterData
Sets a floating point parameter by index.
FMOD_RESULT DSP::setParameterFloat(
int index,
float value
);
Parameter index.
See Also: DSP::getParameterInfo, DSP::getParameterFloat
Sets an integer parameter by index.
FMOD_RESULT DSP::setParameterInt(
int index,
int value
);
Parameter index.
See Also: DSP::getParameterInfo, DSP::getParameterInt
Sets a user value associated with this object.
FMOD_RESULT DSP::setUserData(
void *userdata
);
This function allows arbitrary user data to be attached to this object. See the User Data section of the glossary for an example of how to get and set user data.
See Also: DSP::getUserData
Sets the scale of the wet and dry signal components.
FMOD_RESULT DSP::setWetDryMix(
float prewet,
float postwet,
float dry
);
Level of the 'Dry' (pre-processed signal) mix that is processed by the DSP. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
Level of the 'Wet' (post-processed signal) mix that is output. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
Level of the 'Dry' (pre-processed signal) mix that is output. 0 = silent, 1 = full. Negative level inverts the signal. Values larger than 1 amplify the signal.
The dry signal path is silent by default, because DSP effects transform the input and pass the newly processed result to the output.
See Also: DSP::getWetDryMix
Display or hide a DSP unit configuration dialog box inside the target window.
FMOD_RESULT DSP::showConfigDialog(
void *hwnd,
bool show
);
Whether to show or hide the dialog box inside target hwnd.
Some DSP plug-ins (especially VST plug-ins) use dialog boxes to display graphical user interfaces for modifying their parameters, rather than using the other method of enumerating their parameters and setting them with DSP::setParameterFloat, DSP::setParameterInt, DSP::setParameterBool, or DSP::setParameterData.
To find out what size window to create to store the configuration screen, use DSP::getInfo where you can get the width and height.