MMTIME is a standard time and media position format supported by the media control interface. This time unit is 1/3000 second, or 333 microseconds. Conversion macros are provided for convenient conversion of other popular time formats to and from this format. MMTIME values are passed as long (32-bit) integer values.
To use MMTIME on command messages, send the MCI_SET message specifying the MCI_SET_TIME_FORMAT flag. Use MCI_FORMAT_MMTIME in the ulTimeFormat field of the MCI_SET_PARMS structure.
The macros shown in the following figure are available for conversion to and from the MMTIME format.
┌──────────────────────────────┬──────────────────────────────┐ │Conversion to MMTIME │Conversion to Other Formats │ ├──────────────────────────────┼──────────────────────────────┤ │REDBOOKTOMM (ULONG) │REDBOOKFROMMM (ULONG) │ │FPS24TOMM (ULONG) │FPS24FROMMM (ULONG) │ │FPS25TOMM (ULONG) │FPS25FROMMM (ULONG) │ │FPS30TOMM (ULONG) │FPS30FROMMM (ULONG) │ │MSECTOMM (ULONG) │MSECFROMMM (ULONG) │ │HMSTOMM (ULONG) │HMSFROMMM (ULONG) │ └──────────────────────────────┴──────────────────────────────┘
Packed Time Formats
The packed time formats described in the following sections require that the application format the ULONG value passed in command message parameter structures. When these values are passed in string commands, any value containing a colon (:) is assumed to be a field-oriented value. For example, if the time format for a CD audio device is set to TMSF, and the value 4:10:00:00 is specified, this value is interpreted as track 4, 10 minutes, 0 seconds, and 0 frames. However, if the value 4100000 is specified, the integer is passed directly, and the assignment to byte fields is quite different.
It is not required that a field-oriented value contain specifications for all fields. For example, the following are equivalent specifications for track 4:
4:00:00:00 4:00:00 4:00: 4:00 4: 4
The interpretation of field-oriented values is left-justified with respect to the placement of colons. Values not specified default to zero. If a value has a colon, it is subject to field-oriented interpretation, regardless of the time format currently set for the device.
HMSF (SMPTE) Packed Time Format
The HMSF packed time format represents elapsed hours, minutes, seconds, and frames from any specified point. This time format is packed into a 32-bit ULONG value as follows:
┌───────────────┬───────────────┬───────────────┬───────────────┐ │High-Order Byte│Low-Order Byte │High-Order Byte│Low-Order Byte │ ├───────────────┼───────────────┼───────────────┼───────────────┤ │Frames │Seconds │Minutes │Hours │ └───────────────┴───────────────┴───────────────┴───────────────┘
The CD-DA MSF time format, also referred to as the Red Book time format, is based on the 75-frame-per-second CD digital audio standard. Media position values in this format are packed into a 32-bit ULONG value as follows:
┌───────────────┬───────────────┬───────────────┬───────────────┐ │High-Order Byte│Low-Order Byte │High-Order Byte│Low-Order Byte │ ├───────────────┼───────────────┼───────────────┼───────────────┤ │Reserved │Frames │Seconds │Minutes │ └───────────────┴───────────────┴───────────────┴───────────────┘
The following macros aid in extracting information in packed MSF format:
Macro
For example, the following code fragment sets the time in ulTime to 6 minutes and 30 seconds (06:30:00).
ULONG ulTime;. . . MSF_MINUTE(ulTime) = 6 MSF_SECOND(ulTime) = 30; MSF_FRAME(ulTime) = 0;
TMSF Packed Time Format
The CD-DA TMSF time format is based on the 75-frame-per-second CD digital audio standard. Media position values in this format are packed into a 32-bit ULONG value as follows:
┌───────────────┬───────────────┬───────────────┬───────────────┐ │High-Order Byte│Low-Order Byte │High-Order Byte│Low-Order Byte │ ├───────────────┼───────────────┼───────────────┼───────────────┤ │Frames │Seconds │Minutes │Track │ └───────────────┴───────────────┴───────────────┴───────────────┘
The following macros aid in extracting information in packed TMSF format:
Macro
For example, the following code fragment sets the time in ulTime to 2 minutes into track 2 (02:02:00:00).
ULONG ulTime;. . . TMSF_TRACK(ulTime) = 2; TMSF_MINUTE(ulTime) = 2; TMSF_SECOND(ulTime) = 0; TMSF_FRAME(ulTime) = 0;
Note: MSF and TMSF macros can be found in the MCIOS2.H file.
HMS Packed Time Format
The HMS packed time format, representing hours, minutes, and seconds, is packed into a 32-bit ULONG value as follows:
┌───────────────┬───────────────┬───────────────┬───────────────┐ │High-Order Byte│Low-Order Byte │High-Order Byte│Low-Order Byte │ ├───────────────┼───────────────┼───────────────┼───────────────┤ │Reserved │Seconds │Minutes │Hours │ └───────────────┴───────────────┴───────────────┴───────────────┘