Leaked source code of windows server 2003
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.

754 lines
30 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. ////
  23. // wav.h - interface for wav functions in wav.c
  24. ////
  25. #ifndef __WAV_H__
  26. #define __WAV_H__
  27. #ifdef _WIN32
  28. #define MULTITHREAD 1
  29. #endif
  30. #include "winlocal.h"
  31. #include "wavfmt.h"
  32. #include "wavout.h"
  33. #include "wavin.h"
  34. #define WAV_VERSION 0x00000108
  35. // <dwFlags> values in WavInit
  36. //
  37. #define WAV_TELTHUNK 0x00004000
  38. #define WAV_NOTSMTHUNK 0x00008000
  39. #define WAV_VOXADPCM 0x00000001
  40. // <dwFlags> values in WavOpen
  41. //
  42. #define WAV_READ 0x00000000
  43. #define WAV_WRITE 0x00000001
  44. #define WAV_READWRITE 0x00000002
  45. #define WAV_CREATE 0x00000004
  46. #define WAV_NORIFF 0x00000008
  47. #define WAV_MEMORY 0x00000010
  48. #define WAV_RESOURCE 0x00000020
  49. #define WAV_DENYNONE 0x00000040
  50. #define WAV_DENYREAD 0x00000080
  51. #define WAV_DENYWRITE 0x00000100
  52. #define WAV_EXCLUSIVE 0x00000200
  53. #define WAV_NOACM 0x00000400
  54. #define WAV_DELETE 0x00000800
  55. #define WAV_EXIST 0x00001000
  56. #define WAV_GETTEMP 0x00002000
  57. #define WAV_TELRFILE 0x00008000
  58. #ifdef MULTITHREAD
  59. #define WAV_MULTITHREAD 0x00010000
  60. #define WAV_SINGLETHREAD 0x00020000
  61. #define WAV_COINITIALIZE 0x00040000
  62. #endif
  63. // <dwFlags> values in WavPlay
  64. //
  65. #define WAV_PLAYASYNC 0x00000000
  66. #define WAV_PLAYSYNC 0x00001000
  67. #define WAV_AUTOSTOP 0x00002000
  68. #define WAV_NOAUTOSTOP 0x00004000
  69. #define WAV_AUTOCLOSE 0x00008000
  70. // <dwFlags> values in WavRecord
  71. //
  72. #define WAV_RECORDASYNC 0x00000000
  73. #define WAV_RECORDSYNC 0x00010000
  74. // <dwFlags> values in WavPlaySound
  75. //
  76. #define WAV_ASYNC 0x00000000
  77. #define WAV_SYNC 0x00100000
  78. #define WAV_FILENAME 0x00200000
  79. #define WAV_NODEFAULT 0x00400000
  80. #define WAV_LOOP 0x00800000
  81. #define WAV_NOSTOP 0x01000000
  82. #define WAV_OPENRETRY 0x10000000
  83. // control flags for WavSetSpeed and WavSupportsSpeed
  84. //
  85. #define WAVSPEED_NOPLAYBACKRATE 0x00000001
  86. #define WAVSPEED_NOFORMATADJUST 0x00000002
  87. #define WAVSPEED_NOTSM 0x00000004
  88. #define WAVSPEED_NOACM 0x00000400
  89. // return values from WavGetState
  90. //
  91. #define WAV_STOPPED 0x0001
  92. #define WAV_PLAYING 0x0002
  93. #define WAV_RECORDING 0x0004
  94. #define WAV_STOPPING 0x0008
  95. // <dwFlags> values in WavGetFormat and WavSetFormat
  96. //
  97. #define WAV_FORMATFILE 0x0001
  98. #define WAV_FORMATPLAY 0x0002
  99. #define WAV_FORMATRECORD 0x0004
  100. #define WAV_FORMATALL (WAV_FORMATFILE | WAV_FORMATPLAY | WAV_FORMATRECORD)
  101. // <dwFlags> values in WavSetVolume and WavSupportsVolume
  102. //
  103. #define WAVVOLUME_MIXER 0x0001
  104. #ifdef TELTHUNK
  105. // control flags for WavOpenEx
  106. //
  107. #define WOX_LOCAL 0x00000001
  108. #define WOX_REMOTE 0x00000002
  109. #define WOX_WAVFMT 0x00000010
  110. #define WOX_VOXFMT 0x00000020
  111. #define WOX_WAVDEV 0x00000100
  112. #define WOX_TELDEV 0x00000200
  113. #endif
  114. // handle returned from WavInit
  115. //
  116. DECLARE_HANDLE32(HWAVINIT);
  117. // handle returned from WavOpen // (NOT the same as Windows HWAVE)
  118. //
  119. DECLARE_HANDLE32(HWAV);
  120. // prototype for <lpfnUserAbort> in WavCopy
  121. //
  122. typedef BOOL (CALLBACK* USERABORTPROC)(DWORD dwUser, int nPctComplete);
  123. // prototype for <lpfnPlayStopped> in WavPlay
  124. //
  125. typedef BOOL (CALLBACK* PLAYSTOPPEDPROC)(HWAV hWav, HANDLE hUser, DWORD dwReserved);
  126. // prototype for <lpfnRecordStopped> in WavRecord
  127. //
  128. typedef BOOL (CALLBACK* RECORDSTOPPEDPROC)(HWAV hWav, DWORD dwUser, DWORD dwReserved);
  129. #ifdef __cplusplus
  130. extern "C" {
  131. #endif
  132. // WavInit - initialize wav engine
  133. // <dwVersion> (i) must be WAV_VERSION
  134. // <hInst> (i) instance handle of calling module
  135. // <dwFlags> (i) control flags
  136. #ifdef TELTHUNK
  137. // WAV_TELTHUNK initialize telephone thunking layer
  138. #endif
  139. // WAV_NOACM do not use audio compression manager
  140. // WAV_VOXADPCM load acm driver for Dialogic OKI ADPCM
  141. // return handle (NULL if error)
  142. //
  143. HWAVINIT WINAPI WavInit(DWORD dwVersion, HINSTANCE hInst, DWORD dwFlags);
  144. // WavTerm - shut down wav engine
  145. // <hWavInit> (i) handle returned from WavInit
  146. // return 0 if success
  147. //
  148. int WINAPI WavTerm(HWAVINIT hWavInit);
  149. // WavOpen - open or create wav file
  150. // <dwVersion> (i) must be WAV_VERSION
  151. // <hInst> (i) instance handle of calling module
  152. // <lpszFileName> (i) name of file to open or create
  153. // <lpwfx> (i) wave format
  154. // NULL use format from header or default
  155. // <lpIOProc> (i) address of i/o procedure to use
  156. // NULL use default i/o procedure
  157. // <lpadwInfo> (i) data to pass to i/o procedure during open
  158. // NULL no data to pass
  159. // <dwFlags> (i) control flags
  160. // WAV_READ open file for reading (default)
  161. // WAV_WRITE open file for writing
  162. // WAV_READWRITE open file for reading and writing
  163. // WAV_DENYNONE allow other programs read and write access
  164. // WAV_DENYREAD prevent other programs from read access
  165. // WAV_DENYWRITE prevent other programs from write access
  166. // WAV_EXCLUSIVE prevent other programs from read or write
  167. // WAV_CREATE create new file or truncate existing file
  168. // WAV_NORIFF file has no RIFF/WAV header
  169. // WAV_MEMORY <lpszFileName> points to memory block
  170. // WAV_RESOURCE <lpszFileName> points to wave resource
  171. // WAV_NOACM do not use audio compression manager
  172. // WAV_DELETE delete specified file, return TRUE if success
  173. // WAV_EXIST return TRUE if specified file exists
  174. // WAV_GETTEMP fill lpszFileName with temp name, return TRUE
  175. // WAV_TELRFILE telephone will play audio from file on server
  176. #ifdef MULTITHREAD
  177. // WAV_MULTITHREAD support multiple threads (default)
  178. // WAV_SINGLETHREAD do not support multiple threads
  179. // WAV_COINITIALIZE call CoInitialize in all secondary threads
  180. #endif
  181. // return handle (NULL if error)
  182. //
  183. // NOTE: if WAV_CREATE or WAV_NORIFF are used in <dwFlags>, then the
  184. // <lpwfx> parameter must be specified. If <lpwfx> is NULL, the
  185. // current default format is assumed.
  186. // WavSetFormat() can be used to set or override the defaults.
  187. //
  188. // NOTE: if WAV_RESOURCE is specified in <dwFlags>, then <lpszFileName>
  189. // must point to a WAVE resource in the module specified by <hInst>.
  190. // If the first character of the string is a pound sign (#), the remaining
  191. // characters represent a decimal number that specifies the resource id.
  192. //
  193. // NOTE: if WAV_MEMORY is specified in <dwFlags>, then <lpszFileName>
  194. // must be a pointer to a memory block obtained by calling MemAlloc().
  195. //
  196. // NOTE: if <lpIOProc> is not NULL, this i/o procedure will be called
  197. // for opening, closing, reading, writing, and seeking the wav file.
  198. // If <lpadwInfo> is not NULL, this array of three (3) DWORDs will be
  199. // passed to the i/o procedure when the wav file is opened.
  200. // See the Windows mmioOpen() and mmioInstallIOProc() function for details
  201. // on these parameters. Also, the WAV_MEMORY and WAV_RESOURCE flags may
  202. // only be used when <lpIOProc> is NULL.
  203. //
  204. HWAV WINAPI WavOpen(DWORD dwVersion, HINSTANCE hInst,
  205. LPCTSTR lpszFileName, LPWAVEFORMATEX lpwfx,
  206. LPMMIOPROC lpIOProc, DWORD FAR *lpadwInfo, DWORD dwFlags);
  207. // WavClose - close wav file
  208. // <hWav> (i) handle returned from WavOpen
  209. // return 0 if success
  210. //
  211. int WINAPI WavClose(HWAV hWav);
  212. // WavPlayEx - play data from wav file
  213. // <hWav> (i) handle returned from WavOpen
  214. // <idDev> (i) wav output device id
  215. // -1 use any suitable output device
  216. // <lpfnPlayStopped> (i) function to call when play is stopped
  217. // NULL do not notify
  218. // <hUserPlayStopped> (i) param to pass to lpfnPlayStopped
  219. // <dwReserved> (i) reserved; must be zero
  220. // <dwFlags> (i) control flags
  221. // WAV_PLAYASYNC return when playback starts (default)
  222. // WAV_PLAYSYNC return after playback completes
  223. // WAV_NOSTOP if device already playing, don't stop it
  224. // WAV_AUTOSTOP stop playback when eof reached (default)
  225. // WAV_NOAUTOSTOP continue playback until WavStop called
  226. // WAV_AUTOCLOSE close wav file after playback stops
  227. // WAV_OPENRETRY if output device busy, retry for up to 2 sec
  228. // return 0 if success
  229. //
  230. // NOTE: data from the wav file is sent to the output device in chunks.
  231. // Chunks are submitted to an output device queue, so that when one
  232. // chunk is finished playing, another is ready to start playing. By
  233. // default, each chunk is large enough to hold approximately 666 ms
  234. // of sound, and 3 chunks are maintained in the output device queue.
  235. // WavSetChunks() can be used to override the defaults.
  236. //
  237. // NOTE: if WAV_NOSTOP is specified in <dwFlags>, and the device specified
  238. // by <idDev> is already in use, this function returns without playing.
  239. // Unless this flag is specified, the specified device will be stopped
  240. // so that the new sound can be played.
  241. //
  242. // NOTE: if WAV_AUTOSTOP is specified in <dwFlags>, WavStop() will be
  243. // called automatically when end of file is reached. This is the
  244. // default behavior, but can be overridden by using the WAV_NOAUTOSTOP
  245. // flag. WAV_NOAUTOSTOP is useful if you are playing a file that
  246. // is growing dynamically as another program writes to it. If this is
  247. // the case, also use the WAV_DENYNONE flag when calling WavOpen().
  248. //
  249. // NOTE: if WAV_AUTOCLOSE is specified in <dwFlags>, WavClose() will
  250. // be called automatically when playback completes. This will happen
  251. // when WavStop() is called explicitly, or when WavPlay() reaches end
  252. // of file and WAV_NOAUTOSTOP was not specified. WAV_AUTOCLOSE is useful
  253. // when used with WAV_PLAYASYNC, since cleanup occurs automatically.
  254. // The <hWav> handle is thereafter invalid, and should not be used again.
  255. //
  256. int WINAPI WavPlay(HWAV hWav, int idDev, DWORD dwFlags);
  257. int DLLEXPORT WINAPI WavPlayEx(HWAV hWav, int idDev,
  258. PLAYSTOPPEDPROC lpfnPlayStopped, HANDLE hUserPlayStopped,
  259. DWORD dwReserved, DWORD dwFlags);
  260. // WavRecordEx - record data to wav file
  261. // <hWav> (i) handle returned from WavOpen
  262. // <idDev> (i) wav input device id
  263. // -1 use any suitable input device
  264. // <lpfnRecordStopped> (i) function to call when record is stopped
  265. // NULL do not notify
  266. // <dwUserRecordStopped> (i) param to pass to lpfnRecordStopped
  267. // <msMaxSize> (i) stop recording if file reaches this size
  268. // 0 no maximum size
  269. // <dwFlags> (i) control flags
  270. // WAV_RECORDASYNC return when recording starts (default)
  271. // WAV_RECORDSYNC return after recording completes
  272. // WAV_NOSTOP if device already recording, don't stop it
  273. // WAV_OPENRETRY if input device busy, retry for up to 2 sec
  274. // return 0 if success
  275. //
  276. // NOTE: data from the input device is written to the wav file in chunks.
  277. // Chunks are submitted to an input device queue, so that when one
  278. // chunk is finished recording, another is ready to start recording.
  279. // By default, each chunk is large enough to hold approximately 666 ms
  280. // of sound, and 3 chunks are maintained in the input device queue.
  281. // WavSetChunks() can be used to override the defaults.
  282. //
  283. // NOTE: if WAV_NOSTOP is specified in <dwFlags>, and the device specified
  284. // by <idDev> is already in use, this function returns without recording.
  285. // Unless this flag is specified, the specified device will be stopped
  286. // so that the new sound can be recorded.
  287. //
  288. int WINAPI WavRecord(HWAV hWav, int idDev, DWORD dwFlags);
  289. int DLLEXPORT WINAPI WavRecordEx(HWAV hWav, int idDev,
  290. RECORDSTOPPEDPROC lpfnRecordStopped, DWORD dwUserRecordStopped,
  291. long msMaxSize, DWORD dwFlags);
  292. // WavStop - stop playing and/or recording
  293. // <hWav> (i) handle returned from WavOpen
  294. // return 0 if success
  295. //
  296. int WINAPI WavStop(HWAV hWav);
  297. // WavRead - read data from wav file
  298. // <hWav> (i) handle returned from WavOpen
  299. // <hpBuf> (o) buffer to contain bytes read
  300. // <sizBuf> (i) size of buffer in bytes
  301. // return bytes read (-1 if error)
  302. //
  303. // NOTE : Even if the read operation does not reach the end of file,
  304. // the number of bytes returned could be less than <sizBuf> if data
  305. // decompression is performed by the wav file's I/O procedure. See the
  306. // <lpIOProc> parameter in WavOpen. It is safest to keep calling
  307. // WavRead() until 0 bytes are read.
  308. //
  309. long DLLEXPORT WINAPI WavRead(HWAV hWav, void _huge *hpBuf, long sizBuf);
  310. // WavWrite - write data to wav file
  311. // <hWav> (i) handle returned from WavOpen
  312. // <hpBuf> (i) buffer containing bytes to write
  313. // <sizBuf> (i) size of buffer in bytes
  314. // return bytes written (-1 if error)
  315. //
  316. // NOTE : Even if the write operation successfully completes,
  317. // the number of bytes returned could be less than <sizBuf> if data
  318. // compression is performed by the wav file's I/O procedure. See the
  319. // <lpIOProc> parameter in WavOpen. It is safest to assume no error
  320. // in WavWrite() occurred if the return value is greater than 0.
  321. //
  322. long DLLEXPORT WINAPI WavWrite(HWAV hWav, void _huge *hpBuf, long sizBuf);
  323. // WavSeek - seek within wav file data
  324. // <hWav> (i) handle returned from WavOpen
  325. // <lOffset> (i) bytes to move pointer
  326. // <nOrigin> (i) position to move from
  327. // 0 move pointer relative to start of data chunk
  328. // 1 move pointer relative to current position
  329. // 2 move pointer relative to end of data chunk
  330. // return new file position (-1 if error)
  331. //
  332. long DLLEXPORT WINAPI WavSeek(HWAV hWav, long lOffset, int nOrigin);
  333. // WavGetState - return current wav state
  334. // <hWav> (i) handle returned from WavOpen
  335. // return WAV_STOPPED, WAV_PLAYING, WAV_RECORDING, or 0 if error
  336. //
  337. WORD DLLEXPORT WINAPI WavGetState(HWAV hWav);
  338. // WavGetLength - get current wav data length in milleseconds
  339. // <hWav> (i) handle returned from WavOpen
  340. // return milleseconds if success, otherwise -1
  341. //
  342. long DLLEXPORT WINAPI WavGetLength(HWAV hWav);
  343. // WavSetLength - set current wav data length in milleseconds
  344. // <hWav> (i) handle returned from WavOpen
  345. // <msLength> (i) length in milleseconds
  346. // return new length in milleseconds if success, otherwise -1
  347. //
  348. // NOTE: afterwards, the current wav data position is set to either
  349. // the previous wav data position or <msLength>, whichever is smaller.
  350. //
  351. long DLLEXPORT WINAPI WavSetLength(HWAV hWav, long msLength);
  352. // WavGetPosition - get current wav data position in milleseconds
  353. // <hWav> (i) handle returned from WavOpen
  354. // return milleseconds if success, otherwise -1
  355. //
  356. long DLLEXPORT WINAPI WavGetPosition(HWAV hWav);
  357. // WavSetPosition - set current wav data position in milleseconds
  358. // <hWav> (i) handle returned from WavOpen
  359. // <msPosition> (i) position in milleseconds
  360. // return new position in milleseconds if success, otherwise -1
  361. //
  362. long DLLEXPORT WINAPI WavSetPosition(HWAV hWav, long msPosition);
  363. // WavGetFormat - get wav format
  364. // <hWav> (i) handle returned from WavOpen
  365. // <dwFlags> (i) control flags
  366. // WAV_FORMATFILE get format of data in file
  367. // WAV_FORMATPLAY get format of output device
  368. // WAV_FORMATRECORD get format of input device
  369. // return pointer to specified format, NULL if error
  370. //
  371. // NOTE: the format structure returned is dynamically allocated.
  372. // Use WavFormatFree() to free the buffer.
  373. //
  374. LPWAVEFORMATEX DLLEXPORT WINAPI WavGetFormat(HWAV hWav, DWORD dwFlags);
  375. // WavSetFormat - set wav format
  376. // <hWav> (i) handle returned from WavOpen
  377. // <lpwfx> (i) wav format
  378. // <dwFlags> (i) control flags
  379. // WAV_FORMATFILE set format of data in file
  380. // WAV_FORMATPLAY set format of output device
  381. // WAV_FORMATRECORD set format of input device
  382. // WAV_FORMATALL set all formats
  383. // return 0 if success
  384. //
  385. int DLLEXPORT WINAPI WavSetFormat(HWAV hWav,
  386. LPWAVEFORMATEX lpwfx, DWORD dwFlags);
  387. // WavChooseFormat - choose and set audio format from dialog box
  388. // <hWav> (i) handle returned from WavOpen
  389. // <hwndOwner> (i) owner of dialog box
  390. // NULL no owner
  391. // <lpszTitle> (i) title of the dialog box
  392. // NULL use default title ("Sound Selection")
  393. // <dwFlags> (i) control flags
  394. // WAV_FORMATFILE set format of data in file
  395. // WAV_FORMATPLAY set format of output device
  396. // WAV_FORMATRECORD set format of input device
  397. // WAV_FORMATALL set all formats
  398. // return 0 if success
  399. //
  400. int DLLEXPORT WINAPI WavChooseFormat(HWAV hWav, HWND hwndOwner, LPCTSTR lpszTitle, DWORD dwFlags);
  401. // WavGetVolume - get current volume level
  402. // <hWav> (i) handle returned from WavOpen
  403. // <idDev> (i) wav output device id
  404. // -1 use any suitable output device
  405. // <dwFlags> (i) reserved; must be zero
  406. // return volume level (0 minimum through 100 maximum, -1 if error)
  407. //
  408. int DLLEXPORT WINAPI WavGetVolume(HWAV hWav, int idDev, DWORD dwFlags);
  409. // WavSetVolume - set current volume level
  410. // <hWav> (i) handle returned from WavOpen
  411. // <idDev> (i) wav output device id
  412. // -1 use any suitable output device
  413. // <nLevel> (i) volume level
  414. // 0 minimum volume
  415. // 100 maximum volume
  416. // <dwFlags> (i) control flags
  417. // WAVVOLUME_MIXER set volume through mixer device
  418. // return 0 if success
  419. //
  420. int DLLEXPORT WINAPI WavSetVolume(HWAV hWav, int idDev, int nLevel, DWORD dwFlags);
  421. // WavSupportsVolume - check if audio can be played at specified volume
  422. // <hWav> (i) handle returned from WavOpen
  423. // <idDev> (i) wav output device id
  424. // -1 any suitable output device
  425. // <nLevel> (i) volume level
  426. // 0 minimum volume
  427. // 100 maximum volume
  428. // <dwFlags> (i) control flags
  429. // WAVVOLUME_MIXER check volume support through mixer device
  430. // return TRUE if supported
  431. //
  432. BOOL DLLEXPORT WINAPI WavSupportsVolume(HWAV hWav, int idDev, int nLevel, DWORD dwFlags);
  433. // WavGetSpeed - get current speed level
  434. // <hWav> (i) handle returned from WavOpen
  435. // <idDev> (i) wav output device id
  436. // -1 use any suitable output device
  437. // <dwFlags> (i) reserved; must be zero
  438. // return speed level (100 is normal, 50 is half, 200 is double, -1 if error)
  439. //
  440. int DLLEXPORT WINAPI WavGetSpeed(HWAV hWav, int idDev, DWORD dwFlags);
  441. // WavSetSpeed - set current speed level
  442. // <hWav> (i) handle returned from WavOpen
  443. // <idDev> (i) wav output device id
  444. // -1 use any suitable output device
  445. // <nLevel> (i) speed level
  446. // 50 half speed
  447. // 100 normal speed
  448. // 200 double speed, etc.
  449. // <dwFlags> (i) control flags
  450. #ifdef AVTSM
  451. // WAVSPEED_NOTSM do not use time scale modification engine
  452. #endif
  453. // WAVSPEED_NOPLAYBACKRATE do not use device driver playback rate
  454. // WAVSPEED_NOFORMATADJUST do not use adjusted format to open device
  455. // WAVSPEED_NOACM do not use audio compression manager
  456. // return 0 if success
  457. //
  458. // NOTE: In order to accomodate the specified speed change, it is _possible_
  459. // that this function will in turn call WavSetFormat(hWav, ..., WAV_FORMATPLAY)
  460. // to change the playback format of the specified file. You can prevent this
  461. // side-effect by specifying the WAVSPEED_NOACM flag, but this reduces the
  462. // likelihood that WavSetSpeed will succeed.
  463. //
  464. int DLLEXPORT WINAPI WavSetSpeed(HWAV hWav, int idDev, int nLevel, DWORD dwFlags);
  465. // WavSupportsSpeed - check if audio can be played at specified speed
  466. // <hWav> (i) handle returned from WavOpen
  467. // <idDev> (i) wav output device id
  468. // -1 any suitable output device
  469. // <nLevel> (i) speed level
  470. // 50 half speed
  471. // 100 normal speed
  472. // 200 double speed, etc.
  473. // <dwFlags> (i) control flags
  474. #ifdef AVTSM
  475. // WAVSPEED_NOTSM do not use time scale modification engine
  476. #endif
  477. // WAVSPEED_NOPLAYBACKRATE do not use device driver playback rate
  478. // WAVSPEED_NOFORMATADJUST do not use adjusted format to open device
  479. // WAVSPEED_NOACM do not use audio compression manager
  480. // return TRUE if supported
  481. //
  482. BOOL DLLEXPORT WINAPI WavSupportsSpeed(HWAV hWav, int idDev, int nLevel, DWORD dwFlags);
  483. // WavGetChunks - get chunk count and size
  484. // <hWav> (i) handle returned from WavOpen
  485. // NULL get default chunk count and size
  486. // <lpcChunks> (o) buffer to hold chunk count
  487. // NULL do not get chunk count
  488. // <lpmsChunkSize> (o) buffer to hold chunk size
  489. // NULL do not get chunk size
  490. // <fWavOut> (i) TRUE for playback, FALSE for recording
  491. // return 0 if success
  492. //
  493. int DLLEXPORT WINAPI WavGetChunks(HWAV hWav,
  494. int FAR *lpcChunks, long FAR *lpmsChunkSize, BOOL fWavOut);
  495. // WavSetChunks - set chunk count and size
  496. // <hWav> (i) handle returned from WavOpen
  497. // NULL set default chunk count and size
  498. // <cChunks> (i) number of chunks in device queue
  499. // -1 do not set chunk count
  500. // <msChunkSize> (i) chunk size in milleseconds
  501. // -1 do not set chunk size
  502. // <fWavOut> (i) TRUE for playback, FALSE for recording
  503. // return 0 if success
  504. //
  505. int DLLEXPORT WINAPI WavSetChunks(HWAV hWav, int cChunks, long msChunkSize, BOOL fWavOut);
  506. // WavCalcChunkSize - calculate chunk size in bytes
  507. // <lpwfx> (i) wav format
  508. // <msPlayChunkSize> (i) chunk size in milleseconds
  509. // -1 default chunk size
  510. // <fWavOut> (i) TRUE for playback, FALSE for recording
  511. // return chunk size in bytes (-1 if success)
  512. //
  513. long DLLEXPORT WINAPI WavCalcChunkSize(LPWAVEFORMATEX lpwfx,
  514. long msChunkSize, BOOL fWavOut);
  515. // WavCopy - copy data from one open wav file to another
  516. // <hWavSrc> (i) source handle returned from WavOpen
  517. // <hWavDst> (i) destination handle returned from WavOpen
  518. // <hpBuf> (o) pointer to copy buffer
  519. // NULL allocate buffer internally
  520. // <sizBuf> (i) size of copy buffer
  521. // -1 default buffer size (16K)
  522. // <lpfnUserAbort> (i) function that returns TRUE if user aborts
  523. // NULL don't check for user abort
  524. // <dwUser> (i) parameter passed to <lpfnUserAbort>
  525. // <dwFlags> (i) control flags
  526. // WAV_NOACM do not use audio compression manager
  527. // return 0 if success (-1 if error, +1 if user abort)
  528. //
  529. int DLLEXPORT WINAPI WavCopy(HWAV hWavSrc, HWAV hWavDst,
  530. void _huge *hpBuf, long sizBuf, USERABORTPROC lpfnUserAbort, DWORD dwUser, DWORD dwFlags);
  531. #ifdef AVTSM
  532. // WavReadFormatSpeed - read data from wav file, then format it for speed
  533. // <hWav> (i) handle returned from WavOpen
  534. // <hpBufSpeed> (o) buffer to contain bytes read
  535. // <sizBufSpeed> (i) size of buffer in bytes
  536. // return bytes formatted for speed in <hpBuf> (-1 if error)
  537. //
  538. // NOTE: this function reads a block of data, and then converts it
  539. // from the file format to the speed format, unless those formats
  540. // are identical.
  541. //
  542. long DLLEXPORT WINAPI WavReadFormatSpeed(HWAV hWav, void _huge *hpBufSpeed, long sizBufSpeed);
  543. #endif
  544. // WavReadFormatPlay - read data from wav file, then format it for playback
  545. // <hWav> (i) handle returned from WavOpen
  546. // <hpBufPlay> (o) buffer to contain bytes read
  547. // <sizBufPlay> (i) size of buffer in bytes
  548. // return bytes formatted for playback in <hpBuf> (-1 if error)
  549. //
  550. // NOTE: this function reads a block of data, and then converts it
  551. // from the file format to the playback format, unless those formats
  552. // are identical.
  553. //
  554. long DLLEXPORT WINAPI WavReadFormatPlay(HWAV hWav, void _huge *hpBufPlay, long sizBufPlay);
  555. // WavWriteFormatRecord - write data to file after formatting it for file
  556. // <hWav> (i) handle returned from WavOpen
  557. // <hpBufRecord> (i) buffer containing bytes in record format
  558. // <sizBufRecord> (i) size of buffer in bytes
  559. // return bytes written (-1 if error)
  560. //
  561. // NOTE: this function converts a block of data from the record
  562. // format to the file format (unless those formats are identical),
  563. // and then writes the data to disk.
  564. //
  565. long DLLEXPORT WINAPI WavWriteFormatRecord(HWAV hWav, void _huge *hpBufRecord, long sizBufRecord);
  566. // WavGetOutputDevice - get handle to open wav output device
  567. // <hWav> (i) handle returned from WavOpen
  568. // return handle to wav output device (NULL if device not open or error)
  569. //
  570. // NOTE: this function is useful only during playback (after calling
  571. // WavPlay() and before calling WavStop()). The returned device handle
  572. // can then be used when calling the WavOut functions in wavout.h
  573. //
  574. HWAVOUT DLLEXPORT WINAPI WavGetOutputDevice(HWAV hWav);
  575. // WavGetInputDevice - get handle to open wav input device
  576. // <hWav> (i) handle returned from WavOpen
  577. // return handle to wav input device (NULL if device not open or error)
  578. //
  579. // NOTE: this function is useful only during recording (after calling
  580. // WavRecord() and before calling WavStop()). The returned device handle
  581. // can then be used when calling the WavIn functions in wavin.h
  582. //
  583. HWAVIN DLLEXPORT WINAPI WavGetInputDevice(HWAV hWav);
  584. // WavPlaySound - play wav file
  585. // <dwVersion> (i) must be WAV_VERSION
  586. // <hInst> (i) instance handle of calling module
  587. // <idDev> (i) wav output device id
  588. // -1 use any suitable output device
  589. // <lpszFileName> (i) name of file to play
  590. // NULL stop playing current sound, if any
  591. // <lpwfx> (i) wave format
  592. // NULL use format from header or default
  593. // <lpIOProc> (i) address of i/o procedure to use
  594. // NULL use default i/o procedure
  595. // <lpadwInfo> (i) data to pass to i/o procedure during open
  596. // NULL no data to pass
  597. // <dwFlags> (i) control flags
  598. // WAV_ASYNC return when playback starts (default)
  599. // WAV_SYNC return after playback completes
  600. // WAV_FILENAME <lpszFileName> points to a filename
  601. // WAV_RESOURCE <lpszFileName> points to a resource
  602. // WAV_MEMORY <lpszFileName> points to memory block
  603. // WAV_NODEFAULT if sound not found, do not play default
  604. // WAV_LOOP loop sound until WavPlaySound called again
  605. // WAV_NOSTOP if device already playing, don't stop it
  606. // WAV_NORIFF file has no RIFF/WAV header
  607. // WAV_NOACM do not use audio compression manager
  608. // WAV_OPENRETRY if output device busy, retry for up to 2 sec
  609. #ifdef MULTITHREAD
  610. // WAV_MULTITHREAD support multiple threads (default)
  611. // WAV_SINGLETHREAD do not support multiple threads
  612. // WAV_COINITIALIZE call CoInitialize in all secondary threads
  613. #endif
  614. // return 0 if success
  615. //
  616. // NOTE: if WAV_NORIFF is specified in <dwFlags>, then the
  617. // <lpwfx> parameter must be specified. If <lpwfx> is NULL, the
  618. // current default format is assumed.
  619. // WavSetFormat() can be used to set or override the defaults.
  620. //
  621. // NOTE: if WAV_FILENAME is specified in <dwFlags>, then <lpszFileName>
  622. // must point to a file name.
  623. //
  624. // NOTE: if WAV_RESOURCE is specified in <dwFlags>, then <lpszFileName>
  625. // must point to a WAVE resource in the module specified by <hInst>.
  626. // If the first character of the string is a pound sign (#), the remaining
  627. // characters represent a decimal number that specifies the resource id.
  628. //
  629. // NOTE: if WAV_MEMORY is specified in <dwFlags>, then <lpszFileName>
  630. // must be a pointer to a memory block containing a wav file image.
  631. // The pointer must be obtained by calling MemAlloc().
  632. //
  633. // NOTE: if neither WAV_FILENAME, WAV_RESOURCE, or WAV_MEMORY is specified
  634. // in <dwFlags>, the [sounds] section of win.ini or the registry is
  635. // searched for an entry matching <lpszFileName>. If no matching entry
  636. // is found, <lpszFileName> is assumed to be a file name.
  637. //
  638. // NOTE: if WAV_NODEFAULT is specified in <dwFlags>, no default sound
  639. // will be played. Unless this flag is specified, the default system
  640. // event sound entry will be played if the sound specified in
  641. // <lpszFileName> is not found.
  642. //
  643. // NOTE: if WAV_LOOP is specified in <dwFlags>, the sound specified in
  644. // <lpszFileName> will be played repeatedly, until WavPlaySound() is
  645. // called again. The WAV_ASYNC flag must be specified when using this flag.
  646. //
  647. // NOTE: if WAV_NOSTOP is specified in <dwFlags>, and the device specified
  648. // by <idDev> is already in use, this function returns without playing.
  649. // Unless this flag is specified, the specified device will be stopped
  650. // so that the new sound can be played.
  651. //
  652. // NOTE: if <lpIOProc> is not NULL, this i/o procedure will be called
  653. // for opening, closing, reading, writing, and seeking the wav file.
  654. // If <lpadwInfo> is not NULL, this array of three (3) DWORDs will be
  655. // passed to the i/o procedure when the wav file is opened.
  656. // See the Windows mmioOpen() and mmioInstallIOProc() function for details
  657. // on these parameters. Also, the WAV_MEMORY and WAV_RESOURCE flags may
  658. // only be used when <lpIOProc> is NULL.
  659. //
  660. int DLLEXPORT WINAPI WavPlaySound(DWORD dwVersion, HINSTANCE hInst,
  661. int idDev, LPCTSTR lpszFileName, LPWAVEFORMATEX lpwfx,
  662. LPMMIOPROC lpIOProc, DWORD FAR *lpadwInfo, DWORD dwFlags);
  663. // WavSendMessage - send a user-defined message to the i/o procedure
  664. // <hWav> (i) handle returned from WavOpen
  665. // <wMsg> (i) user-defined message id
  666. // <lParam1> (i) parameter for the message
  667. // <lParam2> (i) parameter for the message
  668. // return value from the i/o procedure (0 if error or unrecognized message)
  669. //
  670. LRESULT DLLEXPORT WINAPI WavSendMessage(HWAV hWav,
  671. UINT wMsg, LPARAM lParam1, LPARAM lParam2);
  672. #ifdef TELTHUNK
  673. // WavOpenEx - open an audio file, extra special version
  674. // <dwVersion> (i) must be WAV_VERSION
  675. // <hInst> (i) instance handle of calling module
  676. // <lpszFileName> (i) name of file to open
  677. // <dwReserved> (i) reserved; must be zero
  678. // <dwFlagsOpen> (i) control flags to pass to WavOpen
  679. // <dwFlagsEx> (i) control flags
  680. // WOX_LOCAL file is on local client
  681. // WOX_REMOTE file is on remote server
  682. // WOX_WAVFMT file is in Microsoft RIFF/WAV format
  683. // WOX_VOXFMT file is in Dialogic OKI ADPCM (vox) format
  684. // WOX_WAVDEV file will be played on wav output device
  685. // WOX_TELDEV file will be played on telephone device
  686. // return handle (NULL if error)
  687. //
  688. HWAV DLLEXPORT WINAPI WavOpenEx(DWORD dwVersion, HINSTANCE hInst,
  689. LPTSTR lpszFileName, DWORD dwReserved, DWORD dwFlagsOpen, DWORD dwFlagsEx);
  690. #endif
  691. #ifdef __cplusplus
  692. }
  693. #endif
  694. #endif // __WAV_H__