Microsoft DirectX 8.1 (Visual Basic) |
A motif is a special kind of
All the motifs authored into a style become available to you as soon as you have loaded that style. To get a particular motif ready for playback, call the DirectMusicStyle8.GetMotif method, passing in the name of the motif. You might know this from the documentation for the style, or you can obtain it from an index value by using the DirectMusicStyle8.GetMotifName method.
The following code example obtains and plays the first motif in the style:
' style is a DirectMusicStyle8.
' perf is the DirectMusicPerformance8.
Dim MotifName As String
Dim segMotif As DirectMusicSegment8
MotifName = style.GetMotifName(1)
Set segMotif = style.GetMotif(MotifName)
Call perf.PlaySegmentEx(segMotif, DMUS_SEGF_SECONDARY, 0)
Note that segMotif is played as a secondary segment, because a motif is normally played over a primary segment. You cannot play a motif as a primary segment, because it does not have a chord track or band track. If you want to play a motif against silence, create a primary segment from a style that has only blank patterns, and keep that segment playing while you play the motif.