The following figure illustrates how the DUET1 sample program interfaces with the Media Device Manager (MDM) to handle the concept of grouping. Source code for DUET1 is located in the \TOOLKIT\SAMPLES\MM\DUET1 subdirectory.
┌───────────────┐ │ DUET1 │ │ Sample │ │ Program │ └───┬───────┬───┘ ┌──┘ (1) └─┐ ┌────────────────┐ ┌────────────────┐ │ Waveform │ │ Waveform │ │ Audio │ │ Audio │ │Device Context 1│ (2) │Device Context 2│ └────────────┬───┘ └──┬─────────────┘ └─┐ ┌─┘ ┌───────────────┐ │ Media Device │ │ Manager │ │ │ └───────┬───────┘ │ ┌────┐ │WAVE│ ┌───────────────┐ │File│┐ │ Waveform │ └────┘ │ ┌─┐ │ Audio Media │ └─│M│ │ Driver │ │M│ └───────┬───────┘ ┌─│I│ (3) │ │ │O│ ┌────┐ │ └─┘ ┌───────────────┐ │WAVE│┘ │ Sync/Stream │ │File│ │ │ Manager │ └────┘ │ │ │ │ └───────────────┘ │ │ ┌────────────┘ └────────────┐ │ ┌─────┴────────┐ (4) ┌──────────────┐ │ File System │ ┌─┬─┬─┬─┬─┐ │ Audio │ │Stream Handler├────────────┤ │ │ │ │ ├───────┤Stream Handler│ └──────────────┘ └─┴─┴─┴─┴─┘ └──────┬───────┘ (5) ┌──────────────┐ │ Audio DD │ │ │ └──────┬───────┘ ┌──────────────┐ │ Audio HW │ │ │ └────────┐ ┌┘ └────┘
Each part of the duet is played through the OS/2 multimedia system using a separate instance of a logical media device. In this case, it uses two instances of the logical waveform device, the Waveform Audio Media Driver. When the Duet Player is ready to play a song, it issues the MCI_GROUP command to the MDM to set up a group of two logical waveform devices. The MDM returns a group handle to the application, so that the application can refer to that group as a single unit (instead of having to manage each logical device separately). The MDM handles the management of the logical media devices for the application.
When you select Play, Pause, or Stop, the application issues an MCI_PLAY, MCI_PAUSE, or MCI_STOP message to the MDM. The MDM then passes this message to the appropriate media devices in the group.