MCI_SET
Appearance
This message sets various device attributes, such as audio levels, time formats, and video states.
Syntax
param1 ULONG ulParam1; /* Message flags. */ param2 PMCI_SET_PARMS pParam2; /* Pointer to the MCI_SET_PARMS structure. */
Parameters
- ulParam1 (ULONG) - input
- The following standard flags can be used:
- MCI_NOTIFY Posts a notification message when the action completes.
- MCI_WAIT Does not return control until the action is completed.
- MCI_SET_ON / MCI_SET_OFF Used with other flags (like audio or video) to enable or disable the feature.
- MCI_SET_AUDIO Sets audio attributes. Requires `ulAudio` in the parameter structure to specify the channel (`MCI_SET_AUDIO_ALL`, `LEFT`, or `RIGHT`).
- MCI_SET_VIDEO Enables or disables the video signal.
- MCI_SET_VOLUME Sets volume as a percentage (0-100) in the `ulLevel` field.
- MCI_SET_DOOR_OPEN / MCI_SET_DOOR_CLOSED Controls the media cover or tray.
- MCI_SET_DOOR_LOCK / MCI_SET_DOOR_UNLOCK Disables/enables manual ejection.
- MCI_SET_TIME_FORMAT Sets the time format using `ulTimeFormat` (e.g., `MCI_FORMAT_MILLISECONDS`, `MCI_FORMAT_MMTIME`).
- MCI_SET_SPEED_FORMAT Sets the speed format (e.g., `MCI_FORMAT_PERCENTAGE`, `MCI_FORMAT_FPS`).
- MCI_OVER Specifies the duration in milliseconds over which an attribute change (like volume) should occur.
- Amplifier-Mixer Extensions
- Requires the `MCI_AMP_SET_PARMS` structure.
- MCI_AMP_SET_BALANCE, BASS, TREBLE, GAIN, PITCH: Sets the respective audio effect as a percentage (0-100) in the `ulLevel` field.
- Digital Video (DGV) Extensions
- MCI_DGV_SET_BRIGHTNESS, CONTRAST, HUE, SATURATION: Video adjustment (0-100).
- MCI_DGV_SET_MONITOR: Enables/disables a monitor window for the incoming signal.
- MCI_DGV_SET_VIDEO_COMPRESSION: Sets compression format (e.g., `MCI_VID_COMP_ULTI`).
- MCI_DGV_SET_SAMPLESPERSEC, BITSPERSAMPLE, CHANNELS: Configures audio recording settings.
- Sequencer Extensions
- MCI_SEQ_SET_MASTER / MCI_SEQ_SET_SLAVE: Sets synchronization (MIDI, SMPTE, or NONE).
- MCI_SEQ_SET_PORT: Sets the MIDI output port.
- MCI_SEQ_SET_TEMPO: Changes playback speed (BPM or FPS).
- pParam2 (PMCI_SET_PARMS) - input
- A pointer to the device-specific SET parameter structure (e.g., `MCI_SET_PARMS`, `MCI_AMP_SET_PARMS`, `MCI_DGV_SET_PARMS`).
Returns
- rc (ULONG) - returns
-
- MCIERR_SUCCESS Command completed successfully.
- MCIERR_INVALID_DEVICE_ID Invalid device ID.
- MCIERR_INVALID_FLAG An invalid flag was specified for this device.
- MCIERR_INSTANCE_INACTIVE The device is inactive.
- MCIERR_UNSUPPORTED_FUNCTION The device does not support the requested set action.
Remarks
When setting volume, values greater than 100 are treated as 100 without returning an error. Time formats set via this message affect all subsequent commands that involve positioning (like MCI_PLAY or MCI_SEEK).
Example Code
The following code sets the master volume to 50% over a period of 2 seconds.
USHORT usDeviceID;
MCI_SET_PARMS mciSetParms;
mciSetParms.ulLevel = 50; /* 50% Volume */
mciSetParms.ulOver = 2000; /* 2000 Milliseconds */
mciSendCommand( usDeviceID,
MCI_SET,
MCI_SET_VOLUME | MCI_OVER | MCI_WAIT,
(PVOID) &mciSetParms,
0);