提示:
设备写满缓冲区返回给程序后, 须调用此函数;
释放(GlobalFree)缓冲区前, 须调用此函数;
取消一个尚未准备的缓冲区将无效, 但函数返回 0

//声明:
midiInUnprepareHeader(
  hMidiIn: HMIDIIN;      {设备句柄}
  lpMidiInHdr: PMidiHdr; {TMidiHdr 结构指针}
  uSize: UINT            {TMidiHdr 结构大小}
): MMRESULT;             {成功返回 0; 可能的错误值如下:}

MMSYSERR_INVALHANDLE = 5;  {设备句柄无效}
MIDIERR_STILLPLAYING = 65; {缓冲区还在队列中}

//TMidiHdr 是 midihdr_tag 结构的重定义:
midihdr_tag = record
  lpData: PChar;               {专用缓冲区的指针}
  dwBufferLength: DWORD;       {指定缓冲区长度}
  dwBytesRecorded: DWORD;      {输入时, 指定缓冲区中的数据量}
  dwUser: DWORD;               {指定用户数据}
  dwFlags: DWORD;              {指定缓冲区信息标志}
  lpNext: PMidiHdr;            {保留(给设备)}
  reserved: DWORD;             {保留(给设备)}
  dwOffset: DWORD;             {回调开始时, 缓冲区的偏移}
  dwReserved: array[0..7] of DWORD; {保留(给系统)}
end;

//dwFlags 的可选值:
MHDR_DONE     = $00000001; {设备已把缓冲区交还给程序}
MHDR_PREPARED = $00000002; {已为 midiInPrepareHeader 或 midiOutPrepareHeader 准备好缓冲区}
MHDR_INQUEUE  = $00000004; {保留(给设备)}
MHDR_ISSTRM   = $00000008; {是流缓冲区}

//举例:
posted on 2008-02-22 18:02  万一  阅读(1294)  评论(0编辑  收藏  举报