Working of Process Function in fmod_distance_filter plugin

I am using FMOD_UE4_Tutorials_Map in Unreal Engine 4 with FMOD 1.07.07

I am modifying the fmod_distance_filter sample plugin provided in the API and already added it to the master track associated with an Grenade event and verified that the plugin is being called because I generate custom logs.

In the Plugin code,
FMOD_RESULT FMODDistanceFilterState::process( float *inbuffer, float *outbuffer, unsigned int length, int channels );
I copy my own audio samples in the outbuffer [ also tried with inbuffer ] but am unable to hear the corresponding audio in UE4 ; Instead it plays the Grenade sound with some noise.

Is this a wrong approach ?

Is there a maximum time limit on which the entire processing should happen ?

That approach should work. There a few things you could check:

  • Be aware that the buffer is interleaved, for example if channels comes through as 2 then the buffers will have contain L,R,L,R,L,R,… etc.
  • DSP processing is always on float data, so if you have PCM16 then you will need to convert it.
  • The callback will be on the mixer thread so be careful of thread safety when accessing your data.
  • If the callback takes too long then there can be starvation, keep an eye out for WASAPI starvation messages.

If it really is a generator then you can set the DSP description in buffer count to 0. Studio will then categorize it differently, allowing it to be used as a plugin module rather than a bus effect.

1 Like

This was very helpful thanks