Block processing in FMOD 5

FMOD_DSP_PROCESS_CALLBACK, takes inputs of:

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

So if I am given n channels of “length” number of samples, I must output m channels also of the same length.

What happens if I am given 300 samples, but I only process in block sizes of 256, and am thus only able to return 256 samples at a time? There doesn’t seem to be a way to return a partial frame. Can I define a required number of samples per invocation? How are we to handle block based processing?

FMOD will call DSP functions with lengths up to the system block size. The default system block size varies by platform, and can be overriden by the application using System::setDSPBufferSize().

lengths less the system block size are only used at the start and end of processing, so you can zero pad the signal if you want.

Your DSP can query the block size in the FMOD_DSP_CREATE_CALLBACK callback using:

int dspBlockSize;
dsp_state->callbacks->getblocksize(dsp_state, &dspBlockSize);

and set up your internal block size to match.