Firelight Technologies FMOD Studio API
FMOD_DSP_READ_CALLBACK
This callback is called back regularly when the unit has been created, inserted to the DSP network, and set to active by the user.
This callback requires the user to fill the output pointer with data. Incoming data is provided and may be filtered on its way to the output pointer.
C/C++ Syntax
FMOD_RESULT F_CALLBACK FMOD_DSP_READ_CALLBACK(
FMOD_DSP_STATE *dsp_state,
float *inbuffer,
float *outbuffer,
unsigned int length,
int inchannels,
int *outchannels
);
Parameters
dsp_state
Pointer to the plugin state. The user can use this variable to access runtime plugin specific variables and plugin writer user data. Do not cast this to FMOD_DSP! The handle to the user created DSP handle is stored within the FMOD_DSP_STATE structure.
inbuffer
Pointer to incoming floating point -1.0 to +1.0 ranged data.
outbuffer
Pointer to outgoing floating point -1.0 to +1.0 ranged data. The dsp writer must write to this pointer else there will be silence.
length
The length of the incoming and outgoing buffer in samples. To get the length of the buffer in bytes, the user must multiply this number by the number of channels coming in (and out, they may be different) and then multiply by 4 for 1 float = 4 bytes.
inchannels
The number of channels of interleaved PCM data in the inbuffer parameter. A mono signal coming in would be 1. A stereo signal coming in would be 2.
outchannels
The number of channels of interleaved PCM data in the outbuffer parameter. A mono signal going out would be 1. A stereo signal going out would be 2.
Return Values
If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.
Remarks
Functions that the user would have to call for this callback to be called.
- None
This callback is called automatically and periodically when the DSP engine updates.
For a read update to be called it would have to be enabled, and this is done with DSP::setActive.
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.
Remember to return FMOD_OK at the bottom of the function, or an appropriate error code from FMOD_RESULT.
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
Version 1.10.03 Built on Feb 1, 2018