# Strange issue with custom rolloff callback

**URL:** https://qa.fmod.com/t/strange-issue-with-custom-rolloff-callback/11593
**Category:** FMOD Engine
**Created:** [August 4, 2014, 2:04pm UTC](https://qa.fmod.com/t/strange-issue-with-custom-rolloff-callback/11593 "2014-08-04T14:04:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jonwil](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@jonwil](https://qa.fmod.com/u/jonwil)
#### Post date: [August 4, 2014, 2:04pm UTC](https://qa.fmod.com/t/strange-issue-with-custom-rolloff-callback/11593/1 "2014-08-04T14:04:42Z")

</div>

We are installing a custom rolloff callback with FMOD\_System\_Set3DRolloffCallback

When we play a sound we call FMOD\_System\_PlaySound then FMOD\_Channel\_Set3DAttributes to set the position on the sound followed by FMOD\_Channel\_Set3DMinMaxDistance to set the rolloff distances.

In our callback we call FMOD\_Channel\_Get3DMinMaxDistance to retrieve the distances stored earlier before using them (and the current distance passed to the callback) to calculate the volume value we want.

What we are seeing in our debug logs is the call to FMOD\_Channel\_Set3DMinMaxDistance followed immediately by a call to our callback with a distance of 0. The call to FMOD\_Channel\_Get3DMinMaxDistance inside that first call is returning the default distances of 1 and 10000 instead of what was supposedly just set by FMOD\_Channel\_Set3DMinMaxDistance. Then immediately after that we see another call to our callback with a more reasonable looking distance value and correct values being returned from FMOD\_Channel\_Set3DMinMaxDistance.

Why is this strange bogus call to our callback happening and how can we stop it from happening (or identify it and filter it out without breaking cases where distance is legitimately zero and the guys editing the data have legitimately set min and max distances to 1 and 10000)?

We are using version 1.04.05 of FMOD Studio Programmers API.

---

<div class="post-metadata">

### Author: ![jonwil](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@jonwil](https://qa.fmod.com/u/jonwil)
#### Post date: [August 6, 2014, 2:06am UTC](https://qa.fmod.com/t/strange-issue-with-custom-rolloff-callback/11593/2 "2014-08-06T02:06:50Z")

</div>

Turns out the cause of this was because our audio system called FMOD\_Channel\_SetPaused to start the sound playing before it called FMOD\_Channel\_Set3DAttributes and FMOD\_Channel\_Set3DMinMaxDistance. Fixing that made the problem go away.
