The data structure in the following figure holds the playlist that is used to play the chimes in the Clock Sample program provided in the Toolkit (\TOOLKIT\SAMPLES\MM\CLOCK). Note that the definitions for the playlist operation codes can be found in the MCIOS2.H file.
/* * This double array holds the playlists that will be used to play the * chimes for the clock. Each array has three fields within the * structure: one for the playlist command (32-bit value) and three * operands (32-bit values). The DATA_OPERATION's first operand will * contain the address to the respective waveform buffers. Once the * playlist has been played, the CHIME_PLAYING_HAS_STOPPED message * will be sent so that the application knows that the audio has * finished. * The clock will have a unique chime for each quarter hour. * There are three chime files that are used in different combinations * to create all of the chimes used for the clock. These three files * are CLOCK1.WAV, CLOCK2.WAV, and CLOCK3.WAV. * * The first playlist will play quarter hour chime. This is simply * CLOCK1.WAV. * * The second playlist will play the half hour chime. This * consists of CLOCK1.WAV + CLOCK2.WAV. * * The third playlist will play the three quarter hour chime. This * consists of CLOCK1.WAV + CLOCK2.WAV + CLOCK1.WAV. * * The fourth playlist plays the hour chime. This consists of * CLOCK1.WAV + CLOCK2.WAV + CLOCK1.WAV + CLOCK2.WAV + * (HOUR * CLOCK3.WAV) * The Number of loops to perform for the hour value is kept in * the first operand. This will be set in a later procedure when the * hour of the chime time is known. */ PLAY_LIST_STRUCTURE_T apltPlayList[ NUMBER_OF_PLAYLISTS ] [ NUMBER_OF_COMMANDS ] = { /* * Quarter Hour Chime. */ { DATA_OPERATION, 0, 0, 0, /* Chime file 1. */ MESSAGE_OPERATION, 0, CHIME_PLAYING_HAS_STOPPED, 0, EXIT_OPERATION, 0, 0, 0 }, /* * Half Hour Chime. */ { DATA_OPERATION, 0, 0, 0, /* Chime file 1. */ DATA_OPERATION, 0, 0, 0, /* Chime file 2. */ MESSAGE_OPERATION, 0, CHIME_PLAYING_HAS_STOPPED, 0, EXIT_OPERATION, 0, 0, 0 }, /* * Three Quarter Hour Chime. */ { DATA_OPERATION, 0, 0, 0, /* Chime file 1. */ DATA_OPERATION, 0, 0, 0, /* Chime file 2. */ DATA_OPERATION, 0, 0, 0, /* Chime file 1. */ MESSAGE_OPERATION, 0, CHIME_PLAYING_HAS_STOPPED, 0, EXIT_OPERATION, 0, 0, 0 }, /* * Hour Chime. */ { DATA_OPERATION, 0, 0, 0, /* Chime file 1. < Line 0 >*/ DATA_OPERATION, 0, 0, 0, /* Chime file 2. < Line 1 >*/ DATA_OPERATION, 0, 0, 0, /* Chime file 1. < Line 2 >*/ DATA_OPERATION, 0, 0, 0, /* Chime file 2. < Line 3 >*/ DATA_OPERATION, 0, 0, 0, /* Chime file 3. < Line 4 >*/ LOOP_OPERATION, 0, 4, 0, /* Which line to loop on. < Line 5 >*/ MESSAGE_OPERATION, 0, CHIME_PLAYING_HAS_STOPPED, 0, EXIT_OPERATION, 0, 0, 0 }
To prevent lost data, the address range of memory buffers used in DATA operations should not overlap.