Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5324 lines
132 KiB

  1. .refpage auxGetDevCaps
  2. WORD %auxGetDevCaps%(<wDeviceID>, <lpCaps>, <wSize>)
  3. This function queries a specified auxiliary output device to determine its
  4. capabilities.
  5. .parameters
  6. WORD <wDeviceID>
  7. Identifies the auxiliary output device to be queried.
  8. LPAUXCAPS <lpCaps>
  9. Specifies a far pointer to an AUXCAPS structure. This structure is
  10. filled with information about the capabilities of the device.
  11. WORD <wSize>
  12. Specifies the size of the AUXCAPS structure.
  13. .returns
  14. Returns zero if the function was successful. Otherwise, it returns an error
  15. number. Possible error returns are:
  16. .list Value Meaning
  17. MMSYSERR_BADDEVICEID
  18. Specified device ID is out of range.
  19. MMSYSERR_NODRIVER
  20. The driver failed to install.
  21. .endlist
  22. .comments
  23. Use %auxGetNumDevs% to determine the number of auxiliary output devices
  24. present in the system. The device ID specified by <wDeviceID> varies from
  25. zero to one less than the number of devices present.
  26. .seealso
  27. %auxGetNumDevs%
  28. .refpage auxGetNumDevs
  29. WORD %auxGetNumDevs%()
  30. This function retrieves the number of auxiliary output devices present in
  31. the system.
  32. .parameters
  33. None
  34. .returns
  35. Returns the number of auxiliary output devices present in the system.
  36. .seealso
  37. %auxGetDevCaps%
  38. .refpage auxGetVolume
  39. WORD %auxGetVolume%(<wDeviceID>, <lpdwVolume>)
  40. This function returns the current volume setting of an auxiliary output
  41. device.
  42. .parameters
  43. WORD <wDeviceID>
  44. Identifies the auxiliary output device to be queried.
  45. LPDWORD <lpdwVolume>
  46. Specifies a far pointer to a location to be filled with the current
  47. volume setting. The low-order word of this location contains the left
  48. channel volume setting, and the high-order word contains the right
  49. channel setting. A value of 0xFFFF represents full volume, and a value
  50. of 0x0000 is silence.
  51. If a device does not support both left and right volume control, the
  52. low-order word of the specified location contains the volume level.
  53. The full 16-bit setting(s) set with %auxSetVolume% are returned,
  54. regardless of whether the device supports the full 16 bits of volume
  55. level control.
  56. .returns
  57. Returns zero if the function was successful. Otherwise, it returns an error
  58. number. Possible error returns are:
  59. .list Value Meaning
  60. MMSYSERR_BADDEVICEID
  61. Specified device ID is out of range.
  62. MMSYSERR_NODRIVER
  63. The driver failed to install.
  64. .endlist
  65. .comments
  66. Not all devices support volume control. To determine whether the device
  67. supports volume control, use the AUXCAPS_VOLUME flag to test the %dwSupport%
  68. field of the %AUXCAPS% structure (filled by %auxGetDevCaps%).
  69. To determine whether the device supports volume control on both the left and
  70. right channels, use the AUXCAPS_LRVOLUME flag to test the %dwSupport% field
  71. of the %AUXCAPS% structure (filled by %auxGetDevCaps%).
  72. .seealso
  73. %auxSetVolume%
  74. .refpage auxSetVolume
  75. WORD %auxSetVolume%(<wDeviceID>, <dwVolume>)
  76. This function sets the volume in an auxiliary output device.
  77. .parameters
  78. WORD <wDeviceID>
  79. Identifies the auxiliary output device to be queried. Device IDs are
  80. determined implicitly from the number of devices present in the system.
  81. Device ID values range from zero to one less than the number of devices
  82. present. Use %auxGetNumDevs% to determine the number of auxiliary
  83. devices in the system.
  84. DWORD <dwVolume>
  85. Specifies the new volume setting. The low-order word specifies the left
  86. channel volume setting, and the high-order word specifies the right
  87. channel setting. A value of 0xFFFF represents full volume, and a value
  88. of 0x0000 is silence.
  89. If a device does not support both left and right volume control, the
  90. low-order word of <dwVolume> specifies the volume level, and the
  91. high-order word is ignored.
  92. .returns
  93. Returns zero if the function was successful. Otherwise, it returns an error
  94. number. Possible error returns are:
  95. .list Value Meaning
  96. MMSYSERR_BADDEVICEID
  97. Specified device ID is out of range.
  98. MMSYSERR_NODRIVER
  99. The driver failed to install.
  100. .endlist
  101. .comments
  102. Not all devices support volume control. To determine whether the device
  103. supports volume control, use the AUXCAPS_VOLUME flag to test the %dwSupport%
  104. field of the %AUXCAPS% structure (filled by %auxGetDevCaps%).
  105. To determine whether the device supports volume control on both the left and
  106. right channels, use the AUXCAPS_LRVOLUME flag to test the %dwSupport% field
  107. of the %AUXCAPS% structure (filled by %auxGetDevCaps%).
  108. Most devices do not support the full 16 bits of volume level control and
  109. will use only the high-order bits of the requested volume setting. For
  110. example, for a device that supports 4 bits of volume control, requested
  111. volume level values of 0x4000, 0x4fff, and 0x43be will all produce the same
  112. physical volume setting, 0x4000. The %auxGetVolume% function will return the
  113. full 16-bit setting set with %auxSetVolume%.
  114. Volume settings are interpreted logarithmically. This means the perceived
  115. volume increase is the same when increasing the volume level from 0x5000 to
  116. 0x6000 as it is from 0x4000 to 0x5000.
  117. .seealso
  118. %auxGetVolume%
  119. .refpage mciExecute
  120. BOOL %mciExecute%(<lpstrCommand>)
  121. This function is a simplified version of the %mciSendString% function. It
  122. does not take a buffer for return information, and it displays a message box
  123. when errors occur.
  124. .parameters
  125. LPSTR <lpstrCommand>
  126. Specifies an MCI command string.
  127. .returns
  128. TRUE if successful, FALSE if unsuccessful.
  129. .comments
  130. This function provides a simple interface to MCI from scripting languages.
  131. .seealso
  132. %mciSendString%
  133. .refpage mciGetErrorString
  134. WORD %mciGetErrorString%(<dwError>, <lpstrBuffer>, <wLength>)
  135. This function returns a textual description of the specified MCI error.
  136. .parameters
  137. DWORD <dwError>
  138. Specifies the error code returned by %mciSendCommand% or
  139. %mciSendString%.
  140. LPSTR <lpstrBuffer>
  141. Specifies a pointer to a buffer that is filled with a textual
  142. description of the specified error.
  143. WORD <wLength>
  144. Specifies the length of the buffer pointed to by <lpstrBuffer>.
  145. .returns
  146. Returns TRUE if successful. Otherwise, the given error code was not known.
  147. .refpage mciSendCommand
  148. DWORD %mciSendCommand%(<wDeviceID>, <wMessage>, <dwParam1>, <dwParam2>)
  149. This function sends a command message to the specified MCI device.
  150. .parameters
  151. WORD <wDeviceID>
  152. Specifies the device ID of the MCI device to receive the command. This
  153. parameter is not used with the %MCI_OPEN% command.
  154. WORD <wMessage>
  155. Specifies the command message.
  156. DWORD <dwParam1>
  157. Specifies flags for the command.
  158. DWORD <dwParam2>
  159. Specifies a pointer to a parameter block for the command.
  160. .returns
  161. Returns zero if the function was successful. Otherwise, it returns error
  162. information. The low-order word of the returned DWORD is the error return
  163. value. If the error is device-specific, the high-order word contains the
  164. driver ID; otherwise the high-order word is zero.
  165. To get a textual description of %mciSendCommand% return values, pass the
  166. return value to %mciGetErrorString%.
  167. Error values that are returned when a device is being opened are listed with
  168. the MCI_OPEN message. In addition to the MCI_OPEN error returns, this
  169. function can return the following values:
  170. MCIERR_BAD_TIME_FORMAT
  171. Illegal value for time format.
  172. MCIERR_CANNOT_USE_ALL
  173. The device name "all" is not allowed for this command.
  174. MCIERR_CREATEWINDOW
  175. Could not create or use window.
  176. MCIERR_DEVICE_LOCKED
  177. The device is locked until it is closed automatically.
  178. MCIERR_DEVICE_NOT_READY
  179. Device not ready.
  180. MCIERR_DEVICE_TYPE_REQUIRED
  181. The device name must be a valid device type.
  182. MCIERR_DRIVER
  183. Unspecified device error.
  184. MCIERR_DRIVER_INTERNAL
  185. Internal driver error.
  186. MCIERR_FILE_NOT_FOUND
  187. Requested file not found.
  188. MCIERR_FILE_NOT_SAVED
  189. The file was not saved.
  190. MCIERR_FILE_READ
  191. A read from the file failed.
  192. MCIERR_FILE_WRITE
  193. A write to the file failed.
  194. MCIERR_FLAGS_NOT_COMPATIBLE
  195. Incompatible parameters were specified.
  196. MCIERR_HARDWARE
  197. Hardware error on media device.
  198. MCIERR_INTERNAL
  199. Internal error.
  200. MCIERR_INVALID_DEVICE_ID
  201. Invalid device ID.
  202. MCIERR_INVALID_DEVICE_NAME
  203. The device is not open or is not known.
  204. MCIERR_INVALID_FILE
  205. Invalid file format.
  206. MCIERR_MULTIPLE
  207. Errors occurred in more than one device.
  208. MCIERR_NO_WINDOW
  209. There is no display window.
  210. MCIERR_NULL_PARAMETER_BLOCK
  211. Parameter block pointer was NULL.
  212. MCIERR_OUT_OF_MEMORY
  213. Not enough memory for requested operation.
  214. MCIERR_OUTOFRANGE
  215. Parameter value out of range.
  216. MCIERR_UNNAMED_RESOURCE
  217. Attempt to save unnamed file.
  218. MCIERR_UNRECOGNIZED_COMMAND
  219. Unknown command.
  220. MCIERR_UNSUPPORTED_FUNCTION
  221. Action not available for this device.
  222. The following additional return values are defined for MCI sequencers:
  223. MCIERR_SEQ_DIV_INCOMPATIBLE
  224. Set Song Pointer incompatible with SMPTE files.
  225. MCIERR_SEQ_PORT_INUSE
  226. Specified port is in use.
  227. MCIERR_SEQ_PORT_MAPNODEVICE
  228. Current map uses non-existent device.
  229. MCIERR_SEQ_PORT_MISCERROR
  230. Miscellaneous error with specified port.
  231. MCIERR_SEQ_PORT_NONEXISTENT
  232. Specified port does not exist.
  233. MCIERR_SEQ_PORTUNSPECIFIED
  234. No current MIDI port.
  235. MCIERR_SEQ_TIMER
  236. Timer error.
  237. The following additional return values are defined for MCI waveform
  238. audio devices:
  239. MCIERR_WAVE_INPUTSINUSE
  240. No compatible waveform recording device is free.
  241. MCIERR_WAVE_INPUTSUNSUITABLE
  242. No compatible waveform recording devices.
  243. MCIERR_WAVE_INPUTUNSPECIFIED
  244. Any compatible waveform recording device may be used.
  245. MCIERR_WAVE_OUTPUTSINUSE
  246. No compatible waveform playback device is free.
  247. MCIERR_WAVE_OUTPUTSUNSUITABLE
  248. No compatible waveform playback devices.
  249. MCIERR_WAVE_OUTPUTUNSPECIFIED
  250. Any compatible waveform playback device may be used.
  251. MCIERR_WAVE_SETINPUTINUSE
  252. Set waveform recording device is in use.
  253. MCIERR_WAVE_SETINPUTUNSUITABLE
  254. Set waveform recording device is incompatible with set format.
  255. MCIERR_WAVE_SETOUTPUTINUSE
  256. Set waveform playback device is in use.
  257. MCIERR_WAVE_SETOUTPUTUNSUITABLE
  258. Set waveform playback device is incompatible with set format.
  259. .comments
  260. Use the %MCI_OPEN% command to obtain the device ID specified by
  261. <wDeviceID>.
  262. .seealso
  263. %mciGetErrorString%, %mciSendString%
  264. .refpage mciSendString
  265. DWORD %mciSendString%(<lpstrCommand>, <lpstrReturnString>, <wReturnLength>,
  266. <hCallback>)
  267. This function sends a command string to an MCI device. The device that the
  268. command is sent to is specified in the command string.
  269. .parameters
  270. LPSTR <lpstrCommand>
  271. Specifies an MCI command string.
  272. LPSTR <lpstrReturnString>
  273. Specifies a buffer for return information. If no return information is
  274. needed, you can specify NUL for this parameter.
  275. WORD <wReturnLength>
  276. Specifies the size of the return buffer specified by
  277. <lpstrReturnString>.
  278. HANDLE <hCallback>
  279. Specifies a handle to a window to call back if "notify" was specified in
  280. the command string.
  281. .returns
  282. Returns zero if the function was successful. Otherwise, it returns error
  283. information. The low-order word of the returned DWORD contains the error
  284. return value.
  285. To get a textual description of %mciSendString% return values, pass the
  286. return value to %mciGetErrorString%.
  287. The error returns listed for %mciSendCommand% also apply to %mciSendString%.
  288. The following error returns are unique to %mciSendString%:
  289. MCIERR_BAD_CONSTANT
  290. Unknown value for parameter.
  291. MCIERR_BAD_INTEGER
  292. Invalid or missing integer in command.
  293. MCIERR_DUPLICATE_FLAGS
  294. A flag or value was specified twice.
  295. MCIERR_MISSING_COMMAND_STRING
  296. No command was specified.
  297. MCIERR_MISSING_DEVICE_NAME
  298. No device name was specified.
  299. MCIERR_MISSING_STRING_ARGUMENT
  300. A string value was missing from the command.
  301. MCIERR_NEW_REQUIRES_ALIAS
  302. An alias must be used with the "new" device name.
  303. MCIERR_NO_CLOSING_QUOTE
  304. A closing quotation mark is missing.
  305. MCIERR_NOTIFY_ON_AUTO_OPEN
  306. The "notify" flag is illegal with auto-open.
  307. MCIERR_PARAM_OVERFLOW
  308. The output string was not long enough.
  309. MCIERR_PARSER_INTERNAL
  310. Internal parser error.
  311. MCIERR_UNRECOGNIZED_KEYWORD
  312. Unknown command parameter.
  313. .seealso
  314. %mciExecute%, %mciGetErrorString%, %mciSendCommand%
  315. .refpage mciSetYieldProc
  316. WORD FAR %mciSetYieldProc%(<wDeviceID>, <fpYieldProc>, <dwYieldData>)
  317. This function sets the address of a callback procedure to be called
  318. periodically when an MCI device is completing a command specified with the
  319. WAIT flag.
  320. .parameters
  321. WORD <wDeviceID>
  322. Specifies the device ID of the MCI device to which the yield procedure
  323. is to be assigned.
  324. YIELDPROC <fpYieldProc>
  325. Specifies the callback procedure to be called when the given device is
  326. yielding. Specify a NULL value to disable any existing yield procedure.
  327. DWORD <dwYieldData>
  328. Specifies the data sent to the yield procedure when it is called for the
  329. given device.
  330. .returns
  331. Returns TRUE if successful. Returns FALSE for an invalid device ID.
  332. .head "Callback"
  333. int FAR PASCAL %YieldProc%(<wDeviceID>, <dwData>)
  334. %YieldProc% is a placeholder for the application-supplied function name.
  335. Export the actual name by including it in the EXPORTS statement in your
  336. module-definition file.
  337. %Parameters%
  338. WORD <wDeviceID>
  339. Specifies the device ID of the MCI device.
  340. DWORD <dwData>
  341. Specifies the application-supplied yield data originally supplied in the
  342. <dwYieldData> parameter.
  343. %Return Value%
  344. Return zero to continue the operation. To cancel the operation, return a
  345. nonzero value.
  346. %Comments%
  347. This call overides any previous yield procedure for this device.
  348. .refpage MessageBeep
  349. void %MessageBeep%(<wAlert>)
  350. This function plays a waveform sound corresponding to a given system alert
  351. level. The sound for each alert level is identified by an entry in the
  352. [sounds] section of WIN.INI.
  353. .parameters
  354. WORD <wAlert>
  355. Specifies the alert level. Use one of the following values:
  356. MB_OK
  357. Plays the sound identified by the "SystemDefault" entry in the [sounds]
  358. section of WIN.INI.
  359. MB_ICONASTERISK
  360. Plays the sound identified by the "SystemAsterisk" entry in the [sounds]
  361. section of WIN.INI.
  362. MB_ICONEXCLAMATION
  363. Plays the sound identified by the "SystemExclamation" entry in the
  364. [sounds] section of WIN.INI.
  365. MB_ICONHAND
  366. Plays the sound identified by the "SystemHand" entry in the [sounds]
  367. section of WIN.INI.
  368. MB_ICONQUESTION
  369. Plays the sound identified by the "SystemQuestion" entry in the [sounds]
  370. section of WIN.INI.
  371. 0
  372. Plays the sound identified by the "SystemDefault" entry in the [sounds]
  373. section of WIN.INI.
  374. -1
  375. Produces a standard beep sound using the computer speaker.
  376. .returns
  377. None
  378. .comments
  379. %MessageBeep% returns control to the caller after queuing the sound and
  380. plays the sound asynchronously.
  381. If the specified alert sound can't be played, %MessageBeep% tries to play
  382. the system default sound. If the system default sound can't be played, it
  383. produces a standard beep sound using the computer speaker.
  384. The user can disable the warning beep using the Sounds control-panel
  385. applet.
  386. .seealso
  387. %sndPlaySound%
  388. .refpage midiInAddBuffer
  389. WORD %midiInAddBuffer%(<hMidiIn>, <lpMidiInHdr>, <wSize>)
  390. This function sends an input buffer to a specified opened MIDI input device.
  391. When the buffer is filled, it is sent back to the application. Input buffers
  392. are used only for system exclusive messages.
  393. .parameters
  394. HMIDIIN <hMidiIn>
  395. Specifies a handle to the MIDI input device.
  396. LPMIDIHDR <lpMidiInHdr>
  397. Specifies a far pointer to a %MIDIHDR% structure that identifies the
  398. buffer.
  399. WORD <wSize>
  400. Specifies the size of the %MIDIHDR% structure.
  401. .returns
  402. Returns zero if the function was successful. Otherwise, it returns an error
  403. number. Possible error returns are:
  404. .list Value Meaning
  405. MMSYSERR_INVALHANDLE
  406. Specified device handle is invalid.
  407. MIDIERR_UNPREPARED
  408. <lpMidiInHdr> hasn't been prepared.
  409. .endlist
  410. .comments
  411. The data buffer must be prepared with %midiInPrepareHeader% before it is
  412. passed to %midiInAddBuffer%. The %MIDIHDR% data structure and the data
  413. buffer pointed to by its %lpData% field must be allocated with %GlobalAlloc%
  414. using the GMEM_MOVEABLE and GMEM_SHARE flags, and locked with %GlobalLock%.
  415. .seealso
  416. %midiInPrepareHeader%
  417. .refpage midiInClose
  418. WORD %midiInClose%(<hMidiIn>)
  419. This function closes the specified MIDI input device.
  420. .parameters
  421. HMIDIIN <hMidiIn>
  422. Specifies a handle to the MIDI input device. If the function is
  423. successful, the handle is no longer valid after this call.
  424. .returns
  425. Returns zero if the function was successful. Otherwise, it returns an error
  426. number. Possible error returns are:
  427. .list Value Meaning
  428. MMSYSERR_INVALHANDLE
  429. Specified device handle is invalid.
  430. MIDIERR_STILLPLAYING
  431. There are still buffers in the queue.
  432. .endlist
  433. .comments
  434. If there are input buffers that have been sent with %midiInAddBuffer% and
  435. haven't been returned to the application, the close operation will fail.
  436. Call %midiInReset% to mark all pending buffers as being done.
  437. .seealso
  438. %midiInOpen%, %midiInReset%
  439. .refpage midiInGetDevCaps
  440. WORD %midiInGetDevCaps%(<wDeviceID>, <lpCaps>, <wSize>)
  441. This function queries a specified MIDI input device to determine its
  442. capabilities.
  443. .parameters
  444. WORD <wDeviceID>
  445. Identifies the MIDI input device.
  446. LPMIDIINCAPS <lpCaps>
  447. Specifies a far pointer to a %MIDIINCAPS% data structure. This structure
  448. is filled with information about the capabilities of the device.
  449. WORD <wSize>
  450. Specifies the size of the %MIDIINCAPS% structure.
  451. .returns
  452. Returns zero if the function was successful. Otherwise, it returns an error
  453. number. Possible error returns are:
  454. .list Value Meaning
  455. MMSYSERR_BADDEVICEID
  456. Specified device ID is out of range.
  457. MMSYSERR_NODRIVER
  458. The driver was not installed.
  459. .endlist
  460. .comments
  461. Use %midiInGetNumDevs% to determine the number of MIDI input devices present
  462. in the system. The device ID specified by <wDeviceID> varies from zero to
  463. one less than the number of devices present. Only <wSize> bytes (or less) of
  464. information is copied to the location pointed to by <lpCaps>. If <wSize> is
  465. zero, nothing is copied, and the function returns zero.
  466. .seealso
  467. %midiInGetNumDevs%
  468. .refpage midiInGetErrorText
  469. WORD %midiInGetErrorText%(<wError>, <lpText>, <wSize>)
  470. This function retrieves a textual description of the error identified by the
  471. specified error number.
  472. .parameters
  473. WORD <wError>
  474. Specifies the error number.
  475. LPSTR <lpText>
  476. Specifies a far pointer to the buffer to be filled with the textual
  477. error description.
  478. WORD <wSize>
  479. Specifies the length of buffer pointed to by <lpText>.
  480. .returns
  481. Returns zero if the function was successful. Otherwise, it returns an error
  482. number. Possible error returns are:
  483. .list Value Meaning
  484. MMSYSERR_BADERRNUM
  485. Specified error number is out of range.
  486. .endlist
  487. .comments
  488. If the textual error description is longer than the specified buffer, the
  489. description is truncated. The returned error string is always
  490. null-terminated. If <wSize> is zero, nothing is copied, and the function
  491. returns zero. All error descriptions are less than MAXERRORLENGTH characters
  492. long.
  493. .refpage midiInGetID
  494. WORD %midiInGetID%(<hMidiIn>, <lpwDeviceID>)
  495. This function gets the device ID for a MIDI input device.
  496. .parameters
  497. HMIDIIN <hMidiIn>
  498. Specifies the handle to the MIDI input device.
  499. LPWORD <lpwDeviceID>
  500. Specifies a pointer to the WORD-sized memory location to be filled with
  501. the device ID.
  502. .returns
  503. Returns zero if successful. Otherwise, returns an error number. Possible
  504. error returns are:
  505. MMSYSERR_INVALHANDLE
  506. The <hMidiIn> parameter specifies an invalid handle.
  507. .refpage midiInGetNumDevs
  508. WORD %midiInGetNumDevs%()
  509. This function retrieves the number of MIDI input devices in the system.
  510. .parameters
  511. None
  512. .returns
  513. Returns the number of MIDI input devices present in the system.
  514. .seealso
  515. %midiInGetDevCaps%
  516. .refpage midiInOpen
  517. WORD %midiInOpen%(<lphMidiIn>, <wDeviceID>, <dwCallback>,
  518. <dwCallbackInstance>, <dwFlags>)
  519. This function opens a specified MIDI input device.
  520. .parameters
  521. LPHMIDIIN <lphMidiIn>
  522. Specifies a far pointer to an HMIDIIN handle. This location is filled
  523. with a handle identifying the opened MIDI input device. Use the handle
  524. to identify the device when calling other MIDI input functions.
  525. WORD <wDeviceID>
  526. Identifies the MIDI input device to be opened.
  527. DWORD <dwCallback>
  528. Specifies the address of a fixed callback function or a handle to a
  529. window called with information about incoming MIDI messages.
  530. DWORD <dwCallbackInstance>
  531. Specifies user instance data passed to the callback function. This
  532. parameter is not used with window callbacks.
  533. DWORD <dwFlags>
  534. Specifies a callback flag for opening the device.
  535. CALLBACK_WINDOW
  536. If this flag is specified, <dwCallback> is assumed to be a window
  537. handle.
  538. CALLBACK_FUNCTION
  539. If this flag is specified, <dwCallback> is assumed to be a callback
  540. procedure address.
  541. .returns
  542. Returns zero if the function was successful. Otherwise, it returns an error
  543. number. Possible error returns are:
  544. .list Value Meaning
  545. MMSYSERR_BADDEVICEID
  546. Specified device ID is out of range.
  547. MMSYSERR_ALLOCATED
  548. Specified resource is already allocated.
  549. MMSYSERR_NOMEM
  550. Unable to allocate or lock memory.
  551. .endlist
  552. .comments
  553. Use %midiInGetNumDevs% to determine the number of MIDI input devices present
  554. in the system. The device ID specified by <wDeviceID> varies from zero to
  555. one less than the number of devices present.
  556. If a window is chosen to receive callback information, the following
  557. messages are sent to the window procedure function to indicate the progress
  558. of MIDI input:
  559. .blist
  560. o %MM_MIM_OPEN%
  561. o %MM_MIM_CLOSE%
  562. o %MM_MIM_DATA%
  563. o %MM_MIM_LONGDATA%
  564. o %MM_MIM_ERROR%
  565. o %MM_MIM_LONGERROR%
  566. .endblist
  567. If a function is chosen to receive callback information, the following
  568. messages are sent to the function to indicate the progress of MIDI input:
  569. .blist
  570. o %MIM_OPEN%, %MIM_CLOSE%
  571. o %MIM_DATA%
  572. o %MIM_LONGDATA%
  573. o %MIM_ERROR%
  574. o %MIM_LONGERROR%
  575. .endblist
  576. The callback function must reside in a DLL. You do not have to use
  577. %MakeProcInstance% to get a procedure-instance address for the callback
  578. function.
  579. .head "Callback"
  580. void FAR PASCAL %MidiInFunc%(<hMidiIn>, <wMsg>, <dwInstance>, <dwParam1>,
  581. <dwParam2>)
  582. %MidiInFunc% is a placeholder for the application-supplied function name.
  583. The actual name must be exported by including it in an EXPORTS statement in
  584. the DLL's module definition file.
  585. %Parameters%
  586. HMIDIIN <hMidiIn>
  587. Specifies a handle to the MIDI input device.
  588. WORD <wMsg>
  589. Specifies a MIDI input message.
  590. DWORD <dwInstance>
  591. Specifies the instance data supplied with %midiInOpen%.
  592. DWORD <dwParam1>
  593. Specifies a parameter for the message.
  594. DWORD <dwParam2>
  595. Specifies a parameter for the message.
  596. %Comments%
  597. Because the callback is accessed at interrupt time, it must reside in a DLL,
  598. and its code segment must be specified as FIXED in the module-definition
  599. file for the DLL. Any data that the callback accesses must be in a FIXED
  600. data segment as well. The callback may not make any system calls except for
  601. %PostMessage%, %timeGetSystemTime%, %timeGetTime%, %timeSetEvent%,
  602. %timeKillEvent%, %midiOutShortMsg%, %midiOutLongMsg%, and %OutputDebugStr%.
  603. .seealso
  604. %midiInClose%
  605. .refpage midiInPrepareHeader
  606. WORD %midiInPrepareHeader%(<hMidiIn>, <lpMidiInHdr>, <wSize>)
  607. This function prepares a buffer for MIDI input.
  608. .parameters
  609. HMIDIIN <hMidiIn>
  610. Specifies a handle to the MIDI input device.
  611. LPMIDIHDR <lpMidiInHdr>
  612. Specifies a pointer to a %MIDIHDR% structure that identifies the buffer
  613. to be prepared.
  614. WORD <wSize>
  615. Specifies the size of the %MIDIHDR% structure.
  616. .returns
  617. Returns zero if the function was successful. Otherwise, it returns an error
  618. number. Possible error returns are:
  619. .list Value Meaning
  620. MMSYSERR_INVALHANDLE
  621. Specified device handle is invalid.
  622. MMSYSERR_NOMEM
  623. Unable to allocate or lock memory.
  624. .endlist
  625. .comments
  626. The %MIDIHDR% data structure and the data block pointed to by its %lpData%
  627. field must be allocated with %GlobalAlloc% using the GMEM_MOVEABLE and
  628. GMEM_SHARE flags, and locked with %GlobalLock%. Preparing a header that has
  629. already been prepared has no effect, and the function returns zero.
  630. .seealso
  631. %midiInUnprepareHeader%
  632. .refpage midiInReset
  633. WORD %midiInReset%(<hMidiIn>)
  634. This function stops input on a given MIDI input device and marks all pending
  635. input buffers as done.
  636. .parameters
  637. HMIDIIN <hMidiIn>
  638. Specifies a handle to the MIDI input device.
  639. .returns
  640. Returns zero if the function was successful. Otherwise, it returns an error
  641. number. Possible error returns are:
  642. .list Value Meaning
  643. MMSYSERR_INVALHANDLE
  644. Specified device handle is invalid.
  645. .endlist
  646. .seealso
  647. %midiInStart%, %midiInStop%, %midiInAddBuffer%, %midiInClose%
  648. .refpage midiInStart
  649. WORD %midiInStart%(<hMidiIn>)
  650. This function starts MIDI input on the specified MIDI input device.
  651. .parameters
  652. HMIDIIN <hMidiIn>
  653. Specifies a handle to the MIDI input device.
  654. .returns
  655. Returns zero if the function was successful. Otherwise, it returns an error
  656. number. Possible error returns are:
  657. .list Value Meaning
  658. MMSYSERR_INVALHANDLE
  659. Specified device handle is invalid.
  660. .endlist
  661. .comments
  662. This function resets the timestamps to zero; timestamp values for
  663. subsequently received messages are relative to the time this function was
  664. called.
  665. All messages other than system exclusive messages are sent directly to the
  666. client when received. System exclusive messages are placed in the buffers
  667. supplied by %midiInAddBuffer%; if there are no buffers in the queue, the
  668. data is thrown away without notification to the client, and input
  669. continues.
  670. Buffers are returned to the client when full, when a complete system
  671. exclusive message has been received, or when %midiInReset% is called. The
  672. %dwBytesRecorded% field in the header will contain the actual length of data
  673. received.
  674. Calling this function when input is already started has no effect, and the
  675. function returns zero.
  676. .seealso
  677. %midiInStop%, %midiInReset%
  678. .refpage midiInStop
  679. WORD %midiInStop%(<hMidiIn>)
  680. This function terminates MIDI input on the specified MIDI input device.
  681. .parameters
  682. HMIDIIN <hMidiIn>
  683. Specifies a handle to the MIDI input device.
  684. .returns
  685. Returns zero if the function was successful. Otherwise, it returns an error
  686. number. Possible error returns are:
  687. .list Value Meaning
  688. MMSYSERR_INVALHANDLE
  689. Specified device handle is invalid.
  690. .endlist
  691. .comments
  692. Current status (running status, parsing state, etc.) is maintained across
  693. calls to %midiInStop% and %midiInStart%. If there are any system exclusive
  694. message buffers in the queue, the current buffer is marked as done (the
  695. %dwBytesRecorded% field in the header will contain the actual length of
  696. data), but any empty buffers in the queue remain there. Calling this
  697. function when input is not started has no no effect, and the function
  698. returns zero.
  699. .seealso
  700. %midiInStart%, %midiInReset%
  701. .refpage midiInUnprepareHeader
  702. WORD %midiInUnprepareHeader%(<hMidiIn>, <lpMidiInHdr>, <wSize>)
  703. This function cleans up the preparation performed by %midiInPrepareHeader%.
  704. The %midiInUnprepareHeader% function must be called after the device driver
  705. fills a data buffer and returns it to the application. You must call this
  706. function before freeing the data buffer.
  707. .parameters
  708. HMIDIIN <hMidiIn>
  709. Specifies a handle to the MIDI input device.
  710. LPMIDIHDR <lpMidiInHdr>
  711. Specifies a pointer to a %MIDIHDR% structure identifying the data buffer
  712. to be cleaned up.
  713. WORD <wSize>
  714. Specifies the size of the %MIDIHDR% structure.
  715. .returns
  716. Returns zero if the function was successful. Otherwise, it returns an error
  717. number. Possible error returns are:
  718. .list Value Meaning
  719. MMSYSERR_INVALHANDLE
  720. Specified device handle is invalid.
  721. MIDIERR_STILLPLAYING
  722. <lpMidiInHdr> is still in the queue.
  723. .endlist
  724. .comments
  725. This function is the complementary function to %midiInPrepareHeader%. You
  726. must call this function before freeing the data buffer with %GlobalFree%.
  727. After passing a buffer to the device driver with %midiInAddBuffer%, you must
  728. wait until the driver is finished with the buffer before calling
  729. %midiInUnprepareHeader%. Unpreparing a buffer that has not been prepared has
  730. no effect, and the function returns zero.
  731. .seealso
  732. %midiInPrepareHeader%
  733. .refpage midiOutCacheDrumPatches
  734. WORD %midiOutCacheDrumPatches%(<hMidiOut>, <wPatch>, <lpKeyArray>, <wFlags>)
  735. This function requests that an internal MIDI synthesizer device preload a
  736. specified set of key-based percussion patches. Some synthesizers are not
  737. capable of keeping all percussion patches loaded simultaneously. Caching
  738. patches ensures specified patches are available.
  739. .parameters
  740. HMIDIOUT <hMidiOut>
  741. Specifies a handle to the opened MIDI output device. This device should
  742. be an internal MIDI synthesizer.
  743. WORD <wPatch>
  744. Specifies which drum patch number should be used. Currently, this
  745. parameter must be set to zero.
  746. LPKEYARRAY <lpKeyArray>
  747. Specifies a pointer to a %KEYARRAY% array indicating the key numbers of
  748. the specified percussion patches to be cached or uncached.
  749. WORD <wFlags>
  750. Specifies options for the cache operation. Only one of the following
  751. flags can be specified:
  752. MIDI_CACHE_ALL
  753. Cache all of the specified patches. If they can't all be cached, cache
  754. none, clear the %KEYARRAY% array, and return MMSYSERR_NOMEM.
  755. MIDI_CACHE_BESTFIT
  756. Cache all of the specified patches. If all patches can't be cached,
  757. cache as many patches as possible, change the %KEYARRAY% array to
  758. reflect which patches were cached, and return MMSYSERR_NOMEM.
  759. MIDI_CACHE_QUERY
  760. Change the %KEYARRAY% array to indicate which patches are currently
  761. cached.
  762. MIDI_UNCACHE
  763. Uncache the specified patches and clear the %KEYARRAY% array.
  764. .returns
  765. Returns zero if the function was successful. Otherwise, it returns one of
  766. the following error codes:
  767. MMSYSERR_INVALHANDLE
  768. The specified device handle is invalid.
  769. MMSYSERR_NOTSUPPORTED
  770. The specified device does not support patch caching.
  771. MMSYSERR_NOMEM
  772. The device does not have enough memory to cache all of the requested
  773. patches.
  774. .comments
  775. The %KEYARRAY% data type is defined as:
  776. typedef WORD KEYARRAY[128];
  777. Each element of the array represents one of the 128 key-based percussion
  778. patches and has bits set for each of the 16 MIDI channels that use that
  779. particular patch. The least-significant bit represents physical channel 0;
  780. the most-significant bit represents physical channel 15. For example, if the
  781. patch on key number 60 is used by physical channels 9 and 15, element 60
  782. would be set to 0x8200.
  783. This function applies only to internal MIDI synthesizer devices. Not all
  784. internal synthesizers support patch caching. Use the MIDICAPS_CACHE flag to
  785. test the %dwSupport% field of the %MIDIOUTCAPS% structure filled by
  786. %midiOutGetDevCaps% to see if the device supports patch caching.
  787. .seealso
  788. %midiOutCachePatches%
  789. .refpage midiOutCachePatches
  790. WORD %midiOutCachePatches%(<hMidiOut>, <wBank>, <lpPatchArray>, <wFlags>)
  791. This function requests that an internal MIDI synthesizer device preload a
  792. specified set of patches. Some synthesizers are not capable of keeping all
  793. patches loaded simultaneously and must load data from disk when they receive
  794. MIDI program change messages. Caching patches ensures specified patches are
  795. immediately available.
  796. .parameters
  797. HMIDIOUT <hMidiOut>
  798. Specifies a handle to the opened MIDI output device. This device must be
  799. an internal MIDI synthesizer.
  800. WORD <wBank>
  801. Specifies which bank of patches should be used. Currently, this
  802. parameter must be set to zero.
  803. LPPATCHARRAY <lpPatchArray>
  804. Specifies a pointer to a %PATCHARRAY% array indicating the patches to be
  805. cached or uncached.
  806. WORD <wFlags>
  807. Specifies options for the cache operation. Only one of the following
  808. flags can be specified:
  809. MIDI_CACHE_ALL
  810. Cache all of the specified patches. If they can't all be cached, cache
  811. none, clear the %PATCHARRAY% array, and return MMSYSERR_NOMEM.
  812. MIDI_CACHE_BESTFIT
  813. Cache all of the specified patches. If all patches can't be cached,
  814. cache as many patches as possible, change the %PATCHARRAY% array to
  815. reflect which patches were cached, and return MMSYSERR_NOMEM.
  816. MIDI_CACHE_QUERY
  817. Change the %PATCHARRAY% array to indicate which patches are currently
  818. cached.
  819. MIDI_UNCACHE
  820. Uncache the specified patches and clear the %PATCHARRAY% array.
  821. .returns
  822. Returns zero if the function was successful. Otherwise, it returns one of
  823. the following error codes:
  824. MMSYSERR_INVALHANDLE
  825. The specified device handle is invalid.
  826. MMSYSERR_NOTSUPPORTED
  827. The specified device does not support patch caching.
  828. MMSYSERR_NOMEM
  829. The device does not have enough memory to cache all of the requested
  830. patches.
  831. .comments
  832. The %PATCHARRAY% data type is defined as:
  833. typedef WORD PATCHARRAY[128];
  834. Each element of the array represents one of the 128 patches and has bits set
  835. for each of the 16 MIDI channels that use that particular patch. The
  836. least-significant bit represents physical channel 0; the most-significant
  837. bit represents physical channel 15 (0x0F). For example, if patch 0 is used
  838. by physical channels 0 and 8, element 0 would be set to 0x0101.
  839. This function only applies to internal MIDI synthesizer devices. Not all
  840. internal synthesizers support patch caching. Use the MIDICAPS_CACHE flag to
  841. test the %dwSupport% field of the %MIDIOUTCAPS% structure filled by
  842. %midiOutGetDevCaps% to see if the device supports patch caching.
  843. .seealso
  844. %midiOutCacheDrumPatches%
  845. .refpage midiOutClose
  846. WORD %midiOutClose%(<hMidiOut>)
  847. This function closes the specified MIDI output device.
  848. .parameters
  849. HMIDIOUT <hMidiOut>
  850. Specifies a handle to the MIDI output device. If the function is
  851. successful, the handle is no longer valid after this call.
  852. .returns
  853. Returns zero if the function was successful. Otherwise, it returns an error
  854. number. Possible error returns are:
  855. .list Value Meaning
  856. MMSYSERR_INVALHANDLE
  857. Specified device handle is invalid.
  858. MIDIERR_STILLPLAYING
  859. There are still buffers in the queue.
  860. .endlist
  861. .comments
  862. If there are output buffers that have been sent with %midiOutLongMsg% and
  863. haven't been returned to the application, the close operation will fail.
  864. Call %midiOutReset% to mark all pending buffers as being done.
  865. .seealso
  866. %midiOutOpen%, %midiOutReset%
  867. .refpage midiOutGetDevCaps
  868. WORD %midiOutGetDevCaps%(<wDeviceID>, <lpCaps>, <wSize>)
  869. This function queries a specified MIDI output device to determine its
  870. capabilities.
  871. .parameters
  872. WORD <wDeviceID>
  873. Identifies the MIDI output device.
  874. LPMIDIOUTCAPS <lpCaps>
  875. Specifies a far pointer to a %MIDIOUTCAPS% structure. This structure is
  876. filled with information about the capabilities of the device.
  877. WORD <wSize>
  878. Specifies the size of the %MIDIOUTCAPS% structure.
  879. .returns
  880. Returns zero if the function was successful. Otherwise, it returns an error
  881. number. Possible error returns are:
  882. .list Value Meaning
  883. MMSYSERR_BADDEVICEID
  884. Specified device ID is out of range.
  885. MMSYSERR_NODRIVER
  886. The driver was not installed.
  887. .endlist
  888. .comments
  889. Use %midiOutGetNumDevs% to determine the number of MIDI output devices
  890. present in the system. The device ID specified by <wDeviceID> varies from
  891. zero to one less than the number of devices present. Only <wSize> bytes (or
  892. less) of information is copied to the location pointed to by <lpCaps>. If
  893. <wSize> is zero, nothing is copied, and the function returns zero.
  894. .seealso
  895. %midiOutGetNumDevs%
  896. .refpage midiOutGetErrorText
  897. WORD %midiOutGetErrorText%(<wError>, <lpText>, <wSize>)
  898. This function retrieves a textual description of the error identified by the
  899. specified error number.
  900. .parameters
  901. WORD <wError>
  902. Specifies the error number.
  903. LPSTR <lpText>
  904. Specifies a far pointer to a buffer to be filled with the textual error
  905. description.
  906. WORD <wSize>
  907. Specifies the length of the buffer pointed to by <lpText>.
  908. .returns
  909. Returns zero if the function was successful. Otherwise, it returns an error
  910. number. Possible error returns are:
  911. .list Value Meaning
  912. MMSYSERR_BADERRNUM
  913. Specified error number is out of range.
  914. .endlist
  915. .comments
  916. If the textual error description is longer than the specified buffer, the
  917. description is truncated. The returned error string is always
  918. null-terminated. If <wSize> is zero, nothing is copied, and the function
  919. returns MMSYSERR_NOERROR. All error descriptions are less than
  920. MAXERRORLENGTH characters long.
  921. .refpage midiOutGetID
  922. WORD %midiOutGetID%(<hMidiOut>, <lpwDeviceID>)
  923. This function gets the device ID for a MIDI output device.
  924. .parameters
  925. HMIDIOUT <hMidiOut>
  926. Specifies the handle to the MIDI output device.
  927. LPWORD <lpwDeviceID>
  928. Specifies a pointer to the WORD-sized memory location to be filled with
  929. the device ID.
  930. .returns
  931. Returns MMSYSERR_NOERROR if successful. Otherwise, returns an error number.
  932. Possible error returns are:
  933. .list Value Meaning
  934. MMSYSERR_INVALHANDLE
  935. The <hMidiOut> parameter specifies an invalid handle.
  936. .endlist
  937. .refpage midiOutGetNumDevs
  938. WORD %midiOutGetNumDevs%()
  939. This function retrieves the number of MIDI output devices present in the
  940. system.
  941. .parameters
  942. None
  943. .returns
  944. Returns the number of MIDI output devices present in the system.
  945. .seealso
  946. %midiOutGetDevCaps%
  947. .refpage midiOutGetVolume
  948. WORD %midiOutGetVolume%(<wDeviceID>, <lpdwVolume>)
  949. This function returns the current volume setting of a MIDI output device.
  950. .parameters
  951. WORD <wDeviceID>
  952. Identifies the MIDI output device.
  953. LPDWORD <lpdwVolume>
  954. Specifies a far pointer to a location to be filled with the current
  955. volume setting. The low-order word of this location contains the left
  956. channel volume setting, and the high-order word contains the right
  957. channel setting. A value of 0xFFFF represents full volume, and a value
  958. of 0x0000 is silence.
  959. If a device does not support both left and right volume control, the
  960. low-order word of the specified location contains the mono volume
  961. level.
  962. The full 16-bit setting(s) set with %midiOutSetVolume% is returned,
  963. regardless of whether the device supports the full 16 bits of volume
  964. level control.
  965. .returns
  966. Returns zero if the function was successful. Otherwise, it returns an error
  967. number. Possible error returns are:
  968. .list Value Meaning
  969. MMSYSERR_INVALHANDLE
  970. Specified device handle is invalid.
  971. MMSYSERR_NOTSUPPORTED
  972. Function isn't supported.
  973. MMSYSERR_NODRIVER
  974. The driver was not installed.
  975. .endlist
  976. .comments
  977. Not all devices support volume control. To determine whether the device
  978. supports volume control, use the MIDICAPS_VOLUME flag to test the
  979. %dwSupport% field of the %MIDIOUTCAPS% structure (filled by
  980. %midiOutGetDevCaps%).
  981. To determine whether the device supports volume control on both the left and
  982. right channels, use the MIDICAPS_LRVOLUME flag to test the %dwSupport% field
  983. of the %MIDIOUTCAPS% structure (filled by %midiOutGetDevCaps%).
  984. .seealso
  985. %midiOutSetVolume%
  986. .refpage midiOutLongMsg
  987. WORD %midiOutLongMsg%(<hMidiOut>, <lpMidiOutHdr>, <wSize>)
  988. This function sends a long MIDI message to the specified MIDI output device.
  989. Use this function to send system exclusive messages or to send a buffer
  990. filled with short messages.
  991. .parameters
  992. HMIDIOUT <hMidiOut>
  993. Specifies a handle to the MIDI output device.
  994. LPMIDIHDR <lpMidiOutHdr>
  995. Specifies a far pointer to a %MIDIHDR% structure that identifies the
  996. MIDI data buffer.
  997. WORD <wSize>
  998. Specifies the size of the %MIDIHDR% structure.
  999. .returns
  1000. Returns zero if the function was successful. Otherwise, it returns an error
  1001. number. Possible error returns are:
  1002. .list Value Meaning
  1003. MMSYSERR_INVALHANDLE
  1004. Specified device handle is invalid.
  1005. MIDIERR_UNPREPARED
  1006. <lpMidiOutHdr> hasn't been prepared.
  1007. MIDIERR_NOTREADY
  1008. The hardware is busy with other data.
  1009. .endlist
  1010. .comments
  1011. The data buffer must be prepared with %midiOutPrepareHeader% before it is
  1012. passed to %midiOutLongMsg%. The %MIDIHDR% data structure and the data buffer
  1013. pointed to by its %lpData% field must be allocated with %GlobalAlloc% using
  1014. the GMEM_MOVEABLE and GMEM_SHARE flags, and locked with %GlobalLock%. This
  1015. function may or may not return until the data block has been sent to the
  1016. output device.
  1017. .seealso
  1018. %midiOutShortMsg%, %midiOutPrepareHeader%
  1019. .refpage midiOutOpen
  1020. WORD %midiOutOpen%(<lphMidiOut>, <wDeviceID>, <dwCallback>,
  1021. <dwCallbackInstance>, <dwFlags>)
  1022. This function opens a specified MIDI output device for playback.
  1023. .parameters
  1024. LPHMIDIOUT <lphMidiOut>
  1025. Specifies a far pointer to an HMIDIOUT handle. This location is filled
  1026. with a handle identifying the opened MIDI output device. Use the handle
  1027. to identify the device when calling other MIDI output functions.
  1028. WORD <wDeviceID>
  1029. Identifies the MIDI output device that is to be opened.
  1030. DWORD <dwCallback>
  1031. Specifies the address of a fixed callback function or a handle to a
  1032. window called during MIDI playback to process messages related to the
  1033. progress of the playback. Specify NULL for this parameter if no callback
  1034. is desired.
  1035. DWORD <dwCallbackInstance>
  1036. Specifies user instance data passed to the callback. This parameter is
  1037. not used with window callbacks.
  1038. DWORD <dwFlags>
  1039. Specifies a callback flag for opening the device.
  1040. CALLBACK_WINDOW
  1041. If this flag is specified, <dwCallback> is assumed to be a window
  1042. handle.
  1043. CALLBACK_FUNCTION
  1044. If this flag is specified, <dwCallback> is assumed to be a callback
  1045. procedure address.
  1046. .returns
  1047. Returns zero if the function was successful. Otherwise, it returns an error
  1048. number. Possible error returns are as follows:
  1049. .list Value Meaning
  1050. MMSYSERR_BADDEVICEID
  1051. Specified device ID is out of range.
  1052. MMSYSERR_ALLOCATED
  1053. Specified resource is already allocated.
  1054. MMSYSERR_NOMEM
  1055. Unable to allocate or lock memory.
  1056. MIDIERR_NOMAP
  1057. There is no current MIDI map. This occurs only when opening the mapper.
  1058. MIDIERR_NODEVICE
  1059. A port in the current MIDI map doesn't exist. This occurs only when
  1060. opening the mapper.
  1061. .endlist
  1062. .comments
  1063. Use %midiOutGetNumDevs% to determine the number of MIDI output devices
  1064. present in the system. The device ID specified by <wDeviceID> varies from
  1065. zero to one less than the number of devices present. You may also specify
  1066. MIDIMAPPER as the device ID to open the MIDI mapper.
  1067. If a window is chosen to receive callback information, the following
  1068. messages are sent to the window procedure function to indicate the progress
  1069. of MIDI output: %MM_MOM_OPEN%, %MM_MOM_CLOSE%, %MM_MOM_DONE%.
  1070. If a function is chosen to receive callback information, the following
  1071. messages are sent to the function to indicate the progress of MIDI output:
  1072. %MOM_OPEN%, %MOM_CLOSE%, %MOM_DONE%. The callback function must reside in a
  1073. DLL. You do not have to use %MakeProcInstance% to get a procedure-instance
  1074. address for the callback function.
  1075. .head "Callback"
  1076. void FAR PASCAL %MidiOutFunc%(<hMidiOut>, <wMsg>, <dwInstance>, <dwParam1>,
  1077. <dwParam2>)
  1078. %MidiOutFunc% is a placeholder for the application-supplied function name.
  1079. The actual name must be exported by including it in an EXPORTS statement in
  1080. the DLL's module-definition file.
  1081. %Parameters%
  1082. HMIDIOUT <hMidiOut>
  1083. Specifies a handle to the MIDI device associated with the callback.
  1084. WORD <wMsg>
  1085. Specifies a MIDI output message.
  1086. DWORD <dwInstance>
  1087. Specifies the instance data supplied with %midiOutOpen%.
  1088. DWORD <dwParam1>
  1089. Specifies a parameter for the message.
  1090. DWORD <dwParam2>
  1091. Specifies a parameter for the message.
  1092. %Comments%
  1093. Because the callback is accessed at interrupt time, it must reside in a DLL
  1094. and its code segment must be specified as FIXED in the module-definition
  1095. file for the DLL. Any data that the callback accesses must be in a FIXED
  1096. data segment as well. The callback may not make any system calls except for
  1097. %PostMessage%, %timeGetSystemTime%, %timeGetTime%, %timeSetEvent%,
  1098. %timeKillEvent%, %midiOutShortMsg%, %midiOutLongMsg%, and %OutputDebugStr%.
  1099. .seealso
  1100. %midiOutClose%
  1101. .refpage midiOutPrepareHeader
  1102. WORD %midiOutPrepareHeader%(<hMidiOut>, <lpMidiOutHdr>, <wSize>)
  1103. This function prepares a MIDI system exclusive data block for output.
  1104. .parameters
  1105. HMIDIOUT <hMidiOut>
  1106. Specifies a handle to the MIDI output device.
  1107. LPMIDIHDR <lpMidiOutHdr>
  1108. Specifies a far pointer to a %MIDIHDR% structure that identifies the
  1109. data block to be prepared.
  1110. WORD <wSize>
  1111. Specifies the size of the %MIDIHDR% structure.
  1112. .returns
  1113. Returns zero if the function was successful. Otherwise, it returns an error
  1114. number. Possible error returns are:
  1115. .list Value Meaning
  1116. MMSYSERR_INVALHANDLE
  1117. Specified device handle is invalid.
  1118. MMSYSERR_NOMEM
  1119. Unable to allocate or lock memory.
  1120. .endlist
  1121. .comments
  1122. The %MIDIHDR% data structure and the data block pointed to by its %lpData%
  1123. field must be allocated with %GlobalAlloc% using the GMEM_MOVEABLE and
  1124. GMEM_SHARE flags and locked with %GlobalLock%. Preparing a header that has
  1125. already been prepared has no effect, and the function returns zero.
  1126. .seealso
  1127. %midiOutUnprepareHeader%
  1128. .refpage midiOutReset
  1129. WORD %midiOutReset%(<hMidiOut>)
  1130. This function turns off all notes on all MIDI channels for the specified
  1131. MIDI output device.
  1132. .parameters
  1133. HMIDIOUT <hMidiOut>
  1134. Specifies a handle to the MIDI output device.
  1135. .returns
  1136. Returns zero if the function was successful. Otherwise, it returns an error
  1137. number. Possible error returns are:
  1138. .list Value Meaning
  1139. MMSYSERR_INVALHANDLE
  1140. Specified device handle is invalid.
  1141. .endlist
  1142. .comments
  1143. If the specified MIDI output device is an output port, a note off message
  1144. for each note of each channel is sent. In addition, a sustain (damper pedal)
  1145. off controller message is sent for each channel.
  1146. .seealso
  1147. %midiOutLongMsg%, %midiOutClose%
  1148. .refpage midiOutSetVolume
  1149. WORD %midiOutSetVolume%(<wDeviceID>, <dwVolume>)
  1150. This function sets the volume of a MIDI output device.
  1151. .parameters
  1152. WORD <wDeviceID>
  1153. Identifies the MIDI output device.
  1154. DWORD <dwVolume>
  1155. Specifies the new volume setting. The low-order word contains the left
  1156. channel volume setting, and the high-order word contains the right
  1157. channel setting. A value of 0xFFFF represents full volume, and a value
  1158. of 0x0000 is silence.
  1159. If a device does not support both left and right volume control, the
  1160. low-order word of <dwVolume> specifies the volume level, and the
  1161. high-order word is ignored.
  1162. .returns
  1163. Returns zero if the function was successful. Otherwise, it returns an error
  1164. number. Possible error returns are:
  1165. .list Value Meaning
  1166. MMSYSERR_INVALHANDLE
  1167. Specified device handle is invalid.
  1168. MMSYSERR_NOTSUPPORTED
  1169. Function isn't supported.
  1170. MMSYSERR_NODRIVER
  1171. The driver was not installed.
  1172. .endlist
  1173. .comments
  1174. Not all devices support volume changes. To determine whether the device
  1175. supports volume control, use the MIDICAPS_VOLUME flag to test the
  1176. %dwSupport% field of the %MIDIOUTCAPS% structure (filled by
  1177. %midiOutGetDevCaps%).
  1178. To determine whether the device supports volume control on both the left and
  1179. right channels, use the MIDICAPS_LRVOLUME flag to test the %dwSupport% field
  1180. of the %MIDIOUTCAPS% structure (filled by %midiOutGetDevCaps%).
  1181. Most devices do not support the full 16 bits of volume level control and
  1182. will use only the high-order bits of the requested volume setting. For
  1183. example, for a device that supports 4 bits of volume control, requested
  1184. volume level values of 0x4000, 0x4fff, and 0x43be will all produce the same
  1185. physical volume setting, 0x4000. The %midiOutGetVolume% function will return
  1186. the full 16-bit setting set with %midiOutSetVolume%.
  1187. Volume settings are interpreted logarithmically. This means the perceived
  1188. increase in volume is the same when increasing the volume level from 0x5000
  1189. to 0x6000 as it is from 0x4000 to 0x5000.
  1190. .seealso
  1191. %midiOutGetVolume%
  1192. .refpage midiOutShortMsg
  1193. WORD %midiOutShortMsg%(<hMidiOut>, <dwMsg>)
  1194. This function sends a short MIDI message to the specified MIDI output
  1195. device. Use this function to send any MIDI message except for system
  1196. exclusive messages.
  1197. .parameters
  1198. HMIDIOUT <hMidiOut>
  1199. Specifies a handle to the MIDI output device.
  1200. DWORD <dwMsg>
  1201. Specifies the MIDI message. The message is packed into a DWORD with the
  1202. first byte of the message in the low order byte.
  1203. .returns
  1204. Returns zero if the function was successful. Otherwise, it returns an error
  1205. number. Possible error returns are:
  1206. .list Value Meaning
  1207. MMSYSERR_INVALHANDLE
  1208. Specified device handle is invalid.
  1209. MIDIERR_NOTREADY
  1210. The hardware is busy with other data.
  1211. .endlist
  1212. .comments
  1213. This function may not return until the message has been sent to the output
  1214. device.
  1215. .seealso
  1216. %midiOutLongMsg%
  1217. .refpage midiOutUnprepareHeader
  1218. WORD %midiOutUnprepareHeader%(<hMidiOut>, <lpMidiOutHdr>, <wSize>)
  1219. This function cleans up the preparation performed by %midiOutPrepareHeader%.
  1220. The %midiOutUnprepareHeader% function must be called after the device driver
  1221. fills a data buffer and returns it to the application. You must call this
  1222. function before freeing the data buffer.
  1223. .parameters
  1224. HMIDIOUT <hMidiOut>
  1225. Specifies a handle to the MIDI output device.
  1226. LPMIDIHDR <lpMidiOutHdr>
  1227. Specifies a pointer to a %MIDIHDR% structure identifying the buffer to
  1228. be cleaned up.
  1229. WORD <wSize>
  1230. Specifies the size of the %MIDIHDR% structure.
  1231. .returns
  1232. Returns zero if the function was successful. Otherwise, it returns an error
  1233. number. Possible error returns are:
  1234. .list Value Meaning
  1235. MMSYSERR_INVALHANDLE
  1236. Specified device handle is invalid.
  1237. MIDIERR_STILLPLAYING
  1238. <lpMidiOutHdr> is still in the queue.
  1239. .endlist
  1240. .comments
  1241. This function is the complementary function to %midiOutPrepareHeader%. You
  1242. must call this function before freeing the data buffer with %GlobalFree%.
  1243. After passing a buffer to the device driver with %midiOutLongMsg%, you must
  1244. wait until the driver is finished with the buffer before calling
  1245. %midiOutUnprepareHeader%.
  1246. Unpreparing a buffer that has not been prepared has no effect, and the
  1247. function returns zero.
  1248. .seealso
  1249. %midiOutPrepareHeader%
  1250. .refpage mmioAdvance
  1251. MMRESULT %mmioAdvance%(<hmmio>, <lpmmioinfo>, <uFlags>)
  1252. This function advances the I/O buffer of a file set up for direct I/O buffer
  1253. access with %mmioGetInfo%. If the file is opened for reading, the I/O buffer
  1254. is filled from the disk. If the file is opened for writing and the
  1255. MMIO_DIRTY flag is set in the %dwFlags% field of the %MMIOINFO% structure,
  1256. the buffer is written to disk. The %pchNext%, %pchEndRead%, and
  1257. %pchEndWrite% fields of the %MMIOINFO% structure are updated to reflect the
  1258. new state of the I/O buffer.
  1259. .parameters
  1260. HMMIO <hmmio>
  1261. Specifies the file handle for a file opened with %mmioOpen%.
  1262. LPMMIOINFO <lpmmioinfo>
  1263. Specifies a pointer to the %MMIOINFO% structure obtained with
  1264. %mmioGetInfo%.
  1265. UINT <uFlags>
  1266. Specifies options for the operation. Contains exactly one of the
  1267. following two flags:
  1268. MMIO_READ
  1269. The buffer is filled from the file.
  1270. MMIO_WRITE
  1271. The buffer is written to the file.
  1272. .returns
  1273. The return value is zero if the operation is successful. Otherwise, the
  1274. return value specifies an error code. The error code can be one of the
  1275. following codes:
  1276. MMIOERR_CANNOTWRITE
  1277. The contents of the buffer could not be written to disk.
  1278. MMIOERR_CANNOTREAD
  1279. An error occurred while re-filling the buffer.
  1280. MMIOERR_UNBUFFERED
  1281. The specified file is not opened for buffered I/O.
  1282. MMIOERR_CANNOTEXPAND
  1283. The specified memory file cannot be expanded, probably because the
  1284. %adwInfo[0]% field was set to zero in the initial call to %mmioOpen%.
  1285. MMIOERR_OUTOFMEMORY
  1286. There was not enough memory to expand a memory file for further
  1287. writing.
  1288. .comments
  1289. If the specified file is opened for writing or for both reading and writing,
  1290. the I/O buffer will be flushed to disk before the next buffer is read. If
  1291. the I/O buffer cannot be written to disk because the disk is full, then
  1292. %mmioAdvance% will return MMIOERR_CANNOTWRITE.
  1293. If the specified file is only open for writing, the MMIO_WRITE flag must be
  1294. specified.
  1295. If you have written to the I/O buffer, you must set the MMIO_DIRTY flag in
  1296. the %dwFlags% field of the %MMIOINFO% structure before calling
  1297. %mmioAdvance%. Otherwise, the buffer will not be written to disk.
  1298. If the end of file is reached, %mmioAdvance% will still return success, even
  1299. though no more data can be read. Thus, to check for the end of the file, it
  1300. is necessary to see if the %pchNext% and %pchEndRead% fields of the
  1301. %MMIOINFO% structure are equal after calling %mmioAdvance%.
  1302. .seealso
  1303. %mmioGetInfo%, %MMIOINFO%
  1304. .refpage mmioAscend
  1305. MMRESULT %mmioAscend%(<hmmio>, <lpck>, <uFlags>)
  1306. This function ascends out of a chunk in a RIFF file descended into with
  1307. %mmioDescend% or created with %mmioCreateChunk%.
  1308. .parameters
  1309. HMMIO <hmmio>
  1310. Specifies the file handle of an open RIFF file.
  1311. LPMMCKINFO <lpck>
  1312. Specifies a pointer to a caller-supplied %MMCKINFO% structure
  1313. previously filled by %mmioDescend% or %mmioCreateChunk%.
  1314. UINT <uFlags>
  1315. Is not used and should be set to zero.
  1316. .returns
  1317. The return value is zero if the function is successful. Otherwise, the
  1318. return value specifies an error code. The error code can be one of the
  1319. following codes:
  1320. MMIOERR_CANNOTWRITE
  1321. The contents of the buffer could not be written to disk.
  1322. MMIOERR_CANNOTSEEK
  1323. There was an error while seeking to the end of the chunk.
  1324. .comments
  1325. If the chunk was descended into using %mmioDescend%, then %mmioAscend% seeks
  1326. to the location following the end of the chunk (past the extra pad byte, if
  1327. any).
  1328. If the chunk was created and descended into using %mmioCreateChunk%, or if
  1329. the MMIO_DIRTY flag is set in the %dwFlags% field of the %MMCKINFO%
  1330. structure referenced by <lpck>, then the current file position is assumed to
  1331. be the end of the data portion of the chunk. If the chunk size is not the
  1332. same as the value stored in the %cksize% field when %mmioCreateChunk% was
  1333. called, then %mmioAscend% corrects the chunk size in the file before
  1334. ascending from the chunk. If the chunk size is odd, %mmioAscend% writes a
  1335. null pad byte at the end of the chunk. After ascending from the chunk, the
  1336. current file position is the location following the end of the chunk (past
  1337. the extra pad byte, if any).
  1338. .seealso
  1339. %mmioDescend%, %mmioCreateChunk%, %MMCKINFO%
  1340. .refpage mmioClose
  1341. MMRESULT %mmioClose%(<hmmio>, <uFlags>)
  1342. This function closes a file opened with %mmioOpen%.
  1343. .parameters
  1344. HMMIO <hmmio>
  1345. Specifies the file handle of the file to close.
  1346. UINT <uFlags>
  1347. Specifies options for the close operation.
  1348. MMIO_FHOPEN
  1349. If the file was opened by passing the DOS file handle of an
  1350. already-opened file to %mmioOpen%, then using this flag tells
  1351. %mmioClose% to close the MMIO file handle, but not the DOS file handle.
  1352. (This is performed by the installed or default IOProc).
  1353. .returns
  1354. The return value is zero if the function is successful. Otherwise, the
  1355. return value is an error code, either from %mmioFlush% or from the I/O
  1356. procedure. The error code can be one of the following codes:
  1357. MMIOERR_CANNOTWRITE
  1358. The contents of the buffer could not be written to disk.
  1359. MMIOERR_CANNOTCLOSE
  1360. The DOS file system failed to close the file.
  1361. Other error codes are possible depending on the IOProcedure installed
  1362. .seealso
  1363. %mmioOpen%, %mmioFlush%
  1364. .refpage mmioCreateChunk
  1365. MMRESULT %mmioCreateChunk%(<hmmio>, <lpck>, <uFlags>)
  1366. This function creates a chunk in a RIFF file opened with %mmioOpen%. The new
  1367. chunk is created at the current file position. After the new chunk is
  1368. created, the current file position is the beginning of the data portion of
  1369. the new chunk.
  1370. .parameters
  1371. HMMIO <hmmio>
  1372. Specifies the file handle of an open RIFF file.
  1373. LPMMCKINFO <lpck>
  1374. Specifies a pointer to a caller-supplied %MMCKINFO% structure containing
  1375. information about the chunk to be created. Set up the %MMCKINFO%
  1376. structure as follows:
  1377. .blist
  1378. o The %ckid% field specifies the chunk ID of the chunk. If <wFlags>
  1379. includes MMIO_CREATERIFF or MMIO_CREATELIST, this field will be filled
  1380. by %mmioCreateChunk%.
  1381. o The %cksize% field specifies the size of the data portion of the chunk,
  1382. including the form type or list type (if any). If this value is not
  1383. correct when %mmioAscend% is called to mark the end of the chunk, them
  1384. %mmioAscend% will correct the chunk size.
  1385. o The %fccType% field specifies the form type or list type if the chunk is
  1386. a "RIFF" or "LIST" chunk. If the chunk is not a "RIFF" or "LIST" chunk,
  1387. this field need not be filled in.
  1388. o The %dwDataOffset% field need not be filled in. The %mmioCreateChunk%
  1389. function will fill this field with the file offset of the data portion
  1390. of the chunk.
  1391. o The %dwFlags% field need not be filled in. The %mmioCreateChunk%
  1392. function will set the MMIO_DIRTY flag in %dwFlags%.
  1393. .endblist
  1394. UINT <uFlags>
  1395. Specifies flags to optionally create either a "RIFF" chunk or a "LIST"
  1396. chunk. Can contain one of the following flags:
  1397. MMIO_CREATERIFF
  1398. Creates a "RIFF" chunk.
  1399. MMIO_CREATELIST
  1400. Creates a "LIST" chunk.
  1401. .returns
  1402. The return value is zero if the function is successful. Otherwise, the
  1403. return value specifies an error code. The error code can be one of the
  1404. following codes:
  1405. MMIOERR_CANNOTWRITE
  1406. Unable to write the chunk header.
  1407. MMIOERR_CANNOTSEEK
  1408. Uanble to determine offset of data portion of the chunk.
  1409. .comments
  1410. This function cannot insert a chunk into the middle of a file. If a chunk is
  1411. created anywhere but the end of a file, %mmioCreateChunk% will overwrite
  1412. existing information in the file.
  1413. .refpage mmioDescend
  1414. MMRESULT %mmioDescend%(<hmmio>, <lpck>, <lpckParent>, <uFlags>)
  1415. This function descends into a chunk of a RIFF file opened with %mmioOpen%.
  1416. It can also search for a given chunk.
  1417. .parameters
  1418. HMMIO <hmmio>
  1419. Specifies the file handle of an open RIFF file.
  1420. LPMMCKINFO <lpck>
  1421. Specifies a pointer to a caller-supplied %MMCKINFO% structure that
  1422. %mmioDescend% fills with the following information:
  1423. .blist
  1424. o The %ckid% field is the chunk ID of the chunk.
  1425. o The %cksize% field is the size of the data portion of the chunk. The
  1426. data size includes the form type or list type (if any), but does not
  1427. include the 8-byte chunk header or the pad byte at the end of the data
  1428. (if any).
  1429. o The %fccType% field is the form type if %ckid% is "RIFF", or the list
  1430. type if %ckid% is "LIST". Otherwise, it is NULL.
  1431. o The %dwDataOffset% field is the file offset of the beginning of the data
  1432. portion of the chunk. If the chunk is a "RIFF" chunk or a "LIST" chunk,
  1433. then %dwDataOffset% is the offset of the form type or list type.
  1434. o The %dwFlags% contains other information about the chunk. Currently,
  1435. this information is not used and is set to zero.
  1436. .endblist
  1437. If the MMIO_FINDCHUNK, MMIO_FINDRIFF, or MMIO_FINDLIST flag is specified
  1438. for <uFlags>, then the %MMCKINFO% structure is also used to pass
  1439. parameters to %mmioDescend%:
  1440. .blist
  1441. o The %ckid% field specifies the four-character code of the chunk ID, form
  1442. type, or list type to search for.
  1443. .endblist
  1444. LPMMCKINFO <lpckParent>
  1445. Specifies a pointer to an optional caller-supplied %MMCKINFO%
  1446. structure identifying the parent of the chunk being searched for. A
  1447. parent of a chunk is the enclosing chunk--only "RIFF" and "LIST" chunks
  1448. can be parents. If <lpckParent> is not NULL, then %mmioDescend% assumes
  1449. the %MMCKINFO% structure it refers to was filled when %mmioDescend% was
  1450. called to descend into the parent chunk, and %mmioDescend% will only
  1451. search for a chunk within the parent chunk. Set <lpckParent> to NULL if
  1452. no parent chunk is being specified.
  1453. UINT <uFlags>
  1454. Specifies search options. Contains up to one of the following flags. If
  1455. no flags are specified, %mmioDescend% descends into the chunk beginning
  1456. at the current file position.
  1457. MMIO_FINDCHUNK
  1458. Searches for a chunk with the specified chunk ID.
  1459. MMIO_FINDRIFF
  1460. Searches for a chunk with chunk ID "RIFF" and with the specified form
  1461. type.
  1462. MMIO_FINDLIST
  1463. Searches for a chunk with chunk ID "LIST" and with the specified form
  1464. type.
  1465. .returns
  1466. The return value is zero if the function is successful. Otherwise, the
  1467. return value specifies an error code. If the end of the file (or the end of
  1468. the parent chunk, if given) is reached before the desired chunk is found,
  1469. the return value is MMIOERR_CHUNKNOTFOUND. Other non-zero error returns
  1470. may be possible.
  1471. .comments
  1472. A RIFF chunk consists of a four-byte chunk ID (type FOURCC), followed by a
  1473. four-byte chunk size (type DWORD), followed by the data portion of the
  1474. chunk, followed by a null pad byte if the size of the data portion is odd.
  1475. If the chunk ID is "RIFF" or "LIST", the first four bytes of the data
  1476. portion of the chunk are a form type or list type (type FOURCC).
  1477. If %mmioDescend% is used to search for a chunk, the file position should be
  1478. at the beginning of a chunk before calling %mmioDescend%. The search begins
  1479. at the current file position and continues to the end of the file. If a
  1480. parent chunk is specified, the file position should be somewhere within the
  1481. parent chunk before calling %mmioDescend%. In this case, the search begins
  1482. at the current file position and continues to the end of the parent chunk.
  1483. If %mmioDescend% is unsuccessful in searching for a chunk, the current file
  1484. position is undefined. If %mmioDescend% is successful, the current file
  1485. position is changed. If the chunk is a "RIFF" or "LIST" chunk, the new file
  1486. position will be just after the form type or list type (12 bytes from the
  1487. beginning of the chunk). For other chunks, the new file position will be the
  1488. start of the data portion of the chunk (8 bytes from the beginning of the
  1489. chunk).
  1490. For efficient RIFF file I/O, use buffered I/O.
  1491. .seealso
  1492. %mmioAscend%, %MMCKINFO%
  1493. .refpage mmioFlush
  1494. MMRESULT %mmioFlush%(<hmmio>, <uFlags>)
  1495. This function writes the I/O buffer of a file to disk, if the I/O buffer has
  1496. been written to.
  1497. .parameters
  1498. HMMIO <hmmio>
  1499. Specifies the file handle of a file opened with %mmioOpen%.
  1500. UINT <uFlags>
  1501. Is not used and should be set to zero.
  1502. .returns
  1503. The return value is zero if the function is successful. Otherwise, the
  1504. return value specifies an error code. The error code can be one of the
  1505. following codes:
  1506. MMIOERR_CANNOTWRITE
  1507. The contents of the buffer could not be written to disk.
  1508. .comments
  1509. Closing a file with %mmioClose% will automatically flush its buffer.
  1510. If there is insufficient disk space to write the buffer, %mmioFlush% will
  1511. fail, even if the preceding %mmioWrite% calls were successful.
  1512. .refpage mmioFOURCC
  1513. FOURCC %mmioFOURCC%(<ch0>, <ch1>, <ch2>, <ch3>)
  1514. This macro converts four characters to to a DWORD code.
  1515. .parameters
  1516. CHAR <ch0>
  1517. The first character of the four-character code.
  1518. CHAR <ch1>
  1519. The second character of the four-character code.
  1520. CHAR <ch2>
  1521. The third character of the four-character code.
  1522. CHAR <ch3>
  1523. The fourth character of the four-character code.
  1524. .returns
  1525. The return value is the DWORD representing the four character code
  1526. created from the given characters.
  1527. .comments
  1528. This macro does not check to see if the four character code follows any
  1529. conventions regarding which characters to include in a four-character code.
  1530. .seealso
  1531. %mmioStringToFOURCC%
  1532. .refpage mmioGetInfo
  1533. MMRESULT %mmioGetInfo%(<hmmio>, <lpmmioinfo>, <uFlags>)
  1534. This function retrieves information about a file opened with %mmioOpen%.
  1535. This information allows the caller to directly access the I/O buffer, if the
  1536. file is opened for buffered I/O.
  1537. .parameters
  1538. HMMIO <hmmio>
  1539. Specifies the file handle of the file.
  1540. LPMMIOINFO <lpmmioinfo>
  1541. Specifies a pointer to a caller-allocated %MMIOINFO% structure that
  1542. %mmioGetInfo% fills with information about the file. See the %MMIOINFO%
  1543. structure and the %mmioOpen% function for information about the fields
  1544. in this structure.
  1545. UINT <uFlags>
  1546. Is not used and should be set to zero.
  1547. .returns
  1548. The return value is zero if the function is successful.
  1549. .comments
  1550. To directly access the I/O buffer of a file opened for buffered I/O, use the
  1551. following fields of the %MMIOINFO% structure filled by %mmioGetInfo%:
  1552. .blist
  1553. o The %pchNext% field points to the next byte in the buffer that can be
  1554. read or written. When you read or write, increment %pchNext% by the
  1555. number of bytes read or written.
  1556. o The %pchEndRead% field points to one byte past the last valid byte in
  1557. the buffer that can be read.
  1558. o The %pchEndWrite% field points to one byte past the last location in the
  1559. buffer that can be written.
  1560. .endblist
  1561. Once you read or write to the buffer and modify %pchNext%, do not call any
  1562. MMIO function except %mmioAdvance% until you call %mmioSetInfo%. Call
  1563. %mmioSetInfo% when you are finished directly accessing the buffer.
  1564. When you reach the end of the buffer specified by %pchEndRead% or
  1565. %pchEndWrite%, call %mmioAdvance% to fill the buffer from the disk, or write
  1566. the buffer to the disk. The %mmioAdvance% function will update the
  1567. %pchNext%, %pchEndRead%, and %pchEndWrite% fields in the %MMIOINFO%
  1568. structure for the file.
  1569. Before calling %mmioAdvance% or %mmioSetInfo% to flush a buffer to disk, set
  1570. the MMIO_DIRTY flag in the %dwFlags% field of the %MMIOINFO% structure for
  1571. the file. Otherwise, the buffer will not get written to disk.
  1572. Do not decrement %pchNext% or modify any fields in the %MMIOINFO% structure
  1573. other than %pchNext% and %dwFlags%. Do not set any flags in %dwFlags% except
  1574. MMIO_DIRTY.
  1575. .seealso
  1576. %mmioSetInfo%, %MMIOINFO%
  1577. .refpage mmioInstallIOProc
  1578. LPMMIOPROC %mmioInstallIOProc%(<fccIOProc>, <pIOProc>, <dwFlags>)
  1579. This function installs or removes a custom I/O procedure. It will also
  1580. locate an installed I/O procedure, given its corresponding four-character
  1581. code.
  1582. .parameters
  1583. FOURCC <fccIOProc>
  1584. Specifies a four-character code identifying the I/O procedure to
  1585. install, remove, or locate. All characters in this four-character code
  1586. should be uppercase characters.
  1587. LPMMIOPROC <pIOProc>
  1588. Specifies the address of the I/O procedure to install. To remove or
  1589. locate an I/O procedure, set this parameter to NULL.
  1590. DWORD <dwFlags>
  1591. Specifies one of the following flags indicating whether the I/O
  1592. procedure is being installed, removed, or located:
  1593. MMIO_INSTALLPROC
  1594. Installs the specified I/O procedure.
  1595. MMIO_REMOVEPROC
  1596. Removes the specified I/O procedure.
  1597. MMIO_FINDPROC
  1598. Searches for the specified I/O procedure.
  1599. .returns
  1600. The return value is the address of the I/O procedure installed, removed, or
  1601. located. If there is an error, the return value is NULL.
  1602. .comments
  1603. If the I/O procedure resides in the application, for compatibility with the
  1604. 16 bit windows API use %MakeProcInstance% to
  1605. get a procedure-instance address and specify this address for <pIOProc>. You
  1606. don't need to get a procedure-instance address if the I/O procedure resides
  1607. in a DLL.
  1608. .head "Callback"
  1609. LONG %IOProc%(<lpmmioinfo>, <wMsg>, <lParam1>, <lParam2>)
  1610. %IOProc% is a placeholder for the application-supplied function name. The
  1611. actual name must be exported by including it in a EXPORTS statement in the
  1612. application's module-definitions file.
  1613. %Parameters%
  1614. LPSTR <lpmmioinfo>
  1615. Specifies a pointer to an %MMIOINFO% structure containing
  1616. information about the open file. The I/O procedure must maintain the
  1617. %lDiskOffset% field in this structure to indicate the file offset to the
  1618. next read or write location. The I/O procedure can use the %adwInfo[]%
  1619. field to store state information. The I/O procedure should not modify
  1620. any other fields of the %MMIOINFO% structure.
  1621. UINT <uMsg>
  1622. Specifies a message indicating the requested I/O operation. Messages
  1623. that can be received include %MMIOM_OPEN%, %MMIOM_CLOSE%, %MMIOM_READ%,
  1624. %MMIOM_WRITE%, and %MMIOM_SEEK%.
  1625. LONG <lParam1>
  1626. Specifies a parameter for the message.
  1627. LONG <lParam2>
  1628. Specifies a parameter for the message.
  1629. %Return Value%
  1630. The return value depends on the message specified by <wMsg>. If the I/O
  1631. procedure does not recognize a message, it should return zero.
  1632. %Comments%
  1633. The four-character code specified by the %fccIOProc% field in the %MMIOINFO%
  1634. structure associated with a file identifies a filename extension for a
  1635. custom storage system. When an application calls %mmioOpen% with a filename
  1636. like "foo.xyz!bar", the I/O procedure associated with the four-character
  1637. code "XYZ " is called to open the "bar" element of the file "foo.xyz".
  1638. The %mmioInstallIOProc% function maintains a separate list of installed I/O
  1639. procedures for each Windows application. Therefore, different applications
  1640. can use the same I/O procedure identifier for different I/O procedures
  1641. without conflict.
  1642. To share an I/O procedure among applications, the I/O procedure must reside
  1643. in a DLL called by each application using it. Each application using the
  1644. shared I/O procedure must call %mmioInstallIOProc% to install the procedure
  1645. (or call the DLL to install the procedure on behalf of the application).
  1646. Each application must call %mmioInstallIOProc% to remove the I/O procedure
  1647. before terminating.
  1648. If an application calls %mmioInstallIOProc% more than once to register the
  1649. same I/O procedure, then it must call %mmioInstallIOProc% to remove the
  1650. procedure once for each time it installed the procedure.
  1651. %mmioInstallIOProc% will not prevent an application from installing two
  1652. different I/O procedures with the same identifier, or installing an I/O
  1653. procedure with one of the predefined identifiers ("DOS ", "MEM ", or "BND
  1654. "). The most recently installed procedure takes precedence, and the most
  1655. recently installed procedure is the first one to get removed.
  1656. .seealso
  1657. %mmioOpen%
  1658. .refpage mmioOpen
  1659. HMMIO %mmioOpen%(<szFilename>, <lpmmioinfo>, <dwOpenFlags>)
  1660. This function opens a file for unbuffered or buffered I/O. The file can be a
  1661. DOS file, a memory file, or an element of a custom storage system.
  1662. .parameters
  1663. LPSTR <szFilename>
  1664. Specifies a pointer to a string containing the filename of the file
  1665. to open. If no I/O procedure is specified to open the file, then the
  1666. filename determines how the file is opened, as follows:
  1667. .blist
  1668. o If the filename does not contain "+", then it is assumed to be the name
  1669. of a DOS file.
  1670. o If the filename is of the form "foo.ext+bar", then the extension "EXT "
  1671. is assumed to identify an installed I/O procedure which is called to
  1672. perform I/O on the file (see %mmioInstallIOProc%).
  1673. o If the filename is NULL and no I/O procedure is given, then %adwInfo[0]%
  1674. is assumed to be the DOS file handle of a currently open file.
  1675. .endblist
  1676. The filename should not be longer than 128 bytes, including the
  1677. terminating NULL.
  1678. When opening a memory file, set <szFilename> to NULL.
  1679. LPMMIOINFO <lpmmioinfo>
  1680. Specifies a pointer to an %MMIOINFO% structure containing extra
  1681. parameters used by %mmioOpen%. Unless you are opening a memory file,
  1682. specifying the size of a buffer for buffered I/O, or specifying an
  1683. uninstalled I/O procedure to open a file, this parameter should be
  1684. NULL.
  1685. If <lpmmioinfo> is not NULL, all unused fields of the %MMIOINFO%
  1686. structure it references must be set to zero, including the reserved
  1687. fields.
  1688. DWORD <dwOpenFlags>
  1689. Specifies option flags for the open operation. The MMIO_READ,
  1690. MMIO_WRITE, and MMIO_READWRITE flags are mutually exclusive--only one
  1691. should be specified. The MMIO_COMPAT, MMIO_EXCLUSIVE, MMIO_DENYWRITE,
  1692. MMIO_DENYREAD, and MMIO_DENYNONE flags are DOS file-sharing flags, and
  1693. can only be used after the DOS command SHARE has been executed.
  1694. MMIO_READ
  1695. Opens the file for reading only. This is the default, if MMIO_WRITE and
  1696. MMIO_READWRITE are not specified.
  1697. MMIO_WRITE
  1698. Opens the file for writing. You should not read from a file opened in
  1699. this mode.
  1700. MMIO_READWRITE
  1701. Opens the file for both reading and writing.
  1702. MMIO_CREATE
  1703. Creates a new file. If the file already exists, it is truncated to zero
  1704. length. For memory files, MMIO_CREATE indicates the end of the file is
  1705. initially at the start of the buffer.
  1706. MMIO_DELETE
  1707. Deletes a file. If this flag is specified, <szFilename> should not be
  1708. NULL. The return value will be TRUE (cast to HMMIO) if the file was
  1709. deleted successfully, FALSE otherwise. Do not call %mmioClose% for a
  1710. file that has been deleted. If this flag is specified, all other flags
  1711. are ignored.
  1712. MMIO_ALLOCBUF
  1713. Opens a file for buffered I/O. To allocate a buffer larger or smaller
  1714. than the default buffer size (8K), set the %cchBuffer% field of the
  1715. %MMIOINFO% structure to the desired buffer size. If %cchBuffer% is zero,
  1716. then the default buffer size is used. If you are providing your own I/O
  1717. buffer, then the MMIO_ALLOCBUF flag should not be used.
  1718. MMIO_COMPAT
  1719. Opens the file with compatibility mode, allowing any process on a given
  1720. machine to open the file any number of times. %mmioOpen% fails if the
  1721. file has been opened with any of the other sharing modes.
  1722. MMIO_EXCLUSIVE
  1723. Opens the file with exclusive mode, denying other processes both read
  1724. and write access to the file. %mmioOpen% fails if the file has been
  1725. opened in any other mode for read or write access, even by the current
  1726. process.
  1727. MMIO_DENYWRITE
  1728. Opens the file and denies other processes write access to the file.
  1729. %mmioOpen% fails if the file has been opened in compatibility or for
  1730. write access by any other process.
  1731. MMIO_DENYREAD
  1732. Opens the file and denies other processes read access to the file.
  1733. %mmioOpen% fails if the file has been opened in compatibility mode or
  1734. for read access by any other process.
  1735. MMIO_DENYNONE
  1736. Opens the file without denying other processes read or write access to
  1737. the file. %mmioOpen% fails if the file has been opened in compatibility
  1738. mode by any other process.
  1739. .returns
  1740. The return value is a handle to the opened file. This handle is not a DOS
  1741. file handle--do not use it with any file I/O functions other than MMIO
  1742. functions.
  1743. If the file cannot be opened, the return value is NULL. If <lpmmioinfo> is
  1744. not NULL, then its %wError% field will contain extended error information
  1745. returned by the I/O procedure.
  1746. .comments
  1747. If <lpmmioinfo> references an %MMIOINFO% structure, set up the fields as
  1748. described below. All unused fields must be set to zero, including reserved
  1749. fields.
  1750. .blist
  1751. o To request that a file be opened with an installed I/O procedure, set
  1752. the %fccIOProc% field to the four-character code of the I/O procedure,
  1753. and set the %pIOProc% field to NULL.
  1754. o To request that a file be opened with an uninstalled I/O procedure, set
  1755. the %pIOProc% field to point to the I/O procedure, and set %fccIOProc%
  1756. to NULL.
  1757. o To request that %mmioOpen% determine which I/O procedure to use to open
  1758. the file based on the filename contained in <szFilename>, set both
  1759. %fccIOProc% and %pIOProc% to NULL. This is the default behavior if no
  1760. %MMIOINFO% structure is specified.
  1761. o To open a memory file using an internally allocated and managed buffer,
  1762. set the %pchBuffer% field to NULL, %fccIOProc% to FOURCC_MEM,
  1763. %cchBuffer% to the initial size of the buffer, and %adwInfo[0]% to the
  1764. incremental expansion size of the buffer. This memory file will
  1765. automatically be expanded in increments of %adwInfo[0]% bytes when
  1766. necessary. Specify the MMIO_CREATE flag for the <dwOpenFlags> parameter
  1767. to initially set the end of the file to be the beginning of the buffer.
  1768. o To open a memory file using a caller-supplied buffer, set the
  1769. %pchBuffer% field to point to the memory buffer, %fccIOProc% to
  1770. FOURCC_MEM, %cchBuffer% to the size of the buffer, and %adwInfo[0]% to
  1771. the incremental expansion size of the buffer. The expansion size in
  1772. %adwInfo[0]% should only be non-zero if %pchBuffer% is a pointer
  1773. obtained by calling %GlobalAlloc% and %GlobalLock%, since
  1774. %GlobalReAlloc% will be called to expand the buffer. In particular, if
  1775. %pchBuffer% points to a local or global array, a block of memory in the
  1776. local heap, or a block of memory allocated by %GlobalDosAlloc%,
  1777. %adwInfo[0]% must be zero.
  1778. Specify the MMIO_CREATE flag for the <dwOpenFlags> parameter to
  1779. initially set the end of the file to be the beginning of the buffer;
  1780. otherwise, the entire block of memory will be considered readable.
  1781. o To use a currently open DOS file handle with MMIO, set the %fccIOProc%
  1782. field to FOURCC_DOS, %pchBuffer% to NULL, and %adwInfo[0]% to the DOS
  1783. file handle. Note that offsets within the file will be relative to the
  1784. beginning of the file, and will not depend on the DOS file position at
  1785. the time %mmioOpen% is called; the initial MMIO offset will be the same
  1786. as the DOS offset when %mmioOpen% is called. Later, to close the MMIO
  1787. file handle without closing the DOS file handle, pass the MMIO_FHOPEN
  1788. flag to %mmioClose%.
  1789. .endblist
  1790. You must call %mmioClose% to close a file opened with %mmioOpen%. Open files
  1791. are not automatically closed when an application exits.
  1792. .seealso
  1793. %mmioClose%
  1794. .refpage mmioRead
  1795. LRESULT %mmioRead%(<hmmio>, <pch>, <cch>)
  1796. This function reads a specified number of bytes from a file opened with
  1797. %mmioOpen%.
  1798. .parameters
  1799. HMMIO <hmmio>
  1800. Specifies the file handle of the file to be read.
  1801. LPSTR <pch>
  1802. Specifies a pointer to a buffer to contain the data read from the
  1803. file.
  1804. LONG <cch>
  1805. Specifies the number of bytes to read from the file.
  1806. .returns
  1807. The return value is the number of bytes actually read. If the end of the
  1808. file has been reached and no more bytes can be read, the return value is
  1809. zero. If there is an error reading from the file, the return value is -1.
  1810. .comments
  1811. On 16 bit windows pch is a huge pointer. On 32 bit windows there is no
  1812. distinction between huge poointers and long pointers.
  1813. .seealso
  1814. %mmioWrite%
  1815. .refpage mmioSeek
  1816. LRESULT %mmioSeek%(<hmmio>, <lOffset>, <iOrigin>)
  1817. This function changes the current file position in a file opened with
  1818. %mmioOpen%. The current file position is the location in the file where data
  1819. is read or written.
  1820. .parameters
  1821. HMMIO <hmmio>
  1822. Specifies the file handle of the file to seek in.
  1823. LONG <lOffset>
  1824. Specifies an offset to change the file position.
  1825. int <iOrigin>
  1826. Specifies how the offset specified by <lOffset> is interpreted. Contains
  1827. one of the following flags:
  1828. SEEK_SET
  1829. Seeks to <lOffset> bytes from the beginning of the file.
  1830. SEEK_CUR
  1831. Seeks to <lOffset> bytes from the current file position.
  1832. SEEK_END
  1833. Seeks to <lOffset> bytes from the end of the file.
  1834. .returns
  1835. The return value is the new file position in bytes, relative to the
  1836. beginning of the file. If there is an error, the return value is -1.
  1837. .comments
  1838. Seeking to an invalid location in the file, such as past the end of the
  1839. file, may fail to cause %mmioSeek% to return an error, but may cause subsequent
  1840. I/O operations on the file to fail.
  1841. To locate the end of a file, call %mmioSeek% with <lOffset> set to zero and
  1842. <iOrigin> set to SEEK_END.
  1843. .refpage mmioSendMessage
  1844. LRESULT %mmioSendMessage%(<hmmio>, <uMsg>, <lParam1>, <lParam2>)
  1845. This function sends a message to the I/O procedure associated with the
  1846. specified file.
  1847. .parameters
  1848. HMMIO <hmmio>
  1849. Specifies the file handle for a file opened with %mmioOpen%.
  1850. UINT <uMsg>
  1851. Specifies the message to send to the I/O procedure.
  1852. LONG <lParam1>
  1853. Specifies a parameter for the message.
  1854. LONG <lParam2>
  1855. Specifies a parameter for the message.
  1856. .returns
  1857. The return value depends on the message. If the I/O procedure does not
  1858. recognize the message, the return value is zero.
  1859. .comments
  1860. Use this function to send custom user-defined messages. Do not use it to
  1861. send the %MMIOM_OPEN%, %MMIOM_CLOSE%, %MMIOM_READ%, %MMIOM_WRITE%,
  1862. %MMIOM_WRITEFLUSH%, or %MMIOM_SEEK% messages. Define custom messages to be
  1863. greater than or equal to the MMIOM_USER constant.
  1864. .seealso
  1865. %mmioInstallIOProc%
  1866. .refpage mmioSetBuffer
  1867. MMRESULT %mmioSetBuffer%(<hmmio>, <pchBuffer>, <cchBuffer>, <uFlags>)
  1868. This function enables or disables buffered I/O, or changes the buffer or
  1869. buffer size for a file opened with %mmioOpen%.
  1870. .parameters
  1871. HMMIO <hmmio>
  1872. Specifies the file handle of the file.
  1873. LPSTR <pchBuffer>
  1874. Specifies a pointer to a caller-supplied buffer to use for buffered
  1875. I/O. If NULL, %mmioSetBuffer% allocates an internal buffer for buffered
  1876. I/O.
  1877. LONG <cchBuffer>
  1878. Specifies the size of the caller-supplied buffer, or the size of the
  1879. buffer for %mmioSetBuffer% to allocate.
  1880. UINT <uFlags>
  1881. Is not used and should be set to zero.
  1882. .returns
  1883. The return value is zero if the function is successful. Otherwise, the
  1884. return value specifies an error code. If an error occurs, the file handle
  1885. remains valid. The error code can be one of the following codes:
  1886. MMIOERR_CANNOTWRITE
  1887. The contents of the old buffer could not be written to disk, so the
  1888. operation was aborted.
  1889. MMIOERR_OUTOFMEMORY
  1890. The new buffer could not be allocated, probably due to a lack of
  1891. available memory.
  1892. .comments
  1893. To enable buffering using an internal buffer, set <pchBuffer> to NULL and
  1894. <cchBuffer> to the desired buffer size.
  1895. To supply your own buffer, set <pchBuffer> to point to the buffer, and set
  1896. <cchBuffer> to the size of the buffer.
  1897. To disable buffered I/O, set <pchBuffer> to NULL and <cchBuffer> to zero.
  1898. If buffered I/O is already enabled using an internal buffer, you can
  1899. reallocate the buffer to a different size by setting <pchBuffer> to NULL and
  1900. <cchBuffer> to the new buffer size. The contents of the buffer may be
  1901. changed after resizing.
  1902. .refpage mmioSetInfo
  1903. MMRESULT %mmioSetInfo%(<hmmio>, <lpmmioinfo>, <uFlags>)
  1904. This function updates the information retrieved by %mmioGetInfo% about a
  1905. file opened with %mmioOpen%. Use this function to terminate direct buffer
  1906. access of a file opened for buffered I/O.
  1907. .parameters
  1908. HMMIO <hmmio>
  1909. Specifies the file handle of the file.
  1910. LPMMIOINFO <lpmmioinfo>
  1911. Specifies a pointer to an %MMIOINFO% structure filled with
  1912. information with %mmioGetInfo%.
  1913. UINT <uFlags>
  1914. Is not used and should be set to zero.
  1915. .returns
  1916. The return value is zero if the function is successful.
  1917. .comments
  1918. If you have written to the file I/O buffer, set the MMIO_DIRTY flag in the
  1919. %dwFlags% field of the %MMIOINFO% structure before calling %mmioSetInfo% to
  1920. terminate direct buffer access. Otherwise, the buffer will not get flushed
  1921. to disk.
  1922. .seealso
  1923. %mmioGetInfo%, %MMIOINFO%
  1924. .refpage mmioStringToFOURCC
  1925. FOURCC %mmioStringToFOURCC%(<sz>, <uFlags>)
  1926. This function converts a null-terminated string to a four-character code.
  1927. .parameters
  1928. LPSTR <sz>
  1929. Specifies a pointer to a null-terminated string to a four-character
  1930. code.
  1931. UINT <uFlags>
  1932. Specifies options for the conversion:
  1933. MMIO_TOUPPER
  1934. Converts all characters to uppercase.
  1935. .returns
  1936. The return value is the four character code created from the given string.
  1937. .comments
  1938. This function does not check to see if the string <sz> follows conventions
  1939. regarding legal characters to use in a four-character code. The string is
  1940. simply copied to a four-character code and padded to the right with blanks
  1941. or truncated to four characters as required.
  1942. .seealso
  1943. %mmioFOURCC%
  1944. .refpage mmioWrite
  1945. LRESULT %mmioWrite%(<hmmio>, <pch>, <cch>)
  1946. This function writes a specified number of bytes to a file opened with
  1947. %mmioOpen%.
  1948. .parameters
  1949. HMMIO <hmmio>
  1950. Specifies the file handle of the file.
  1951. LPSTR <pch>
  1952. Specifies a pointer to the buffer to be written to the file.
  1953. LONG <cch>
  1954. Specifies the number of bytes to write to the file.
  1955. .returns
  1956. The return value is the number of bytes actually written. If there is an
  1957. error writing to the file, the return value is -1.
  1958. .comments
  1959. The current file position is incremented by the number of bytes written.
  1960. On 16 bit windows pch is a huge pointer. On 32 bit windows there is no
  1961. distinction between huge poointers and long pointers.
  1962. .seealso
  1963. %mmioRead%
  1964. .refpage sndPlaySound
  1965. BOOL %sndPlaySound%(<lpszSoundName>, <wFlags>)
  1966. This function plays a waveform sound specified by a filename or by an entry
  1967. in the [sounds] section of WIN.INI. If the sound can't be found, it plays
  1968. the default sound specified by the SystemDefault entry in the [sounds]
  1969. section of WIN.INI. If there is no SystemDefault entry or if the default
  1970. sound can't be found, the function makes no sound and returns FALSE.
  1971. .parameters
  1972. LPSTR <lpszSoundName>
  1973. Specifies the name of the sound to play. The function searches the
  1974. [sounds] section of WIN.INI for an entry with this name and plays the
  1975. associated waveform file. If no entry by this name exists, then it
  1976. assumes the name is the name of a waveform file. If this parameter is
  1977. NULL, any currently playing sound is stopped.
  1978. WORD <wFlags>
  1979. Specifies options for playing the sound using one or more of the
  1980. following flags:
  1981. SND_SYNC
  1982. The sound is played synchronously and the function does not return until
  1983. the sound ends.
  1984. SND_ASYNC
  1985. The sound is played asynchronously and the function returns immediately
  1986. after beginning the sound. To terminate an asynchronously-played sound,
  1987. call %sndPlaySound% with <lpszSoundName> set to NULL.
  1988. SND_NODEFAULT
  1989. If the sound can't be found, the function returns silently without
  1990. playing the default sound.
  1991. SND_MEMORY
  1992. The parameter specified by <lpszSoundName> points to an in-memory image
  1993. of a waveform sound.
  1994. SND_LOOP
  1995. The sound will continue to play repeatedly until %sndPlaySound% is
  1996. called again with the <lpszSoundName> parameter set to NULL. You must
  1997. also specify the SND_ASYNC flag to loop sounds.
  1998. SND_NOSTOP
  1999. If a sound is currently playing, the function will immediately return
  2000. FALSE without playing the requested sound.
  2001. .returns
  2002. Returns TRUE if the sound is played, otherwise returns FALSE.
  2003. .comments
  2004. The sound must fit in available physical memory and be playable by an
  2005. installed waveform audio device driver. The directories searched for sound
  2006. files are, in order: the current directory; the Windows directory; the
  2007. Windows system directory; the directories listed in the PATH environment
  2008. variable; the list of directories mapped in a network. See the Windows
  2009. %OpenFile% function for more information about the directory search order.
  2010. If you specify the SND_MEMORY flag, <lpszSoundName> must point to an
  2011. in-memory image of a waveform sound. If the sound is stored as a resource,
  2012. use %LoadResource% and %LockResource% to load and lock the resource and get
  2013. a pointer to it. If the sound is not a resource, you must use %GlobalAlloc%
  2014. with the GMEM_MOVEABLE and GMEM_SHARE flags set and then %GlobalLock% to
  2015. allocate and lock memory for the sound.
  2016. .seealso
  2017. %MessageBeep%
  2018. .refpage timeBeginPeriod
  2019. WORD %timeBeginPeriod%(<wPeriod>)
  2020. This function sets the minimum (lowest number of milliseconds) timer
  2021. resolution that an application or driver is going to use. Call this function
  2022. immediately before starting to use timer-event services, and call
  2023. %timeEndPeriod% immediately after finishing with the timer-event services.
  2024. .parameters
  2025. WORD <wPeriod>
  2026. Specifies the minimum timer-event resolution that the application or
  2027. driver will use.
  2028. .returns
  2029. Returns zero if successful. Returns TIMERR_NOCANDO if the specified
  2030. <wPeriod> resolution value is out of range.
  2031. .comments
  2032. For each call to %timeBeginPeriod%, you must call %timeEndPeriod% with a
  2033. matching <wPeriod> value. An application or driver can make multiple calls
  2034. to %timeBeginPeriod%, as long as each %timeBeginPeriod% call is matched with
  2035. a %timeEndPeriod% call.
  2036. .seealso
  2037. %timeEndPeriod%, %timeSetEvent%
  2038. .refpage timeEndPeriod
  2039. WORD %timeEndPeriod%(<wPeriod>)
  2040. This function clears a previously set minimum (lowest number of
  2041. milliseconds) timer resolution that an application or driver is going to
  2042. use. Call this function immediately after using timer event services.
  2043. .parameters
  2044. WORD <wPeriod>
  2045. Specifies the minimum timer-event resolution value specified in the
  2046. previous call to %timeBeginPeriod%.
  2047. .returns
  2048. Returns zero if successful. Returns TIMERR_NOCANDO if the specified
  2049. <wPeriod> resolution value is out of range.
  2050. .comments
  2051. For each call to %timeBeginPeriod%, you must call %timeEndPeriod% with a
  2052. matching <wPeriod> value. An application or driver can make multiple calls
  2053. to %timeBeginPeriod%, as long as each %timeBeginPeriod% call is matched with
  2054. a %timeEndPeriod% call.
  2055. .seealso
  2056. %timeBeginPeriod%, %timeSetEvent%
  2057. .refpage timeGetDevCaps
  2058. WORD %timeGetDevCaps%(<lpTimeCaps>, <wSize>)
  2059. This function queries the timer device to determine its capabilities.
  2060. .parameters
  2061. LPTIMECAPS <lpTimeCaps>
  2062. Specifies a far pointer to a %TIMECAPS% structure. This structure is
  2063. filled with information about the capabilities of the timer device.
  2064. WORD <wSize>
  2065. Specifies the size of the %TIMECAPS% structure.
  2066. .returns
  2067. Returns zero if successful. Returns TIMERR_NOCANDO if it fails to return the
  2068. timer device capabilities.
  2069. .refpage timeGetSystemTime
  2070. WORD %timeGetSystemTime%(<lpTime>, <wSize>)
  2071. This function retrieves the system time in milliseconds. The system time is
  2072. the time elapsed since Windows was started.
  2073. .parameters
  2074. LPMMTIME <lpTime>
  2075. Specifies a far pointer to an %MMTIME% data structure.
  2076. WORD <wSize>
  2077. Specifies the size of the %MMTIME% structure.
  2078. .returns
  2079. Returns zero. The system time is returned in the %ms% field of the %MMTIME%
  2080. structure.
  2081. .comments
  2082. The time is always returned in milliseconds.
  2083. .seealso
  2084. %timeGetTime%
  2085. .refpage timeGetTime
  2086. DWORD %timeGetTime%()
  2087. This function retrieves the system time in milliseconds. The system time is
  2088. the time elapsed since Windows was started.
  2089. .parameters
  2090. None
  2091. .returns
  2092. The return value is the system time in milliseconds.
  2093. .comments
  2094. The only difference between this function and the %timeGetSystemTime%
  2095. function is %timeGetSystemTime% uses the standard multimedia time structure
  2096. %MMTIME% to return the system time. The %timeGetTime% function has less
  2097. overhead than %timeGetSystemTime%.
  2098. .seealso
  2099. %timeGetSystemTime%
  2100. .refpage timeKillEvent
  2101. WORD %timeKillEvent%(<wID>)
  2102. This functions destroys a specified timer callback event.
  2103. .parameters
  2104. WORD <wID>
  2105. Identifies the event to be destroyed.
  2106. .returns
  2107. Returns zero if successful. Returns TIMERR_NOCANDO if the specified timer
  2108. event does not exist.
  2109. .comments
  2110. The timer event ID specified by <wID> must be an ID returned by
  2111. %timeSetEvent%.
  2112. .seealso
  2113. %timeSetEvent%
  2114. .refpage timeSetEvent
  2115. WORD %timeSetEvent%(<wDelay>, <wResolution>, <lpFunction>, <dwUser>,
  2116. <wFlags>)
  2117. This function sets up a timed callback event. The event can be a one-time
  2118. event or a periodic event. Once activated, the event calls the specified
  2119. callback function.
  2120. .parameters
  2121. WORD <wDelay>
  2122. Specifies the event period in milliseconds. If the delay is less than
  2123. the minimum period supported by the timer, or greater than the maximum
  2124. period supported by the timer, the function returns an error.
  2125. WORD <wResolution>
  2126. Specifies the accuracy of the delay in milliseconds. The resolution of
  2127. the timer event increases with smaller <wResolution> values. To reduce
  2128. system overhead, use the maximum <wResolution> value appropriate for
  2129. your application.
  2130. LPTIMECALLBACK <lpFunction>
  2131. Specifies the procedure address of a callback function that is called
  2132. once upon expiration of a one-shot event or periodically upon expiration
  2133. of periodic events.
  2134. DWORD <dwUser>
  2135. Contains user-supplied callback data.
  2136. WORD <wFlags>
  2137. Specifies the type of timer event, using one of the following flags:
  2138. TIME_ONESHOT
  2139. Event occurs once, after <wPeriod> milliseconds.
  2140. TIME_PERIODIC
  2141. Event occurs every <wPeriod> milliseconds.
  2142. .returns
  2143. Returns an ID code that identifies the timer event. Returns NULL if the
  2144. timer event was not created. The ID code is also passed to the callback
  2145. function.
  2146. .comments
  2147. Using this function to generate a high-frequency periodic-delay event (with
  2148. a period less than 10 milliseconds) can consume a significant portion of the
  2149. system CPU bandwidth. Any call to %timeSetEvent% for a periodic-delay timer
  2150. must be paired with a call to %timeKillEvent%.
  2151. The callback function must reside in a DLL. You don't have to use
  2152. %MakeProcInstance% to get a procedure-instance address for the callback
  2153. function.
  2154. .head "Callback"
  2155. void FAR PASCAL %TimeFunc%(<wID>, <wMsg>, <dwUser>, <dw1>, <dw2>)
  2156. %TimeFunc% is a placeholder for the application-supplied function name. The
  2157. actual name must be exported by including it in the EXPORTS statement of the
  2158. module-definition file for the DLL.
  2159. %Parameters%
  2160. WORD <wID>
  2161. The ID of the timer event. This is the ID returned by %timeSetEvent%.
  2162. WORD <wMsg>
  2163. Not used.
  2164. DWORD <dwUser>
  2165. User instance data supplied to the <dwUser> parameter of
  2166. %timeSetEvent%.
  2167. DWORD <dw1>
  2168. Not used.
  2169. DWORD <dw2>
  2170. Not used.
  2171. %Comments%
  2172. Because the callback is accessed at interrupt time, it must reside in a DLL,
  2173. and its code segment must be specified as FIXED in the module-definition
  2174. file for the DLL. Any data that the callback accesses must be in a FIXED
  2175. data segment as well. The callback may not make any system calls except for
  2176. %PostMessage%, %timeGetSystemTime%, %timeGetTime%, %timeSetEvent%,
  2177. %timeKillEvent%, %midiOutShortMsg%, %midiOutLongMsg%, and %OutputDebugStr%.
  2178. .seealso
  2179. %timeKillEvent%, %timeBeginPeriod%, %timeEndPeriod%
  2180. .refpage waveInAddBuffer
  2181. WORD %waveInAddBuffer%(<hWaveIn>, <lpWaveInHdr>, <wSize>)
  2182. This function sends an input buffer to a waveform input device. When the
  2183. buffer is filled, it is sent back to the application.
  2184. .parameters
  2185. HWAVEIN <hWaveIn>
  2186. Specifies a handle to the waveform input device.
  2187. LPWAVEHDR <lpWaveInHdr>
  2188. Specifies a far pointer to a %WAVEHDR% structure that identifies the
  2189. buffer.
  2190. WORD <wSize>
  2191. Specifies the size of the %WAVEHDR% structure.
  2192. .returns
  2193. Returns zero if the function was successful. Otherwise, it returns an error
  2194. number. Possible error returns are:
  2195. .list Value Meaning
  2196. MMSYSERR_INVALHANDLE
  2197. Specified device handle is invalid.
  2198. WAVERR_UNPREPARED
  2199. <lpWaveInHdr> hasn't been prepared.
  2200. .endlist
  2201. .comments
  2202. The data buffer must be prepared with %waveInPrepareHeader% before it is
  2203. passed to %waveInAddBuffer%. The %WAVEHDR% data structure and the data
  2204. buffer pointed to by its %lpData% field must be allocated with %GlobalAlloc%
  2205. using the GMEM_MOVEABLE and GMEM_SHARE flags, and locked with %GlobalLock%.
  2206. .seealso
  2207. %waveInPrepareHeader%
  2208. .refpage waveInClose
  2209. WORD %waveInClose%(<hWaveIn>)
  2210. This function closes the specified waveform input device.
  2211. .parameters
  2212. HWAVEIN <hWaveIn>
  2213. Specifies a handle to the waveform input device. If the function is
  2214. successful, the handle is no longer valid after this call.
  2215. .returns
  2216. Returns zero if the function was successful. Otherwise, it returns an error
  2217. number. Possible error returns are:
  2218. .list Value Meaning
  2219. MMSYSERR_INVALHANDLE
  2220. Specified device handle is invalid.
  2221. WAVERR_STILLPLAYING
  2222. There are still buffers in the queue.
  2223. .endlist
  2224. .comments
  2225. If there are input buffers that have been sent with %waveInAddBuffer%, and
  2226. haven't been returned to the application, the close operation will fail.
  2227. Call %waveInReset% to mark all pending buffers as done.
  2228. .seealso
  2229. %waveInOpen%, %waveInReset%
  2230. .refpage waveInGetDevCaps
  2231. WORD %waveInGetDevCaps%(<wDeviceID>, <lpCaps>, <wSize>)
  2232. This function queries a specified waveform input device to determine its
  2233. capabilities.
  2234. .parameters
  2235. WORD <wDeviceID>
  2236. Identifies the waveform input device.
  2237. LPWAVEINCAPS <lpCaps>
  2238. Specifies a far pointer to a %WAVEINCAPS% structure. This structure is
  2239. filled with information about the capabilities of the device.
  2240. WORD <wSize>
  2241. Specifies the size of the %WAVEINCAPS% structure.
  2242. .returns
  2243. Returns zero if the function was successful. Otherwise, it returns an error
  2244. number. Possible error returns are:
  2245. .list Value Meaning
  2246. MMSYSERR_BADDEVICEID
  2247. Specified device ID is out of range.
  2248. MMSYSERR_NODRIVER
  2249. The driver was not installed.
  2250. .endlist
  2251. .comments
  2252. Use %waveInGetNumDevs% to determine the number of waveform input devices
  2253. present in the system. The device ID specified by <wDeviceID> varies from
  2254. zero to one less than the number of devices present. Only <wSize> bytes (or
  2255. less) of information is copied to the location pointed to by <lpCaps>. If
  2256. <wSize> is zero, nothing is copied, and the function returns zero.
  2257. .seealso
  2258. %waveInGetNumDevs%
  2259. .refpage waveInGetErrorText
  2260. WORD %waveInGetErrorText%(<wError>, <lpText>, <wSize>)
  2261. This function retrieves a textual description of the error identified by the
  2262. specified error number.
  2263. .parameters
  2264. WORD <wError>
  2265. Specifies the error number.
  2266. LPSTR <lpText>
  2267. Specifies a far pointer to the buffer to be filled with the textual
  2268. error description.
  2269. WORD <wSize>
  2270. Specifies the size of the buffer pointed to by <lpText>.
  2271. .returns
  2272. Returns zero if the function was successful. Otherwise, it returns an error
  2273. number. Possible error returns are:
  2274. .list Value Meaning
  2275. MMSYSERR_BADERRNUM
  2276. Specified error number is out of range.
  2277. .endlist
  2278. .comments
  2279. If the textual error description is longer than the buffer, the description
  2280. is truncated. The returned string is always null-terminated. If <wSize> is
  2281. zero, nothing is copied, and the function returns zero. All error
  2282. descriptions are less than MAXERRORLENGTH characters long.
  2283. .refpage waveInGetID
  2284. WORD %waveInGetID%(<hWaveIn>, <lpwDeviceID>)
  2285. This function gets the device ID for a waveform input device.
  2286. .parameters
  2287. HWAVEIN <hWaveIn>
  2288. Specifies the handle to the waveform input device.
  2289. LPWORD <lpwDeviceID>
  2290. Specifies a pointer to the WORD-sized memory location to fill with the
  2291. device ID.
  2292. .returns
  2293. Returns zero if successful. Otherwise, it returns an error number. Possible
  2294. error returns are:
  2295. MMSYSERR_INVALHANDLE
  2296. The <hWaveIn> parameter specifies an invalid handle.
  2297. .refpage waveInGetNumDevs
  2298. WORD %waveInGetNumDevs%()
  2299. This function returns the number of waveform input devices.
  2300. .parameters
  2301. None
  2302. .returns
  2303. Returns the number of waveform input devices present in the system.
  2304. .seealso
  2305. %waveInGetDevCaps%
  2306. .refpage waveInGetPosition
  2307. WORD %waveInGetPosition%(<hWaveIn>, <lpInfo>, <wSize>)
  2308. This function retrieves the current input position of the specified waveform
  2309. input device.
  2310. .parameters
  2311. HWAVEIN <hWaveIn>
  2312. Specifies a handle to the waveform input device.
  2313. LPMMTIME <lpInfo>
  2314. Specifies a far pointer to an %MMTIME% structure.
  2315. WORD <wSize>
  2316. Specifies the size of the %MMTIME% structure.
  2317. .returns
  2318. Returns zero if the function was successful. Possible error returns are:
  2319. .list Value Meaning
  2320. MMSYSERR_INVALHANDLE
  2321. Specified device handle is invalid.
  2322. .endlist
  2323. .comments
  2324. Before calling %waveInGetPosition%, set the %wType% field of the %MMTIME%
  2325. structure to indicate the time format that you desire. After calling
  2326. %waveInGetPosition%, be sure to check the %wType% field to determine if the
  2327. desired time format is supported. If the desired format is not supported,
  2328. %wType% will specify an alternative format.
  2329. The position is set to zero when the device is opened or reset.
  2330. .refpage waveInOpen
  2331. WORD %waveInOpen%(<lphWaveIn>, <wDeviceID>, <lpFormat>, <dwCallback>,
  2332. <dwCallbackInstance>, <dwFlags>)
  2333. This function opens a specified waveform input device for recording.
  2334. .parameters
  2335. LPHWAVEIN <lphWaveIn>
  2336. Specifies a far pointer to a HWAVEIN handle. This location is filled
  2337. with a handle identifying the opened waveform input device. Use this
  2338. handle to identify the device when calling other waveform input
  2339. functions. This parameter may be NULL if the WAVE_FORMAT_QUERY flag is
  2340. specified for <dwFlags>.
  2341. WORD <wDeviceID>
  2342. Identifies the waveform input device to open. Use a valid device ID or
  2343. the following flag:
  2344. WAVE_MAPPER
  2345. If this flag is specified, the function selects a waveform input device
  2346. capable of recording in the given format.
  2347. LPWAVEFORMAT <lpFormat>
  2348. Specifies a pointer to a %WAVEFORMAT% data structure that identifies the
  2349. desired format for recording waveform data.
  2350. DWORD <dwCallback>
  2351. Specifies the address of a callback function or a handle to a window
  2352. called during waveform recording to process messages related to the
  2353. progress of recording.
  2354. DWORD <dwCallbackInstance>
  2355. Specifies user instance data passed to the callback. This parameter is
  2356. not used with window callbacks.
  2357. DWORD <dwFlags>
  2358. Specifies flags for opening the device.
  2359. WAVE_FORMAT_QUERY
  2360. If this flag is specified, the device will be queried to determine if it
  2361. supports the given format but will not actually be opened.
  2362. CALLBACK_WINDOW
  2363. If this flag is specified, <dwCallback> is assumed to be a window
  2364. handle.
  2365. CALLBACK_FUNCTION
  2366. If this flag is specified, <dwCallback> is assumed to be a callback
  2367. procedure address.
  2368. .returns
  2369. Returns zero if the function was successful. Otherwise, it returns an error
  2370. number. Possible error returns are:
  2371. .list Value Meaning
  2372. MMSYSERR_NODRIVER
  2373. The driver was not installed.
  2374. MMSYSERR_BADDEVICEID
  2375. Specified device ID is out of range.
  2376. MMSYSERR_ALLOCATED
  2377. Specified resource is already allocated.
  2378. MMSYSERR_NOMEM
  2379. Unable to allocate or lock memory.
  2380. WAVERR_BADFORMAT
  2381. Attempted to open with an unsupported wave format.
  2382. .endlist
  2383. .comments
  2384. Use %waveInGetNumDevs% to determine the number of waveform input devices
  2385. present in the system. The device ID specified by <wDeviceID> varies from
  2386. zero to one less than the number of devices present.
  2387. If a window is chosen to receive callback information, the following
  2388. messages are sent to the window procedure function to indicate the progress
  2389. of waveform input: %MM_WIM_OPEN%, %MM_WIM_CLOSE%, %MM_WIM_DATA%
  2390. If a function is chosen to receive callback information, the following
  2391. messages are sent to the function to indicate the progress of waveform
  2392. input: %WIM_OPEN%, %WIM_CLOSE%, %WIM_DATA%. The callback function must
  2393. reside in a DLL. You do not have to use %MakeProcInstance% to get a
  2394. procedure-instance address for the callback function.
  2395. .head "Callback"
  2396. void FAR PASCAL %WaveInFunc%(<hWaveIn>, <wMsg>, <dwInstance>, <dwParam1>,
  2397. <dwParam2>)
  2398. %WaveInFunc% is a placeholder for the application-supplied function name.
  2399. The actual name must be exported by including it in an EXPORTS statement in
  2400. the DLL's module-definition file.
  2401. %Parameters%
  2402. HWAVEIN <hWaveIn>
  2403. Specifies a handle to the waveform device associated with the callback.
  2404. WORD <wMsg>
  2405. Specifies a waveform input device.
  2406. DWORD <dwInstance>
  2407. Specifies the user instance data specified with %waveInOpen%.
  2408. DWORD <dwParam1>
  2409. Specifies a parameter for the message.
  2410. DWORD <dwParam2>
  2411. Specifies a parameter for the message.
  2412. %Comments%
  2413. Because the callback is accessed at interrupt time, it must reside in a DLL
  2414. and its code segment must be specified as FIXED in the module-definition
  2415. file for the DLL. Any data that the callback accesses must be in a FIXED
  2416. data segment as well. The callback may not make any system calls except for
  2417. %PostMessage%, %timeGetSystemTime%, %timeGetTime%, %timeSetEvent%,
  2418. %timeKillEvent%, %midiOutShortMsg%, %midiOutLongMsg%, and %OutputDebugStr%.
  2419. .seealso
  2420. %waveInClose%
  2421. .refpage waveInPrepareHeader
  2422. WORD %waveInPrepareHeader%(<hWaveIn>, <lpWaveInHdr>, <wSize>)
  2423. This function prepares a buffer for waveform input.
  2424. .parameters
  2425. HWAVEIN <hWaveIn>
  2426. Specifies a handle to the waveform input device.
  2427. LPWAVEHDR <lpWaveInHdr>
  2428. Specifies a pointer to a %WAVEHDR% structure that identifies the buffer
  2429. to be prepared.
  2430. WORD <wSize>
  2431. Specifies the size of the %WAVEHDR% structure.
  2432. .returns
  2433. Returns zero if the function was successful. Otherwise, it returns an error
  2434. number. Possible error returns are:
  2435. .list Value Meaning
  2436. MMSYSERR_INVALHANDLE
  2437. Specified device handle is invalid.
  2438. MMSYSERR_NOMEM
  2439. Unable to allocate or lock memory.
  2440. .endlist
  2441. .comments
  2442. The %WAVEHDR% data structure and the data block pointed to by its %lpData%
  2443. field must be allocated with %GlobalAlloc% using the GMEM_MOVEABLE and
  2444. GMEM_SHARE flags, and locked with %GlobalLock%. Preparing a header that has
  2445. already been prepared will have no effect, and the function will return
  2446. zero.
  2447. .seealso
  2448. %waveInUnprepareHeader%
  2449. .refpage waveInReset
  2450. WORD %waveInReset%(<hWaveIn>)
  2451. This function stops input on a given waveform input device and resets the
  2452. current position to 0. All pending buffers are marked as done and returned
  2453. to the application.
  2454. .parameters
  2455. HWAVEIN <hWaveIn>
  2456. Specifies a handle to the waveform input device.
  2457. .returns
  2458. Returns zero if the function was successful. Otherwise, it returns an error
  2459. number. Possible error returns are:
  2460. .list Value Meaning
  2461. MMSYSERR_INVALHANDLE
  2462. Specified device handle is invalid.
  2463. .endlist
  2464. .seealso
  2465. %waveInStart%, %waveInStop%, %waveInAddBuffer%, %waveInClose%
  2466. .refpage waveInStart
  2467. WORD %waveInStart%(<hWaveIn>)
  2468. This function starts input on the specified waveform input device.
  2469. .parameters
  2470. HWAVEIN <hWaveIn>
  2471. Specifies a handle to the waveform input device.
  2472. .returns
  2473. Returns zero if the function was successful. Otherwise, it returns an error
  2474. number. Possible error returns are:
  2475. .list Value Meaning
  2476. MMSYSERR_INVALHANDLE
  2477. Specified device handle is invalid.
  2478. .endlist
  2479. .comments
  2480. Buffers are returned to the client when full or when %waveInReset% is called
  2481. (the %dwBytesRecorded% field in the header will contain the actual length of
  2482. data). If there are no buffers in the queue, the data is thrown away without
  2483. notification to the client, and input continues.
  2484. Calling this function when input is already started has no effect, and the
  2485. function returns zero.
  2486. .seealso
  2487. %waveInStop%, %waveInReset%
  2488. .refpage waveInStop
  2489. WORD %waveInStop%(<hWaveIn>)
  2490. This function stops waveform input.
  2491. .parameters
  2492. HWAVEIN <hWaveIn>
  2493. Specifies a handle to the waveform input device.
  2494. .returns
  2495. Returns zero if the function was successful. Otherwise, it returns an error
  2496. number. Possible error returns are:
  2497. .list Value Meaning
  2498. MMSYSERR_INVALHANDLE
  2499. Specified device handle is invalid.
  2500. .endlist
  2501. .comments
  2502. If there are any buffers in the queue, the current buffer will be marked as
  2503. done (the %dwBytesRecorded% field in the header will contain the actual
  2504. length of data), but any empty buffers in the queue will remain there.
  2505. Calling this function when input is not started has no effect, and the
  2506. function returns zero.
  2507. .seealso
  2508. %waveInStart%, %waveInReset%
  2509. .refpage waveInUnprepareHeader
  2510. WORD %waveInUnprepareHeader%(<hWaveIn>, <lpWaveInHdr>, <wSize>)
  2511. This function cleans up the preparation performed by %waveInPrepareHeader%.
  2512. The function must be called after the device driver fills a data buffer and
  2513. returns it to the application. You must call this function before freeing
  2514. the data buffer.
  2515. .parameters
  2516. HWAVEIN <hWaveIn>
  2517. Specifies a handle to the waveform input device.
  2518. LPWAVEHDR <lpWaveInHdr>
  2519. Specifies a pointer to a %WAVEHDR% structure identifying the data buffer
  2520. to be cleaned up.
  2521. WORD <wSize>
  2522. Specifies the size of the %WAVEHDR% structure.
  2523. .returns
  2524. Returns zero if the function was successful. Otherwise, it returns an error
  2525. number. Possible error returns are:
  2526. .list Value Meaning
  2527. MMSYSERR_INVALHANDLE
  2528. Specified device handle is invalid.
  2529. WAVERR_STILLPLAYING
  2530. <lpWaveInHdr> is still in the queue.
  2531. .endlist
  2532. .comments
  2533. This function is the complementary function to %waveInPrepareHeader%. You
  2534. must call this function before freeing the data buffer with %GlobalFree%.
  2535. After passing a buffer to the device driver with %waveInAddBuffer%, you must
  2536. wait until the driver is finished with the buffer before calling
  2537. %waveInUnprepareHeader%. Unpreparing a buffer that has not been prepared has
  2538. no effect, and the function returns zero.
  2539. .seealso
  2540. %waveInPrepareHeader%
  2541. .refpage waveOutBreakLoop
  2542. WORD %waveOutBreakLoop%(<hWaveOut>)
  2543. This function breaks a loop on a given waveform output device and allows
  2544. playback to continue with the next block in the driver list.
  2545. .parameters
  2546. HWAVEOUT <hWaveOut>
  2547. Specifies a handle to the waveform output device.
  2548. .returns
  2549. Returns zero if the function was successful. Otherwise, it returns an error
  2550. number. Possible error returns are:
  2551. .list Value Meaning
  2552. MMSYSERR_INVALHANDLE
  2553. Specified device handle is invalid.
  2554. .endlist
  2555. .comments
  2556. Waveform looping is controlled by the %dwLoops% and %dwFlags% fields in the
  2557. %WAVEHDR% structures passed to the device with %waveOutWrite%. Use the
  2558. WHDR_BEGINLOOP and WHDR_ENDLOOP flags in the %dwFlags% field to specify the
  2559. beginning and ending data blocks for looping.
  2560. To loop on a single block, specify both flags for the same block. To specify
  2561. the number of loops, use the %dwLoops% field in the %WAVEHDR% structure for
  2562. the first block in the loop.
  2563. The blocks making up the loop are played to the end before the loop is
  2564. terminated.
  2565. Calling this function when the nothing is playing or looping has no effect,
  2566. and the function returns zero.
  2567. .seealso
  2568. %waveOutWrite%, %waveOutPause%, %waveOutRestart%
  2569. .refpage waveOutClose
  2570. WORD %waveOutClose%(<hWaveOut>)
  2571. This function closes the specified waveform output device.
  2572. .parameters
  2573. HWAVEOUT <hWaveOut>
  2574. Specifies a handle to the waveform output device. If the function is
  2575. successful, the handle is no longer valid after this call.
  2576. .returns
  2577. Returns zero if the function was successful. Otherwise, it returns an error
  2578. number. Possible error returns are:
  2579. .list Value Meaning
  2580. MMSYSERR_INVALHANDLE
  2581. Specified device handle is invalid.
  2582. WAVERR_STILLPLAYING
  2583. There are still buffers in the queue.
  2584. .endlist
  2585. .comments
  2586. If the device is still playing a waveform, the close operation will fail.
  2587. Use %waveOutReset% to terminate waveform playback before calling
  2588. %waveOutClose%.
  2589. .seealso
  2590. %waveOutOpen%, %waveOutReset%
  2591. .refpage waveOutGetDevCaps
  2592. WORD %waveOutGetDevCaps%(<wDeviceID>, <lpCaps>, <wSize>)
  2593. This function queries a specified waveform device to determine its
  2594. capabilities.
  2595. .parameters
  2596. WORD <wDeviceID>
  2597. Identifies the waveform output device.
  2598. LPWAVEOUTCAPS <lpCaps>
  2599. Specifies a far pointer to a %WAVEOUTCAPS% structure. This structure is
  2600. filled with information about the capabilities of the device.
  2601. WORD <wSize>
  2602. Specifies the size of the %WAVEOUTCAPS% structure.
  2603. .returns
  2604. Returns zero if the function was successful. Otherwise, it returns an error
  2605. number. Possible error returns are:
  2606. .list Value Meaning
  2607. MMSYSERR_BADDEVICEID
  2608. Specified device ID is out of range.
  2609. MMSYSERR_NODRIVER
  2610. The driver was not installed.
  2611. .endlist
  2612. .comments
  2613. Use %waveOutGetNumDevs% to determine the number of waveform output devices
  2614. present in the system. The device ID specified by <wDeviceID> varies from
  2615. zero to one less than the number of devices present. Only <wSize> bytes (or
  2616. less) of information is copied to the location pointed to by <lpCaps>. If
  2617. <wSize> is zero, nothing is copied, and the function returns zero.
  2618. .seealso
  2619. %waveOutGetNumDevs%
  2620. .refpage waveOutGetErrorText
  2621. WORD %waveOutGetErrorText%(<wError>, <lpText>, <wSize>)
  2622. This function retrieves a textual description of the error identified by the
  2623. specified error number.
  2624. .parameters
  2625. WORD <wError>
  2626. Specifies the error number.
  2627. LPSTR <lpText>
  2628. Specifies a far pointer to a buffer to be filled with the textual error
  2629. description.
  2630. WORD <wSize>
  2631. Specifies the length of the buffer pointed to by <lpText>.
  2632. .returns
  2633. Returns zero if the function was successful. Otherwise, it returns an error
  2634. number. Possible error returns are:
  2635. .list Value Meaning
  2636. MMSYSERR_BADERRNUM
  2637. Specified error number is out of range.
  2638. .endlist
  2639. .comments
  2640. If the textual error description is longer than the specified buffer, the
  2641. description is truncated. The returned error string is always
  2642. null-terminated. If <wSize> is zero, nothing is copied, and the function
  2643. returns zero. All error descriptions are less than MAXERRORLENGTH characters
  2644. long.
  2645. .refpage waveOutGetID
  2646. WORD %waveOutGetID%(<hWaveOut>, <lpwDeviceID>)
  2647. This function gets the device ID for a waveform output device.
  2648. .parameters
  2649. HWAVEOUT <hWaveOut>
  2650. Specifies the handle to the waveform output device.
  2651. LPWORD <lpwDeviceID>
  2652. Specifies a pointer to the WORD-sized memory location to be filled with
  2653. the device ID.
  2654. .returns
  2655. Returns zero if successful. Otherwise, it returns an error number. Possible
  2656. error returns are:
  2657. MMSYSERR_INVALHANDLE
  2658. The <hWaveOut> parameter specifies an invalid handle.
  2659. .refpage waveOutGetNumDevs
  2660. WORD %waveOutGetNumDevs%()
  2661. This function retrieves the number of waveform output devices present in the
  2662. system.
  2663. .parameters
  2664. None
  2665. .returns
  2666. Returns the number of waveform output devices present in the system.
  2667. .seealso
  2668. %waveOutGetDevCaps%
  2669. .refpage waveOutGetPitch
  2670. WORD %waveOutGetPitch%(<hWaveOut>, <lpdwPitch>)
  2671. This function queries the the current pitch setting of a waveform output
  2672. device.
  2673. .parameters
  2674. HWAVEOUT <hWaveOut>
  2675. Specifies a handle to the waveform output device.
  2676. LPDWORD <lpdwPitch>
  2677. Specifies a far pointer to a location to be filled with the current
  2678. pitch multiplier setting. The pitch multiplier indicates the current
  2679. change in pitch from the original authored setting. The pitch multiplier
  2680. must be a positive value.
  2681. The pitch multiplier is specified as a fixed-point value. The high-order
  2682. word of the DWORD location contains the signed integer part of the
  2683. number, and the low-order word contains the fractional part. The
  2684. fraction is expressed as a WORD in which a value of 0x8000 represents
  2685. one half, and 0x4000 represents one quarter. For example, the value
  2686. 0x00010000 specifies a multiplier of 1.0 (no pitch change), and a value
  2687. of 0x000F8000 specifies a multiplier of 15.5.
  2688. .returns
  2689. Returns zero if the function was successful. Otherwise, it returns an error
  2690. number. Possible error returns are:
  2691. .list Value Meaning
  2692. MMSYSERR_INVALHANDLE
  2693. Specified device handle is invalid.
  2694. MMSYSERR_NOTSUPPORTED
  2695. Function isn't supported.
  2696. .endlist
  2697. .comments
  2698. Changing the pitch does not change the playback rate, sample rate, or
  2699. playback time. Not all devices support pitch changes. To determine whether
  2700. the device supports pitch control, use the WAVECAPS_PITCH flag to test the
  2701. %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  2702. %waveOutGetDevCaps%).
  2703. .seealso
  2704. %waveOutSetPitch%, %waveOutGetPlaybackRate%, %waveOutSetPlaybackRate%
  2705. .refpage waveOutGetPlaybackRate
  2706. WORD %waveOutGetPlaybackRate%(<hWaveOut>, <lpdwRate>)
  2707. This function queries the current playback rate setting of a waveform output
  2708. device.
  2709. .parameters
  2710. HWAVEOUT <hWaveOut>
  2711. Specifies a handle to the waveform output device.
  2712. LPDWORD <lpdwRate>
  2713. Specifies a far pointer to a location to be filled with the current
  2714. playback rate. The playback rate setting is a multiplier indicating the
  2715. current change in playback rate from the original authored setting. The
  2716. playback rate multiplier must be a positive value.
  2717. The rate is specified as a fixed-point value. The high-order word of the
  2718. DWORD location contains the signed integer part of the number, and the
  2719. low-order word contains the fractional part. The fraction is expressed
  2720. as a WORD in which a value of 0x8000 represents one half, and 0x4000
  2721. represents one quarter. For example, the value 0x00010000 specifies a
  2722. multiplier of 1.0 (no playback rate change), and a value of 0x000F8000
  2723. specifies a multiplier of 15.5.
  2724. .returns
  2725. Returns zero if the function was successful. Otherwise, it returns an error
  2726. number. Possible error returns are:
  2727. .list Value Meaning
  2728. MMSYSERR_INVALHANDLE
  2729. Specified device handle is invalid.
  2730. MMSYSERR_NOTSUPPORTED
  2731. Function isn't supported.
  2732. .endlist
  2733. .comments
  2734. Changing the playback rate does not change the sample rate but does change
  2735. the playback time.
  2736. Not all devices support playback rate changes. To determine whether a device
  2737. supports playback rate changes, use the WAVECAPS_PLAYBACKRATE flag to test
  2738. the %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  2739. %waveOutGetDevCaps%).
  2740. .seealso
  2741. %waveOutSetPlaybackRate%, %waveOutSetPitch%, %waveOutGetPitch%
  2742. .refpage waveOutGetPosition
  2743. WORD %waveOutGetPosition%(<hWaveOut>, <lpInfo>, <wSize>)
  2744. This function retrieves the current playback position of the specified
  2745. waveform output device.
  2746. .parameters
  2747. HWAVEOUT <hWaveOut>
  2748. Specifies a handle to the waveform output device.
  2749. LPMMTIME <lpInfo>
  2750. Specifies a far pointer to an %MMTIME% structure.
  2751. WORD <wSize>
  2752. Specifies the size of the %MMTIME% structure.
  2753. .returns
  2754. Returns zero if the function was successful. Otherwise, it returns an error
  2755. number. Possible error returns are:
  2756. .list Value Meaning
  2757. MMSYSERR_INVALHANDLE
  2758. Specified device handle is invalid.
  2759. .endlist
  2760. .comments
  2761. Before calling %waveOutGetPosition%, set the %wType% field of the MMTIME
  2762. structure to indicate the time format that you desire. After calling
  2763. %waveOutGetPosition%, check the %wType% field to determine if the desired
  2764. time format is supported. If the desired format is not supported, %wType%
  2765. will specify an alternative format.
  2766. The position is set to zero when the device is opened or reset.
  2767. .refpage waveOutGetVolume
  2768. WORD %waveOutGetVolume%(<wDeviceID>, <lpdwVolume>)
  2769. This function queries the current volume setting of a waveform output
  2770. device.
  2771. .parameters
  2772. WORD <wDeviceID>
  2773. Identifies the waveform output device.
  2774. LPDWORD <lpdwVolume>
  2775. Specifies a far pointer to a location to be filled with the current
  2776. volume setting. The low-order word of this location contains the left
  2777. channel volume setting, and the high-order word contains the right
  2778. channel setting. A value of 0xFFFF represents full volume, and a value
  2779. of 0x0000 is silence.
  2780. If a device does not support both left and right volume control, the
  2781. low-order word of the specified location contains the mono volume
  2782. level.
  2783. The full 16-bit setting(s) set with %waveOutSetVolume% is returned,
  2784. regardless of whether the device supports the full 16 bits of
  2785. volume-level control.
  2786. .returns
  2787. Returns zero if the function was successful. Otherwise, it returns an error
  2788. number. Possible error returns are:
  2789. .list Value Meaning
  2790. MMSYSERR_INVALHANDLE
  2791. Specified device handle is invalid.
  2792. MMSYSERR_NOTSUPPORTED
  2793. Function isn't supported.
  2794. MMSYSERR_NODRIVER
  2795. The driver was not installed.
  2796. .endlist
  2797. .comments
  2798. Not all devices support volume changes. To determine whether the device
  2799. supports volume control, use the WAVECAPS_VOLUME flag to test the
  2800. %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  2801. %waveOutGetDevCaps%).
  2802. To determine whether the device supports volume control on both the left and
  2803. right channels, use the WAVECAPS_VOLUME flag to test the %dwSupport% field
  2804. of the %WAVEOUTCAPS% structure (filled by %waveOutGetDevCaps%).
  2805. .seealso
  2806. %waveOutSetVolume%
  2807. .refpage waveOutOpen
  2808. WORD %waveOutOpen%(<lphWaveOut>, <wDeviceID>, <lpFormat>, <dwCallback>,
  2809. <dwCallbackInstance>, <dwFlags>)
  2810. This function opens a specified waveform output device for playback.
  2811. .parameters
  2812. LPHWAVEOUT <lphWaveOut>
  2813. Specifies a far pointer to an HWAVEOUT handle. This location is filled
  2814. with a handle identifying the opened waveform output device. Use the
  2815. handle to identify the device when calling other waveform output
  2816. functions. This parameter may be NULL if the WAVE_FORMAT_QUERY flag is
  2817. specified for <dwFlags>.
  2818. WORD <wDeviceID>
  2819. Identifies the waveform output device to open. Use a valid device ID or
  2820. the following flag:
  2821. WAVE_MAPPER
  2822. If this flag is specified, the function selects a waveform output device
  2823. capable of playing the given format.
  2824. LPWAVEFORMAT <lpFormat>
  2825. Specifies a pointer to a %WAVEFORMAT% structure that identifies the
  2826. format of the waveform data to be sent to the waveform output device.
  2827. DWORD <dwCallback>
  2828. Specifies the address of a callback function or a handle to a window
  2829. called during waveform playback to process messages related to the
  2830. progress of the playback. Specify NULL for this parameter if no callback
  2831. is desired.
  2832. DWORD <dwCallbackInstance>
  2833. Specifies user instance data passed to the callback. This parameter is
  2834. not used with window callbacks.
  2835. DWORD <dwFlags>
  2836. Specifies flags for opening the device.
  2837. WAVE_FORMAT_QUERY
  2838. If this flag is specified, the device is be queried to determine if it
  2839. supports the given format but is not actually opened.
  2840. CALLBACK_WINDOW
  2841. If this flag is specified, <dwCallback> is assumed to be a window
  2842. handle.
  2843. CALLBACK_FUNCTION
  2844. If this flag is specified, <dwCallback> is assumed to be a callback
  2845. procedure address.
  2846. .returns
  2847. Returns zero if the function was successful. Otherwise, it returns an error
  2848. number. Possible error returns are:
  2849. .list Value Meaning
  2850. MMSYSERR_BADDEVICEID
  2851. Specified device ID is out of range.
  2852. MMSYSERR_ALLOCATED
  2853. Specified resource is already allocated.
  2854. MMSYSERR_NOMEM
  2855. Unable to allocate or lock memory.
  2856. WAVERR_BADFORMAT
  2857. Attempted to open with an unsupported wave format.
  2858. .endlist
  2859. .comments
  2860. Use %waveOutGetNumDevs% to determine the number of waveform output devices
  2861. present in the system. The device ID specified by <wDeviceID> varies from
  2862. zero to one less than the number of devices present.
  2863. The %WAVEFORMAT% structure pointed to by <lpFormat> may be extended to
  2864. include type-specific information for certain data formats. For example, for
  2865. PCM data, an extra WORD is added to specify the number of bits per sample.
  2866. Use the %PCMWAVEFORMAT% structure in this case.
  2867. If a window is chosen to receive callback information, the following
  2868. messages are sent to the window procedure function to indicate the progress
  2869. of waveform output: %MM_WOM_OPEN%, %MM_WOM_CLOSE%, %MM_WOM_DONE%
  2870. If a function is chosen to receive callback information, the following
  2871. messages are sent to the function to indicate the progress of waveform
  2872. output: %WOM_OPEN%, %WOM_CLOSE%, %WOM_DONE%. The callback function must
  2873. reside in a DLL. You do not have to use %MakeProcInstance% to get a
  2874. procedure-instance address for the callback function.
  2875. .head "Callback"
  2876. void FAR PASCAL %WaveOutFunc%(<hWaveOut>, <wMsg>, <dwInstance>, <dwParam1>,
  2877. <dwParam2>)
  2878. %WaveOutFunc% is a placeholder for the application-supplied function name.
  2879. The actual name must be exported by including it in an EXPORTS statement in
  2880. the DLL's module- definition file.
  2881. %Parameters%
  2882. HWAVEOUT <hWaveOut>
  2883. Specifies a handle to the waveform device associated with the callback.
  2884. WORD <wMsg>
  2885. Specifies a waveform output message.
  2886. DWORD <dwInstance>
  2887. Specifies the user instance data specified with %waveOutOpen%.
  2888. DWORD <dwParam1>
  2889. Specifies a parameter for the message.
  2890. DWORD <dwParam2>
  2891. Specifies a parameter for the message.
  2892. %Comments%
  2893. Because the callback is accessed at interrupt time, it must reside in a DLL
  2894. and its code segment must be specified as FIXED in the module-definition
  2895. file for the DLL. Any data that the callback accesses must be in a FIXED
  2896. data segment as well. The callback may not make any system calls except for
  2897. %PostMessage%, %timeGetSystemTime%, %timeGetTime%, %timeSetEvent%,
  2898. %timeKillEvent%, %midiOutShortMsg%, %midiOutLongMsg%, and %OutputDebugStr%.
  2899. .seealso
  2900. %waveOutClose%
  2901. .refpage waveOutPause
  2902. WORD %waveOutPause%(<hWaveOut>)
  2903. This function pauses playback on a specified waveform output device. The
  2904. current playback position is saved. Use %waveOutRestart% to resume playback
  2905. from the current playback position.
  2906. .parameters
  2907. HWAVEOUT <hWaveOut>
  2908. Specifies a handle to the waveform output device.
  2909. .returns
  2910. Returns zero if the function was successful. Otherwise, it returns an error
  2911. number. Possible error returns are:
  2912. .list Value Meaning
  2913. MMSYSERR_INVALHANDLE
  2914. Specified device handle is invalid.
  2915. .endlist
  2916. .comments
  2917. Calling this function when the output is already paused has no effect, and
  2918. the function returns zero.
  2919. .seealso
  2920. %waveOutRestart%, %waveOutBreakLoop%
  2921. .refpage waveOutPrepareHeader
  2922. WORD %waveOutPrepareHeader%(<hWaveOut>, <lpWaveOutHdr>, <wSize>)
  2923. This function prepares a waveform data block for playback.
  2924. .parameters
  2925. HWAVEOUT <hWaveOut>
  2926. Specifies a handle to the waveform output device.
  2927. LPWAVEHDR <lpWaveOutHdr>
  2928. Specifies a pointer to a %WAVEHDR% structure that identifies the data
  2929. block to be prepared.
  2930. WORD <wSize>
  2931. Specifies the size of the %WAVEHDR% structure.
  2932. .returns
  2933. Returns zero if the function was successful. Otherwise, it returns an error
  2934. number. Possible error returns are:
  2935. .list Value Meaning
  2936. MMSYSERR_INVALHANDLE
  2937. Specified device handle is invalid.
  2938. MMSYSERR_NOMEM
  2939. Unable to allocate or lock memory.
  2940. .endlist
  2941. .comments
  2942. The %WAVEHDR% data structure and the data block pointed to by its %lpData%
  2943. field must be allocated with %GlobalAlloc% using the GMEM_MOVEABLE and
  2944. GMEM_SHARE flags, and locked with %GlobalLock%. Preparing a header that has
  2945. already been prepared has no effect, and the function returns zero.
  2946. .seealso
  2947. %waveOutUnprepareHeader%
  2948. .refpage waveOutReset
  2949. WORD %waveOutReset%(<hWaveOut>)
  2950. This function stops playback on a given waveform output device and resets
  2951. the current position to 0. All pending playback buffers are marked as done
  2952. and returned to the application.
  2953. .parameters
  2954. HWAVEOUT <hWaveOut>
  2955. Specifies a handle to the waveform output device.
  2956. .returns
  2957. Returns zero if the function was successful. Otherwise, it returns an error
  2958. number. Possible error returns are:
  2959. .list Value Meaning
  2960. MMSYSERR_INVALHANDLE
  2961. Specified device handle is invalid.
  2962. .endlist
  2963. .seealso
  2964. %waveOutWrite%, %waveOutClose%
  2965. .refpage waveOutRestart
  2966. WORD %waveOutRestart%(<hWaveOut>)
  2967. This function restarts a paused waveform output device.
  2968. .parameters
  2969. HWAVEOUT <hWaveOut>
  2970. Specifies a handle to the waveform output device.
  2971. .returns
  2972. Returns zero if the function was successful. Otherwise, it returns an error
  2973. number. Possible error returns are:
  2974. .list Value Meaning
  2975. MMSYSERR_INVALHANDLE
  2976. Specified device handle is invalid.
  2977. .endlist
  2978. .comments
  2979. Calling this function when the output is not paused has no effect, and the
  2980. function returns zero.
  2981. .seealso
  2982. %waveOutPause%, %waveOutBreakLoop%
  2983. .refpage waveOutSetPitch
  2984. WORD %waveOutSetPitch%(<hWaveOut>, <dwPitch>)
  2985. This function sets the pitch of a waveform output device.
  2986. .parameters
  2987. HWAVEOUT <hWaveOut>
  2988. Specifies a handle to the waveform output device.
  2989. DWORD <dwPitch>
  2990. Specifies the new pitch multiplier setting. The pitch multiplier setting
  2991. indicates the current change in pitch from the original authored
  2992. setting. The pitch multiplier must be a positive value.
  2993. The pitch multiplier is specified as a fixed-point value. The high-order
  2994. word location contains the signed integer part of the number, and the
  2995. low-order word contains the fractional part. The fraction is expressed
  2996. as a WORD in which a value of 0x8000 represents one half, and 0x4000
  2997. represents one quarter. For example, the value 0x00010000 specifies a
  2998. multiplier of 1.0 (no pitch change), and a value of 0x000F8000 specifies
  2999. a multiplier of 15.5.
  3000. .returns
  3001. Returns zero if the function was successful. Otherwise, it returns an error
  3002. number. Possible error returns are:
  3003. .list Value Meaning
  3004. MMSYSERR_INVALHANDLE
  3005. Specified device handle is invalid.
  3006. MMSYSERR_NOTSUPPORTED
  3007. Function isn't supported.
  3008. .endlist
  3009. .comments
  3010. Changing the pitch does not change the playback rate or the sample rate. The
  3011. playback time is also unchanged. Not all devices support pitch changes. To
  3012. determine whether the device supports pitch control, use the WAVECAPS_PITCH
  3013. flag to test the %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  3014. %waveOutGetDevCaps%).
  3015. .seealso
  3016. %waveOutGetPitch%, %waveOutSetPlaybackRate%, %waveOutGetPlaybackRate%
  3017. .refpage waveOutSetPlaybackRate
  3018. WORD %waveOutSetPlaybackRate%(<hWaveOut>, <dwRate>)
  3019. This function sets the playback rate of a waveform output device.
  3020. .parameters
  3021. HWAVEOUT <hWaveOut>
  3022. Specifies a handle to the waveform output device.
  3023. DWORD <dwRate>
  3024. Specifies the new playback rate setting. The playback rate setting is a
  3025. multiplier indicating the current change in playback rate from the
  3026. original authored setting. The playback rate multiplier must be a
  3027. positive value.
  3028. The rate is specified as a fixed-point value. The high-order word
  3029. contains the signed integer part of the number, and the low-order word
  3030. contains the fractional part. The fraction is expressed as a WORD in
  3031. which a value of 0x8000 represents one half, and 0x4000 represents one
  3032. quarter. For example, the value 0x00010000 specifies a multiplier of 1.0
  3033. (no playback rate change), and a value of 0x000F8000 specifies a
  3034. multiplier of 15.5.
  3035. .returns
  3036. Returns zero if the function was successful. Otherwise, it returns an error
  3037. number. Possible error returns are:
  3038. .list Value Meaning
  3039. MMSYSERR_INVALHANDLE
  3040. Specified device handle is invalid.
  3041. MMSYSERR_NOTSUPPORTED
  3042. Function isn't supported.
  3043. .endlist
  3044. .comments
  3045. Changing the playback rate does not change the sample rate but does change
  3046. the playback time.
  3047. Not all devices support playback rate changes. To determine whether a device
  3048. supports playback rate changes, use the WAVECAPS_PLAYBACKRATE flag to test
  3049. the %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  3050. %waveOutGetDevCaps%).
  3051. .seealso
  3052. %waveOutGetPlaybackRate%, %waveOutSetPitch%, %waveOutGetPitch%
  3053. .refpage waveOutSetVolume
  3054. WORD %waveOutSetVolume%(<wDeviceID>, <dwVolume>)
  3055. This function sets the volume of a waveform output device.
  3056. .parameters
  3057. WORD <wDeviceID>
  3058. Identifies the waveform output device.
  3059. DWORD <dwVolume>
  3060. Specifies the new volume setting. The low-order word contains the left
  3061. channel volume setting, and the high-order word contains the right
  3062. channel setting. A value of 0xFFFF represents full volume, and a value
  3063. of 0x0000 is silence.
  3064. If a device does not support both left and right volume control, the
  3065. low-order word of <dwVolume> specifies the volume level, and the
  3066. high-order word is ignored.
  3067. .returns
  3068. Returns zero if the function was successful. Otherwise, it returns an error
  3069. number. Possible error returns are:
  3070. .list Value Meaning
  3071. MMSYSERR_INVALHANDLE
  3072. Specified device handle is invalid.
  3073. MMSYSERR_NOTSUPPORTED
  3074. Function isn't supported.
  3075. MMSYSERR_NODRIVER
  3076. The driver was not installed.
  3077. .endlist
  3078. .comments
  3079. Not all devices support volume changes. To determine whether the device
  3080. supports volume control, use the WAVECAPS_VOLUME flag to test the
  3081. %dwSupport% field of the %WAVEOUTCAPS% structure (filled by
  3082. %waveOutGetDevCaps%).
  3083. To determine whether the device supports volume control on both the left and
  3084. right channels, use the WAVECAPS_LRVOLUME flag flag to test the %dwSupport%
  3085. field of the %WAVEOUTCAPS% structure (filled by %waveOutGetDevCaps%).
  3086. Most devices don't support the full 16 bits of volume level control and will
  3087. not use the high-order bits of the requested volume setting. For example,
  3088. for a device that supports 4 bits of volume control, requested volume level
  3089. values of 0x4000, 0x4fff, and 0x43be all produce the same physical volume
  3090. setting, 0x4000. The %waveOutGetVolume% function returns the full 16-bit
  3091. setting set with %waveOutSetVolume%.
  3092. Volume settings are interpreted logarithmically. This means the perceived
  3093. increase in volume is the same when increasing the volume level from 0x5000
  3094. to 0x6000 as it is from 0x4000 to 0x5000.
  3095. .seealso
  3096. %waveOutGetVolume%
  3097. .refpage waveOutUnprepareHeader
  3098. WORD %waveOutUnprepareHeader%(<hWaveOut>, <lpWaveOutHdr>, <wSize>)
  3099. This function cleans up the preparation performed by %waveOutPrepareHeader%.
  3100. The function must be called after the device driver is finished with a data
  3101. block. You must call this function before freeing the data buffer.
  3102. .parameters
  3103. HWAVEOUT <hWaveOut>
  3104. Specifies a handle to the waveform output device.
  3105. LPWAVEHDR <lpWaveOutHdr>
  3106. Specifies a pointer to a %WAVEHDR% structure identifying the data block
  3107. to be cleaned up.
  3108. WORD <wSize>
  3109. Specifies the size of the %WAVEHDR% structure.
  3110. .returns
  3111. Returns zero if the function was successful. Otherwise, it returns an error
  3112. number. Possible error returns are:
  3113. .list Value Meaning
  3114. MMSYSERR_INVALHANDLE
  3115. Specified device handle is invalid.
  3116. WAVERR_STILLPLAYING
  3117. <lpWaveOutHdr> is still in the queue.
  3118. .endlist
  3119. .comments
  3120. This function is the complementary function to %waveOutPrepareHeader%. You
  3121. must call this function before freeing the data buffer with %GlobalFree%.
  3122. After passing a buffer to the device driver with %waveOutWrite%, you must
  3123. wait until the driver is finished with the buffer before calling
  3124. %waveOutUnprepareHeader%.
  3125. Unpreparing a buffer that has not been prepared has no effect, and the
  3126. function returns zero.
  3127. .seealso
  3128. %waveOutPrepareHeader%
  3129. .refpage waveOutWrite
  3130. WORD %waveOutWrite%(<hWaveOut>, <lpWaveOutHdr>, <wSize>)
  3131. This function sends a data block to the specified waveform output device.
  3132. .parameters
  3133. HWAVEOUT <hWaveOut>
  3134. Specifies a handle to the waveform output device.
  3135. LPWAVEHDR <lpWaveOutHdr>
  3136. Specifies a far pointer to a %WAVEHDR% structure containing information
  3137. about the data block.
  3138. WORD <wSize>
  3139. Specifies the size of the %WAVEHDR% structure.
  3140. .returns
  3141. Returns zero if the function was successful. Otherwise, it returns an error
  3142. number. Possible error returns are:
  3143. .list Value Meaning
  3144. MMSYSERR_INVALHANDLE
  3145. Specified device handle is invalid.
  3146. WAVERR_UNPREPARED
  3147. <lpWaveOutHdr> hasn't been prepared.
  3148. .endlist
  3149. .comments
  3150. The data buffer must be prepared with %waveOutPrepareHeader% before it is
  3151. passed to %waveOutWrite%. The %WAVEHDR% data structure and the data buffer
  3152. pointed to by its %lpData% field must be allocated with %GlobalAlloc% using
  3153. the GMEM_MOVEABLE and GMEM_SHARE flags, and locked with %GlobalLock%. Unless
  3154. the device is paused by calling %waveOutPause%, playback begins when the
  3155. first data block is sent to the device.
  3156. .seealso
  3157. %waveOutPrepareHeader%, %waveOutPause%, %waveOutReset%, %waveOutRestart%