Setting the Time Format

Use the MCI_SET command along with the MCI_SET_PARMS parameter block to set the time format for an open device. Set the dwTimeFormat field in the parameter block to one of the constants identified in the following table:

Time Format   Constant  

Waveform Devices   ^  
  Milliseconds   MCI_FORMAT_MILLISECONDS
  Samples   MCI_FORMAT_SAMPLES
  Bytes   MCI_FORMAT_BYTES
Compact Disc Devices   ^  
  Milliseconds   MCI_FORMAT_MILLISECONDS
  Minute/Second/Frame   MCI_FORMAT_MSF
  Track/Minute/Second/Frame   MCI_FORMAT_TMSF
MIDI Sequencer Devices   ^  
  Milliseconds   MCI_FORMAT_MILLISECONDS
  MIDI Song Pointer   MCI_SEQ_FORMAT_SONGPTR
  SMPTE, 24 Frame   MCI_FORMAT_SMPTE_24
  SMPTE, 25 Frame   MCI_FORMAT_SMPTE_25
  SMPTE, 30 Frame   MCI_FORMAT_SMPTE_30
  SMPTE, 30 Frame Drop   MCI_FORMAT_SMPTE_30DROP

As an example, the following code fragment sets the time format to milliseconds on the device specified by wDeviceID:

WORD wDeviceID;
MCI_SET_PARMS mciSetParms;
.
.
.
/* Set time format to milliseconds
 */
mciSetParms.dwTimeFormat = MCI_FORMAT_MILLISECONDS;
if (mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
                   (DWORD)(LPVOID) &mciSetParms))
    /* Error, unable to set time format
     */
    ...
else
    /* Time format set successfully
     */
    ...

Using the Minute/Second/Frame Time Format

For the minute/second/frame time format specified with the MCI_FORMAT_MSF constant, the time is relative to the beginning of the media. The time is packed into a DWORD, as shown in the following illustration:

The MMSYSTEM.H header file defines the following macros to get and set elements of a minute/second/frame packed DWORD:

MCI_MSF_MINUTE

Gets minute value in a minute/second/frame DWORD.

MCI_MSF_SECOND

Gets second value in a minute/second/frame DWORD.

MCI_MSF_FRAME

Gets frame value in a minute/second/frame DWORD.

MCI_MAKE_MSF

Sets minute, second, and frame values in a minute/second/frame DWORD.

Note:

The first few seconds of audio compact discs contain table of contents data. To play from the beginning of a disc using the minute/second/frame time format, use the MCI_STATUS command to get the position of the first track and play from that position.

Using the Track/Minute/Second/Frame Time Format

For the track/minute/second/frame time format specified with the MCI_FORMAT_TMSF constant, the time is relative to the beginning of the specified track. The time is packed into a DWORD, as shown in the following illustration:

The MMSYSTEM.H header file defines the following macros to get and set elements of a track/minute/second/frame packed DWORD:

MCI_TMSF_TRACK

Gets track value in a track/minute/second/frame DWORD.

MCI_TMSF_MINUTE

Gets minute value in a track/minute/second/frame DWORD.

MCI_TMSF_SECOND

Gets second value in a track/minute/second/frame DWORD.

MCI_TMSF_FRAME

Gets frame value in a track/minute/second/frame DWORD.

MCI_MAKE_TMSF

Sets track, minute, second, and frame values in a track/minute/second/frame DWORD.

Using the SMPTE Time Formats

SMPTE (Society of Motion Picture and Television Engineers) time formats are based on standard time formats developed for the motion picture and television industries. For SMPTE time formats, the time is packed into a DWORD, as shown in the following illustration: