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?