Playing a Chime
Every time you want to play a chime, open the device you want to play, play
it, and close it. The logic for the Memory Playlist Sample implementation
of the playlist is outlined in in the following figure.
(6)
│
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ "Play Chime" │ │Deal with chiming│ │ MM_MCINOTIFY │
│ push button │ │ (Open) │ │ (Play or Open) │
│ │ │ │ │ │
└────┬────────────┘ └───────┬─────────┘ └─────────┬───────┘
(1) (2)│ (7)
┌─────────────────┐ │ ┌─────────────────┐
│Find the nearest │ │ │ Chiming is done.│
│chime time and │ │ │ Stop swinging │
│play it (Open) │ │ │ the bell │
└────┬────────────┘ │ └─────────────────┘
│
│ ┌─────────────────┐
│ │ Find and play │
└─────────────────│ the correct │
│ chime │
└───────┬─────────┘
(3)│
┌─────────────────┐
│ Open Playlist │
│ chime device │
│with MCI_WAIT set│
└───────┬─────────┘
(4)│
┌─────────────────┐
│Set up chime file│
│ information │
│ │
└───────┬─────────┘
(5)│
┌─────────────────┐
│ Play Playlist │
│ with notify set │
│ │
└───────┬─────────┘
│
(6)
- If Play chime is selected, processing
is passed to the FindTheNearestChimeTimeAndPlayIt procedure, which calculates
the next hour so its chime can be played. The procedure calls FindAndPlayTheCorrectChime
to do the actual work required to play the chime.
- If it is a normally scheduled chime time
(if a quarter hour has been reached), processing is passed to FindAndPlayTheCorrectChime.
- FindAndPlayTheCorrectChime calls OpenPlaylistChimeDevice
to do open processing with MCI_WAIT specified.
- When the OPEN command completes, the Waveform
Audio Media Driver needs information about the waveform file. The FindAndPlayTheCorrectChime
procedure calls SetupChimeFileInformation to pass this information to the
driver.
- After calling SetupChimeFileInformation,
the FindAndPlayTheCorrectChime procedure issues the mciSendCommand request
to play the chime with the notify flag set.
- After the chime has finished playing, a notification
message is sent to the MainDialogProc and handled by the MM_MCINOTIFY case
of the switch statement.
- In the MM_MCINOTIFY case of MainDialogProc,
when usMCIUserParameter is set to indicate the chime has stopped
playing, the swinging of the bell is stopped and the device is closed.
[Back: Program Flow]
[Next: DOUBPLAY - Double Buffering Playlist Sample]