In an organized multimedia environment applications must be able to synchronize their audio settings with other applications. Whenever a user makes changes to an application's audio settings, other applications need to be informed of the changes so they can update their settings to conform to the changes made by the user.
An application can request notification about mixer events by sending an MCI_MIXNOTIFY message with MCI_MIXNOTIFY_ON specified. The application will then receive an MM_MCIEVENT message whenever a mixer attribute is changed, or a connector is enabled or disabled. When the system passes the MM_MCIEVENT message, the usEventCode field of the MsgParam1 parameter contains MM_MIXEVENT, and the MsgParam2 parameter contains a pointer to MCI_MIXEVENT_PARMS.
Attention: To avoid creating a terminal loop, the application must not set an audio attribute while processing the MM_MCIEVENT message.
typedef struct_MCI_MIXEVENT_PARMS { ULONG ulLength; /* Length of structure */ HWND hwndMixer; /* Window to receive mixer changes */ ULONG ulFlags; /* Either MCI_MIX_ATTRIBUTE or MCI_MIX_CONNECTOR */ USHORT usDeviceID; /* Device ID to notify of change */ ULONG ulDeviceType; /* Device type that caused change */ ULONG ulDeviceOrdinal; /* Ordinal of device type */ ULONG ulAttribute; /* Attribute that changed */ ULONG ulValue; /* New value of changed attribute */ ULONG ulConnectorType; /* Connector type */ ULONG ulConnectorIndex; /* Connector index */ ULONG ulConnStatus; /* Connector enabled/disabled */ } MCI_MIXEVENT_PARMS; typedef MCI_MIXEVENT_PARMS *PMCI_MIXEVENT_PARMS;
The ulFlags field contains one of the following values:
If the mixer event is the changing of an attribute, ulAttribute, ulDeviceType, and ulValue fields are valid.
If the mixer event is the changing of a connector, ulConnectorType, ulConnectorIndex, and ulConnStatus fields are valid.
The following example illustrates how an application can set up notification for every audio attribute change.
MCI_GENERIC_PARMS mixevent; mixevent.hwndCallback = hwndmixer; if (hMixer) { mciSendCommand(hMixer, MCI_MIXNOTIFY, MCI_WAIT | MCI_MIXNOTIFY_ON (PVOID) &mixevent, 0);
When MCI_MIXNOTIFY_ON is specified, the hwndCallback field of MCI_GENERIC_PARMS must contain a valid window handle.