Step 1: Defines and Globals

The following defines and global variables are declared at the beginning of Donuts.cpp. They are given here for you to refer to as you work through the tutorial.

BOOL          bMusicEnabled = TRUE;
 
// Various constants
const  GUID guidZero =    {0};
#define MOTIF_BOUNCE       0
#define MOTIF_DEATH        1
#define MOTIF_SHIELD       2
#define MOTIF_BLOWUP       4
#define MOTIF_BLOWUPLITE   3
#define NUM_MOTIFS         5
#define NUM_STYLES         2
#define SEGMENT_1          0
#define SEGMENT_2          1
#define SEGMENT_TRANS_1    2
#define SEGMENT_TRANS_2    3
#define NUM_SEGMENTS       4
#define NUM_CHORDMAP       4
#define BLOWUPS_PER_BEAT   2
#define MEASURE_LENGTH     DMUS_PPQ * 4 
// parts/quarter * quarters/measure (assumes 4/4)
 
// Global interfaces
IDirectMusicStyle*        gapStyle[NUM_STYLES];
IDirectMusicChordMap*     gapChordMap[NUM_STYLES] [NUM_CHORDMAP];
IDirectMusicSegment*      gapMotif[NUM_STYLES] [NUM_MOTIFS];
IDirectMusicSegment*      gapSegment[NUM_SEGMENTS] = 
                          {NULL, NULL, NULL, NULL};
IDirectMusicComposer *    gpComposer = NULL;
IDirectMusicPerformance*  gpPerformance = NULL;
IDirectMusic*             gpDirectMusic = NULL;
IDirectMusicLoader*       gpLoader = NULL;
IDirectMusicSegment*      gpIntroTemplate = NULL;
IDirectMusicSegment*      gpGameTemplate = NULL;
IDirectMusicSegment*      gapShieldSegment[NUM_STYLES] = {NULL, NULL};
IDirectMusicSegment*      gapDefaultSegment[NUM_STYLES] = 
                                  {NULL, NULL};
IDirectMusicBand*         gapShieldBand[NUM_STYLES] = {NULL, NULL};
IDirectMusicBand*         gapDefaultBand[NUM_STYLES] = {NULL, NULL};
 
// Global variables
BOOL        bAnyHits = FALSE;
int         gnCurrentStyle = 0;
int         gnCurrentChordMap = 0;
int         gnLastStyle = 0;
int         gnLastChordMap = 0;
 
BOOL        gbShieldsOn = FALSE;
static int  snLastTempo;
static int  snSubLevel;
static int  snMaxBlowUps = BLOWUPS_PER_BEAT;