The waveOutGetPosition function retrieves the current playback position of the given waveform-audio output device.
本函数检索当前回放位置,在给定的波形音频输出设备上.
Syntax
MMRESULT waveOutGetPosition( HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
Parameters
-
hwo
-
Handle to the waveform-audio output device.
pmmt
-
Pointer to an MMTIME structure.
MMTIME结构的指针
cbmmt
-
Size, in bytes, of the MMTIME structure.
结构MMTIM的大小,字节表示
Return value
Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.
Return code | Description |
---|---|
| Specified device handle is invalid. |
| No device driver is present. |
| Unable to allocate or lock memory. |
Remarks
Before calling this function, set the wType member of the MMTIME structure to indicate the time format you want. After calling this function, check wType to determine whether the time format is supported. If the format is not supported, wType will specify an alternative format.
The position is set to zero when the device is opened or reset.
Requirements
Minimum supported client | Windows 2000 Professional |
---|---|
Minimum supported server | Windows 2000 Server |
Header |
|
Library |
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 9/7/2011
/* MMTIME data structure */
typedef struct mmtime_tag
{
UINT wType; /* indicates the contents of the union */
union
{
DWORD ms; /* milliseconds */
DWORD sample; /* samples */
DWORD cb; /* byte count */
DWORD ticks; /* ticks in MIDI stream */
/* SMPTE */
struct
{
BYTE hour; /* hours */
BYTE min; /* minutes */
BYTE sec; /* seconds */
BYTE frame; /* frames */
BYTE fps; /* frames per second */
BYTE dummy; /* pad */
#ifdef _WIN32
BYTE pad[2];
#endif
} smpte;
/* MIDI */
struct
{
DWORD songptrpos; /* song pointer position */
} midi;
} u;
} MMTIME, *PMMTIME, NEAR *NPMMTIME, FAR *LPMMTIME;
union共用体表示几个变量共用一个内存位置,在不同的时间保存不同的数据类型和不同长度的变量。在union中,所有的共用体成员共用一个空间,并且同一时间只能储存其中一个成员变量的值。当一个共用体被声明时, 编译程序自动地产生一个变量, 其长度为联合中最大的变量长度。由于union的资料成员共用一个内存空间,所以必须存取正确的成员才能正确的读取变量值,可以使用一个额外的变数或列举型态来记录最后一次使用空间的是哪个成员.
共用体和结构体有下列区别:
1. 共用体和结构体都是由多个不同的数据类型成员组成, 但在任何同一时刻, 共用体只存放了一个被选中的成员, 而结构体的所有成员都存在。
2. 对于共用体的不同成员赋值, 将会对其它成员重写, 原来成员的值就不存在了, 而对于结构体的不同成员赋值是互不影响的。