Microsoft DirectX 8.1 (C++) |
Description
The PlayMotif sample demonstrates how a motif played as a secondary segment can be aligned to the rhythm of the primary segment in various ways.
Path
Source: (SDK root)\Samples\Multimedia\DirectMusic\PlayMotif
Executable: (SDK root)\Samples\Multimedia\DirectMusic\Bin
User's Guide
Play the default segment, or load another DirectMusic segment based on a
Programming Notes
The PlayMotif sample is very similar in form to the PlayAudio sample. For detailed programming notes on the basics of this sample, see PlayAudio.
When loading the file, PlayMotif performs the same steps as PlayAudio, with the following additions in the LoadSegmentFile function:
Passes the motif name to IDirectMusicStyle8::GetMotif to get an IDirectMusicSegment8 interface pointer to the motif, and stores this as data associated with the item in the list box.
When Play Motif is clicked, the OnPlayMotif function performs the following tasks:
DirectMusic notifications are handled much as in PlayAudio, but this application also takes note of any motif starting or stopping and updates the play count in the MOTIF_NODE structure. If the play count is greater than zero then it updates the user interface to show that the motif is playing.
See Also