When an OS/2 multimedia application needs to control more than one device at a time, it uses the MCI_GROUP message to group device contexts. The MCI_GROUP_MAKE and MCI_GROUP_DELETE flags are used to make and delete groups. MCI_GROUP_MAKE ties several device instances together so that a single command sent to the group by an application is actually sent to each device instance in the group by the multimedia system. This flag can be combined with any of the other MCI_GROUP flags except MCI_GROUP_DELETE in which case an MCIERR_FLAGS_NOT_COMPATIBLE error code is returned. Device instances must have been previously opened but can be in any mode (such as, playing, stopped, or paused) for this message to be successful. If one or more device IDs are invalid, the MCIERR_INVALID_DEVICE_ID error code is returned. If a device ID or alias refers to a device in another group, the MCIERR_ID_ALREADY_IN_GROUP error code is returned.
Once a group has been made, certain command messages sent to the group ID (or alias name) are sent to each device making up that group. Command messages that support groups are:
MCI_ACQUIREDEVICE
Note: Commands sent to a group must use the MCI_NOTIFY flag.
To end a group association, an application uses the MCI_GROUP_DELETE flag of the MCI_GROUP message. None of the other flags of the MCI_GROUP message can be combined with MCI_GROUP_DELETE because the only information required by this flag is a group ID. If any other flags are supplied an MCIERR_FLAGS_NOT_COMPATIBLE error code is returned. The MCIERR_INVALID_GROUP_ID error code is returned if an application passes an invalid ID. When a device in a group is closed, it is removed from the group. When the last device in a group is closed, the group is automatically deleted.
Applications can use the MCI_GROUP_ALIAS flag to refer to a group by a name rather than a group ID for use with the mciSendString interface. This flag can only be used with an MCI_GROUP_MAKE flag; the given alias is used to refer to the new group. If the alias is already in use, an MCIERR_DUPLICATE_ALIAS error code is returned. Each string group "make" command must include an alias so the group can later be referred to. The alias follows the group command as shown by the following syntax:
group grp1 make (wave1 cd1) wait
This defines the alias to be "grp1". The list of device names (members of the group) is delimited by parenthesis and separated by spaces and optional quotation marks. The following syntax is used to delete this group:
group grp1 delete wait