79.3.7 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:

Constant Time Format

MCI_FORMAT_MILLISECONDS Milliseconds
MCI_FORMAT_SAMPLES Samples
MCI_FORMAT_BYTES Bytes (in PCM format files)
MCI_FORMAT_MILLISECONDS Milliseconds
MCI_FORMAT_MSF Minute/Second/Frame
MCI_FORMAT_TMSF Track/Minute/Second/Frame
MCI_FORMAT_MILLISECONDS Milliseconds
MCI_SEQ_FORMAT_SONGPTR MIDI Song Pointer
MCI_FORMAT_SMPTE_24 SMPTE, 24 Frame
MCI_FORMAT_SMPTE_25 SMPTE, 25 Frame
MCI_FORMAT_SMPTE_30 SMPTE, 30 Frame
MCI_FORMAT_SMPTE_30DROP SMPTE, 30 Frame Drop

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

UINT 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

*/

...

79.3.7.1 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:

This illustration is not available for this release

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

Macro Description

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.

79.3.7.2 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:

This illustration is not available for this release

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

Macro Description

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.

79.3.7.3 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:

This illustration is not available for this release