# AddFadePoint does not fade out gently, causes a click

**URL:** <https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327>\
**Category:** FMOD Engine\
**Created:** [January 23, 2019, 11:34am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327 "2019-01-23T11:34:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)\
**Post date:** [January 23, 2019, 11:34am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/1 "2019-01-23T11:34:01Z")

</div>

I’m trying to fade out a song that is playing with a volume of 0.2, but after calling Channel\_AddFadePoint I get a click and a sudden drop in volume and then it fades out. This is the code I’m using:  
FMOD\_RESULT result;  
result = FMOD\_Channel\_SetPaused(m\_pChannel, true);  
racAssert(result == FMOD\_OK);  
unsigned long long dspClock;  
unsigned long long parentClock;  
result = FMOD\_Channel\_GetDSPClock(  
m\_pChannel, &dspClock, &parentClock);  
if (result != FMOD\_OK)  
{  
throw RacException(“FMOD System\_PlaySound error:”, FMOD\_ErrorString(result));  
}  
float volume;  
result = FMOD\_Channel\_GetVolume(m\_pChannel, &volume);  
if (result != FMOD\_OK)  
{  
throw RacException(“FMOD Channel\_GetVolume error:”, FMOD\_ErrorString(result));  
}  
result = FMOD\_Channel\_AddFadePoint(m\_pChannel, dspClock, volume);  
if (result != FMOD\_OK)  
{  
throw RacException(“FMOD FMOD\_Channel\_AddFadePoint error:”, FMOD\_ErrorString(result));  
}  
result = FMOD\_Channel\_AddFadePoint(m\_pChannel, dspClock + timeFadeOut\*c\_systemSampleRate/1000, 0.0f);  
if (result != FMOD\_OK)  
{  
throw RacException(“FMOD FMOD\_Channel\_AddFadePoint error:”, FMOD\_ErrorString(result));  
}  
result = FMOD\_Channel\_SetPaused(m\_pChannel, false);  
racAssert(result == FMOD\_OK);

Anyone know what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [January 30, 2019, 4:21am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/2 "2019-01-30T04:21:46Z")

</div>

What sort of values are you using for timeFadeOut & c\_systemSampleRate?

---

<div class="post-metadata">

**Author:** ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)\
**Post date:** [January 30, 2019, 10:53am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/3 "2019-01-30T10:53:04Z")

</div>

c\_systemSampleRate is 48000 and timeFadeOut is 5000 (i.e. 5 seconds)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [February 1, 2019, 1:23am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/4 "2019-02-01T01:23:06Z")

</div>

Using your code, and those same values in one of our examples, I get a nice smooth gradual fadeout. Could there be something else in the code effecting it?

Are you able to try this in our examples to see if the problem reproduces?

---

<div class="post-metadata">

**Author:** ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)\
**Post date:** [February 1, 2019, 10:08am UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/5 "2019-02-01T10:08:06Z")

</div>

I forget to mention that the problem happens with a OGG track that is opened with FMOD\_CREATESTREAM. Maybe that is something to do with it?  
Anyways, I managed to solve the problem a different way. I just call FMOD\_Channel\_SetVolume each frame with a progressively lower value.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [February 3, 2019, 10:29pm UTC](https://qa.fmod.com/t/addfadepoint-does-not-fade-out-gently-causes-a-click/14327/6 "2019-02-03T22:29:53Z")

</div>

Fade points should work the same on all channels, regardless of what is playing through it. If you are able to reproduce the issue in our examples, please send it through to [support@fmod.com](mailto:support@fmod.com) and we can investigate it further.
