# Working of Process Function in fmod\_distance\_filter plugin

**URL:** <https://qa.fmod.com/t/working-of-process-function-in-fmod-distance-filter-plugin/12439>\
**Category:** Unreal Engine\
**Created:** [April 8, 2016, 11:08am UTC](https://qa.fmod.com/t/working-of-process-function-in-fmod-distance-filter-plugin/12439 "2016-04-08T11:08:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![udit034](https://avatars.discourse-cdn.com/v4/letter/u/85e7bf/32.png) [@udit034](https://qa.fmod.com/u/udit034)\
**Post date:** [April 8, 2016, 11:08am UTC](https://qa.fmod.com/t/working-of-process-function-in-fmod-distance-filter-plugin/12439/1 "2016-04-08T11:08:09Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![geoff](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@geoff](https://qa.fmod.com/u/geoff)\
**Post date:** [April 12, 2016, 5:06am UTC](https://qa.fmod.com/t/working-of-process-function-in-fmod-distance-filter-plugin/12439/2 "2016-04-12T05:06:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![udit034](https://avatars.discourse-cdn.com/v4/letter/u/85e7bf/32.png) [@udit034](https://qa.fmod.com/u/udit034)\
**Post date:** [April 12, 2016, 8:10am UTC](https://qa.fmod.com/t/working-of-process-function-in-fmod-distance-filter-plugin/12439/3 "2016-04-12T08:10:51Z")

</div>

> [@](#):
>
> 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.

This was very helpful thanks
