C4 Engine
C4 Engine API Documentation

Sound::VaryVolume

Defined in:  C4Sound.h
Varies the volume of a sound over a specific time period.
Prototype

void VaryVolume(float volume, int32 time, bool stop = false);

Parameters
volume The new volume to which the sound should be gradually changed.
time The time interval, in milliseconds, over which the variation should occur.
stop Indicates whether the sound should be stopped at the end of the variation.
Description
The VaryVolume function varies the volume of a sound to that given by the volume parameter over the time interval given by the time parameter.

If the stop parameter is true, then the sound is stopped at the end of the variation period, and the volume variation completion callback function is called, if any. If the sound is nonpersistent, then it is released at this point.

If the time parameter is less than or equal to zero, then the sound's volume is set to volume immediately. If the stop parameter is true in this case, then the sound is stopped before the VaryVolume function returns.

It can be determined whether a sound's volume is currently being varied by calling the Sound::VolumeVarying function.
See Also

Sound::VolumeVarying

Sound::SetVolumeVariationCompletionCallback

Sound::VaryFrequency