共用方式為


IDirectMusicPatternTrack8::SetVariation

The SetVariation method sets the variations to be played by a part in the track.

Syntax

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

Parameters

pSegState

Address of the IDirectMusicSegmentState8 interface representing the playing instance of the segment that contains 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 authoring application, and is equivalent to the performance channel .

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the error values shown in the following table.

Return code
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:** Dmusici.h

See Also

© 2004 Microsoft Corporation. All rights reserved.