Fade in volume problem

(Keitel) #1


I use the following code to have a fade in sound:

result = FMOD_System_GetMasterChannelGroup(systemx, &channelgroup); 
result = FMOD_System_PlayDSP(systemx, mydsp, channelgroup, 0, &channel[1]);
result = FMOD_Channel_GetSystemObject(channel[1], &systemx);
result = FMOD_Channel_GetDSPClock(channel[1], 0, &dspclock);
result =  FMOD_Channel_AddFadePoint(channel[1], dspclock, 0.0f );
endclock = dspclock + 2400;
result =  FMOD_Channel_AddFadePoint(channel[1], endclock, 0.2f );

The idea is to start with zero volume and fade in until the volume is 0.2. This seems to work fine. However, when I after that try to check the volume with this command

FMOD_Channel_GetVolume(channel[1], &volume);

the value of “volume” is always 1.0. This I don’t understand. I need to be able to regulate the volume after the fade in, but if the value is already 1, how can I then possibly increase the volume?

Thanks in advance.

(Nicholas Wilcox) #2

Volume and Fade are separate values and are multiplied together. I suggest starting the channel paused (fourth argument to playDSP), setting the volume to 0.2 and fading from 0 to 1.0, then un-pausing the channel.

(Keitel) #3

Thank you for your answer.

Actually, I found that I can set the volume to more than 1. I thought first that it only could have a value between 0 and 1. So when I want to increase the volume after the fade in, I regulate it’s value between 1 and 2. This seems to work fine.

Best regards