waveOutGetPosition

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 codeDescription
MMSYSERR_INVALHANDLE

Specified device handle is invalid.

MMSYSERR_NODRIVER

No device driver is present.

MMSYSERR_NOMEM

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

Mmsystem.h (include Windows.h)

Library

Winmm.lib

DLL

Winmm.dll

See also

Waveform Audio Waveform Functions

 

 

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. 对于共用体的不同成员赋值, 将会对其它成员重写, 原来成员的值就不存在了, 而对于结构体的不同成员赋值是互不影响的。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值