Microsoft DirectX 9.0 SDK Update (October 2004) |
The GetTrack method searches the list of tracks for the one with the specified type, group, and index, and retrieves an interface to the track object.
Syntax
HRESULT GetTrack(
REFGUID rguidType,
DWORD dwGroupBits,
DWORD dwIndex,
IDirectMusicTrack** ppTrack
);
Parameters
rguidType
Reference to (C++) or address of (C) the class identifier of the track to find. A value of GUID_NULL retrieves any track. For track identifiers, see Standard Track Types.
dwGroupBits
Track groups in which to scan for the track. A value of 0 is invalid. Each bit in dwGroupBits corresponds to a track group. To scan all tracks, regardless of groups, set this parameter to 0xFFFFFFFF.
dwIndex
Zero-based index into the list of tracks of type rguidType and in group dwGroupBits to return. If multiple groups are selected in dwGroupBits, this index indicates the nth track of type rguidType encountered in the union of the groups selected. See Remarks.
ppTrack
Address of a variable that receives a pointer to the track. The variable is set to NULL if the track is not found.
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_FOUND |
E_FAIL |
E_POINTER |
Remarks
To enumerate all tracks, use GUID_NULL for the rguidType and 0xFFFFFFFF for dwGroupBits. Call GetTrack starting with 0 for dwIndex, incrementing dwIndex until the method no longer returns a success code.
Tracks in segments created by DirectMusic Producer are not necessarily in the same order as they were in that application. Do not rely on dwIndex alone to find a particular track.
For more information on track groups, see Identifying the Track.
Requirements
Header: Dmusici.h
Library: Dmime.dll, Dmimed.dll
See Also