Step 4: Setting Up Notifications

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 );