Platform SDK: DirectX

Step 4: Set Up Notifications

[Visual Basic]

This tutorial pertains only to applications written in C++. See DirectMusic Visual Basic Tutorials.

[C++]

The last bit of DirectMusic code inside the InitializeGame function is a request for notification when playback of the primary segment reaches a beat boundary or the end of the segment. As you'll see later in this tutorial, the notification mechanism is used to limit the number of "blowup" motifs that can be played at the same time.

The following code adds the notification types. Note that the notification GUIDs have to be placed in a variable, because they are passed by reference.

GUID guid;
guid = GUID_NOTIFICATION_SEGMENT;
gpPerformance->AddNotificationType( guid );
guid = GUID_NOTIFICATION_MEASUREANDBEAT;
gpPerformance->AddNotificationType( guid );

Next: Step 5: Create the Primary Segments