When I add a plugin to group, setting a read callback in FMOD_DSP_DESCRIPTION make the channels not playing simultaneously. Per example, If I play the sound1 and sound2 just after, both sounds play together, but adding the DSP with read callback, when I play sound1 and after sound2, the sound1 stops.
The problem is that I’ve recorded sound input buffer in disk but don’t passed it ahead through outputbuffer. My final working code for the read callback follows:
auto recordCallback = [](
FMOD_DSP_STATE* dspState,
float* inBuffer,
float* outBuffer,
unsigned int length,
int inChannelCount,
int* outChannelCount
) -> FMOD_RESULT F_CALLBACK {
void* ptr;
dspState->functions->getuserdata(dspState, &ptr);
auto* r = reinterpret_cast<Recorder*>(ptr);
r->enqueue(inBuffer, length * inChannelCount);
for (auto sample = 0U; sample < length; sample++) {
for (auto channel = 0; channel < inChannelCount; channel++) {
auto index = (sample * inChannelCount) + channel;
outBuffer[index] = r->recordSilenced() ? 0 : inBuffer[index];
}
}
return FMOD_OK;
};
Yes, that’s makes sense, when writing a capture DSP it is important to pass the input buffer data through to the output buffer, otherwise the signal will go silent.