IDirectMusicTrack8::InitPlay

DirectMusic

Microsoft DirectX 9.0 SDK Update (Summer 2004)

IDirectMusicTrack8::InitPlay

The IDirectMusicTrack8::InitPlay method is called when a track is ready to start playing. The method returns a pointer to state data.

Syntax

HRESULT InitPlay(
  IDirectMusicSegmentState* pSegmentState,
  IDirectMusicPerformance* pPerformance,
  void** ppStateData,
  DWORD dwVirtualTrackID,
  DWORD dwFlags
);

Parameters

pSegmentState

Address of the calling IDirectMusicSegmentState or IDirectMusicSegmentState8 interface.

pPerformance

Address of the calling IDirectMusicPerformance or IDirectMusicPerformance8 interface.

ppStateData

Address of a variable that receives a pointer to state information. The format and use of the data is specific to the track. The data should be created in the InitPlay method and freed in the IDirectMusicTrack8::EndPlay method. The pointer is passed to the IDirectMusicTrack8::Play and IDirectMusicTrack8::PlayEx methods.

dwVirtualTrackID

Virtual track ID assigned to this track instance.

dwFlags

DMUS_SEGF_FLAGS that control the track's behavior. See Remarks.

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_OUTOFMEMORY
E_POINTER

Remarks

The dwFlags parameter passes the flags that were handed to the performance in the call to IDirectMusicPerformance8::PlaySegment or IDirectMusicPerformance8::PlaySegmentEx. The track determines how it should perform, based on the DMUS_SEGF_CONTROL and DMUS_SEGF_SECONDARY flags. For example, the tempo track automatically plays the tempo changes only if it is part of a primary segment or a secondary control segment (DMUS_SEGF_SECONDARY is not set, or DMUS_SEGF_CONTROL is set).

A track can return NULL in *ppStateData.

Requirements

  Header: Declared in dmplugin.h.

See Also


© 2004 Microsoft Corporation. All rights reserved.