|Microsoft DirectX 9.0|
The Cross Fade sample shows how to fade out one segment while fading in another.
Source: (SDK root)\Samples\C++\DirectMusic\CrossFade
Executable: (SDK root)\Samples\C++\DirectMusic\Bin
Click Play to play Segment 1. Click Crossfade to fade out Segment 1 and fade in Segment 2. Click Crossfade again to fade out Segment 2 and fade in Segment 1. You can load different segments by using the Browse buttons.
The fade is achieved by playing the two segments on different audiopaths, whose volumes can be controlled separately by sending DMUS_CURVE_PMSG messages. The IDirectMusicAudioPath8::SetVolume method could be used instead, but it does not give any control over scheduling the curve. By using a curve message, the sample can put the starting point of the fade slightly in the future and make sure fading of both audiopaths happens at exactly the same time.