Microsoft DirectX 8.0 (C++)

IDirectMusicPatternTrack8::SetVariation

Sets the variations to be played by a part in the track.

HRESULT SetVariation(
  IDirectMusicSegmentState* pSegState,
  DWORD dwVariationFlags,
  DWORD dwPart
);

Parameters

pSegState
Address of the IDirectMusicSegmentState8 interface of the segment state that is playing the track.
dwVariationFlags
Bitmask where a bit is set for each variation that is to be played.
dwPart
Identifier for the part containing the variations. This is the number assigned to the part in the music-authoring application, and is equivalent to the PChannel.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the following error values:

DMUS_E_NOT_INIT
E_POINTER

Remarks

Variations can be set for only one part at a time. Each time this method is called, it overrides previous calls.

The following example code plays variations 16 and 32 on performance channel 1.

// pPattern is an IDirectMusicPatternTrack8 pointer.
// pSegmentState is an IDirectMusicSegmentState8 pointer.
 
#define VARIATION(v)  (1 << ((v) - 1))
 
HRESULT hr = pPattern->SetVariation(
    pSegmentState, VARIATION(32) | VARIATION(16), 1);

Requirements

  Header: Declared in dmusici.h.