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.

345 lines
12 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. // wavout.h - interface for wav output device functions in wavout.c
  24. ////
  25. #ifndef __WAVOUT_H__
  26. #define __WAVOUT_H__
  27. #ifdef _WIN32
  28. #define MULTITHREAD 1
  29. #endif
  30. #include "winlocal.h"
  31. #include "wavfmt.h"
  32. #define WAVOUT_VERSION 0x00000108
  33. // handle to wav output device (NOT the same as Windows HWAVEOUT)
  34. //
  35. DECLARE_HANDLE32(HWAVOUT);
  36. // <dwFlags> values in WavOutOpen
  37. //
  38. #define WAVOUT_NOSYNC 0x00000001
  39. #define WAVOUT_AUTOFREE 0x00000002
  40. #define WAVOUT_OPENRETRY 0x00000004
  41. #define WAVOUT_OPENASYNC 0x00000008
  42. #define WAVOUT_CLOSEASYNC 0x00000010
  43. #define WAVOUT_NOACM 0x00000020
  44. #define WAVOUT_TELRFILE 0x00000040
  45. #ifdef MULTITHREAD
  46. #define WAVOUT_MULTITHREAD 0x00000080
  47. #endif
  48. // notification messages sent to <hwndNotify>
  49. //
  50. #define WM_WAVOUT_OPEN (WM_USER + 100)
  51. #define WM_WAVOUT_CLOSE (WM_USER + 101)
  52. #define WM_WAVOUT_PLAYDONE (WM_USER + 102)
  53. #define WM_WAVOUT_STOPPLAY (WM_USER + 103)
  54. // structure passed as <lParam> in WM_WAVOUT_PLAYDONE message
  55. //
  56. typedef struct PLAYDONE
  57. {
  58. LPVOID lpBuf;
  59. long sizBuf;
  60. } PLAYDONE, FAR *LPPLAYDONE;
  61. // return values from WavOutGetState
  62. //
  63. #define WAVOUT_STOPPED 0x0001
  64. #define WAVOUT_PLAYING 0x0002
  65. #define WAVOUT_PAUSED 0x0004
  66. #define WAVOUT_STOPPING 0x0008
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70. // WavOutGetDeviceCount - return number of wav output devices found
  71. // <void> this function takes no arguments
  72. // return number of wav output devices found (0 if none)
  73. //
  74. int DLLEXPORT WINAPI WavOutGetDeviceCount(void);
  75. // WavOutDeviceIsOpen - check if output device is open
  76. // <idDev> (i) device id
  77. // -1 open any suitable output device
  78. // return TRUE if open
  79. //
  80. BOOL DLLEXPORT WINAPI WavOutDeviceIsOpen(int idDev);
  81. // WavOutOpen - open wav output device
  82. // <dwVersion> (i) must be WAVOUT_VERSION
  83. // <hInst> (i) instance handle of calling module
  84. // <idDev> (i) device id
  85. // -1 open any suitable output device
  86. // <lpwfx> (i) wave format
  87. // <hwndNotify> (i) notify this window of device events
  88. // NULL do not notify
  89. // <msTimeoutOpen> (i) device open timeout in milleseconds
  90. // 0 default timeout (30000)
  91. // <msTimeoutRetry> (i) device retry timeout in milleseconds
  92. // 0 default timeout (2000)
  93. // <dwFlags> (i) control flags
  94. // WAVOUT_NOSYNC do not open synchronous devices
  95. // WAVOUT_AUTOFREE free each buffer after playback
  96. // WAVOUT_OPENRETRY retry if device busy
  97. // WAVOUT_OPENASYNC return before notification of device open
  98. // WAVOUT_CLOSEASYNC return before notification of device close
  99. // WAVOUT_NOACM do not use audio compression manager
  100. // WAVOUT_TELRFILE telephone will play/record audio on server
  101. #ifdef MULTITHREAD
  102. // WAVOUT_MULTITHREAD use callback thread rather than window
  103. #endif
  104. // return handle (NULL if error)
  105. //
  106. // NOTE: if <hwndNotify> is specified in WavOutOpen,
  107. // WM_WAVOUT_OPEN will be sent to <hwndNotify>,
  108. // when output device has been opened.
  109. //
  110. // NOTE: if WAVOUT_MULTITHREAD is specified in <dwFlags>,
  111. // it is assumed that <hwndNotify> is not a window handle,
  112. // but rather the id of the thread to receive notifications
  113. //
  114. HWAVOUT DLLEXPORT WINAPI WavOutOpen(DWORD dwVersion, HINSTANCE hInst,
  115. int idDev, LPWAVEFORMATEX lpwfx, HWND hwndNotify,
  116. DWORD msTimeoutOpen, DWORD msTimeoutRetry, DWORD dwFlags);
  117. // WavOutClose - close wav output device
  118. // <hWavOut> (i) handle returned from WavOutOpen
  119. // <msTimeoutClose> (i) device close timeout in milleseconds
  120. // 0 default timeout (30000)
  121. // return 0 if success
  122. //
  123. // NOTE: if <hwndNotify> was specified in WavOutOpen,
  124. // WM_WAVOUT_CLOSE will be sent to <hwndNotify>,
  125. // when output device has been closed.
  126. //
  127. int DLLEXPORT WINAPI WavOutClose(HWAVOUT hWavOut, DWORD msTimeoutClose);
  128. // WavOutPlay - submit buffer of samples to wav output device for playback
  129. // <hWavOut> (i) handle returned from WavOutOpen
  130. // <lpBuf> (i) pointer to buffer containing samples
  131. // <sizBuf> (i) size of buffer in bytes
  132. // return 0 if success
  133. //
  134. // NOTE: the buffer pointed to by <lpBuf> must have been allocated
  135. // using MemAlloc().
  136. //
  137. // NOTE: if <hwndNotify> is specified in WavOutOpen(), a WM_WAVOUT_PLAYDONE
  138. // message will be sent to <hwndNotify>, with <lParam> set to a pointer to
  139. // a PLAYDONE structure, when <lpBuf> has been played.
  140. //
  141. // NOTE: if WAVOUT_AUTOFREE flag is specified in WavOutOpen,
  142. // GlobalFreePtr(lpBuf) will be called when <lpBuf> has been played.
  143. //
  144. int DLLEXPORT WINAPI WavOutPlay(HWAVOUT hWavOut, LPVOID lpBuf, long sizBuf);
  145. // WavOutStop - stop playback of buffer(s) sent to wav output device
  146. // <hWavOut> (i) handle returned from WavOutOpen
  147. // <msTimeoutStop> (i) device stop timeout in milleseconds
  148. // 0 default timeout (2000)
  149. // return 0 if success
  150. //
  151. int DLLEXPORT WINAPI WavOutStop(HWAVOUT hWavOut, DWORD msTimeoutStop);
  152. // WavOutPause - pause wav output device playback
  153. // <hWavOut> (i) handle returned from WavOutOpen
  154. // return 0 if success
  155. //
  156. int DLLEXPORT WINAPI WavOutPause(HWAVOUT hWavOut);
  157. // WavOutResume - resume wav output device playback
  158. // <hWavOut> (i) handle returned from WavOutOpen
  159. // return 0 if success
  160. //
  161. int DLLEXPORT WINAPI WavOutResume(HWAVOUT hWavOut);
  162. // WavOutGetState - return current wav output device state
  163. // <hWavOut> (i) handle returned from WavOutOpen
  164. // return WAVOUT_STOPPED, WAVOUT_PLAYING, WAVOUT_PAUSED, or 0 if error
  165. //
  166. WORD DLLEXPORT WINAPI WavOutGetState(HWAVOUT hWavOut);
  167. // WavOutGetPosition - get milleseconds of elapsed playback
  168. // <hWavOut> (i) handle returned from WavOutOpen
  169. // return 0 if success
  170. //
  171. long DLLEXPORT WINAPI WavOutGetPosition(HWAVOUT hWavOut);
  172. // WavOutGetId - return id of wav output device
  173. // <hWavOut> (i) handle returned from WavOutOpen
  174. // return device id (-1 if error)
  175. //
  176. int DLLEXPORT WINAPI WavOutGetId(HWAVOUT hWavOut);
  177. // WavOutGetName - get name of wav output device
  178. // <hWavOut> (i) handle returned from WavOutOpen
  179. // NULL use unopened device specified in <idDev>
  180. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  181. // -1 any suitable output device
  182. // <lpszName> (o) buffer to hold device name
  183. // <sizName> (i) size of buffer
  184. // return 0 if success
  185. //
  186. int DLLEXPORT WINAPI WavOutGetName(HWAVOUT hWavOut, int idDev, LPTSTR lpszName, int sizName);
  187. // WavOutGetIdByName - get id of wav output device, lookup by name
  188. // <lpszName> (i) device name
  189. #ifdef _WIN32
  190. // NULL or TEXT("") get preferred device id
  191. #endif
  192. // <dwFlags> (i) reserved; must be zero
  193. // return device id (-1 if error)
  194. //
  195. int WINAPI WavOutGetIdByName(LPCTSTR lpszName, DWORD dwFlags);
  196. // WavOutSupportsFormat - return TRUE if device supports specified format
  197. // <hWavOut> (i) handle returned from WavOutOpen
  198. // NULL use unopened device specified in <idDev>
  199. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  200. // -1 any suitable output device
  201. // <lpwfx> (i) wave format
  202. // return TRUE if device supports specified format
  203. //
  204. BOOL DLLEXPORT WINAPI WavOutSupportsFormat(HWAVOUT hWavOut, int idDev,
  205. LPWAVEFORMATEX lpwfx);
  206. // WavOutFormatSuggest - suggest a new format which the device supports
  207. // <hWavOut> (i) handle returned from WavOutOpen
  208. // NULL use unopened device specified in <idDev>
  209. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  210. // -1 any suitable output device
  211. // <lpwfxSrc> (i) source format
  212. // <dwFlags> (i) control flags
  213. // WAVOUT_NOACM do not use audio compression manager
  214. // return pointer to suggested format, NULL if error
  215. //
  216. // NOTE: the format structure returned is dynamically allocated.
  217. // Use WavFormatFree() to free the buffer.
  218. //
  219. LPWAVEFORMATEX DLLEXPORT WINAPI WavOutFormatSuggest(
  220. HWAVOUT hWavOut, int idDev, LPWAVEFORMATEX lpwfxSrc, DWORD dwFlags);
  221. // WavOutIsSynchronous - return TRUE if wav output device is synchronous
  222. // <hWavOut> (i) handle returned from WavOutOpen
  223. // NULL use unopened device specified in <idDev>
  224. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  225. // -1 any suitable output device
  226. // return TRUE if wav output device is synchronous
  227. //
  228. BOOL DLLEXPORT WINAPI WavOutIsSynchronous(HWAVOUT hWavOut, int idDev);
  229. // WavOutSupportsVolume - return TRUE if device supports volume control
  230. // <hWavOut> (i) handle returned from WavOutOpen
  231. // NULL use unopened device specified in <idDev>
  232. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  233. // return TRUE if device supports volume control
  234. //
  235. BOOL DLLEXPORT WINAPI WavOutSupportsVolume(HWAVOUT hWavOut, int idDev);
  236. // WavOutSupportsSpeed - return TRUE if device supports speed control
  237. // <hWavOut> (i) handle returned from WavOutOpen
  238. // NULL use unopened device specified in <idDev>
  239. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  240. // return TRUE if device supports speed control
  241. //
  242. BOOL DLLEXPORT WINAPI WavOutSupportsSpeed(HWAVOUT hWavOut, int idDev);
  243. // WavOutSupportsPitch - return TRUE if device supports pitch control
  244. // <hWavOut> (i) handle returned from WavOutOpen
  245. // NULL use unopened device specified in <idDev>
  246. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  247. // return TRUE if device supports pitch control
  248. //
  249. BOOL DLLEXPORT WINAPI WavOutSupportsPitch(HWAVOUT hWavOut, int idDev);
  250. // WavOutGetVolume - get current volume level
  251. // <hWavOut> (i) handle returned from WavOutOpen
  252. // NULL use unopened device specified in <idDev>
  253. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  254. // return volume level (0 minimum through 100 maximum, -1 if error)
  255. //
  256. int DLLEXPORT WINAPI WavOutGetVolume(HWAVOUT hWavOut, int idDev);
  257. // WavOutSetVolume - set current volume level
  258. // <hWavOut> (i) handle returned from WavOutOpen
  259. // NULL use unopened device specified in <idDev>
  260. // <idDev> (i) device id (ignored if <hWavOut> is not NULL)
  261. // <nLevel> (i) volume level
  262. // 0 minimum volume
  263. // 100 maximum volume
  264. // return 0 if success
  265. //
  266. int DLLEXPORT WINAPI WavOutSetVolume(HWAVOUT hWavOut, int idDev, int nLevel);
  267. // WavOutGetSpeed - get current speed level
  268. // <hWavOut> (i) handle returned from WavOutOpen
  269. // return speed level (100 is normal, 50 is half, 200 is double, -1 if error)
  270. //
  271. int DLLEXPORT WINAPI WavOutGetSpeed(HWAVOUT hWavOut);
  272. // WavOutSetSpeed - set current speed level
  273. // <hWavOut> (i) handle returned from WavOutOpen
  274. // <nLevel> (i) speed level
  275. // 50 half speed
  276. // 100 normal speed
  277. // 200 double speed, etc.
  278. // return 0 if success
  279. //
  280. int DLLEXPORT WINAPI WavOutSetSpeed(HWAVOUT hWavOut, int nLevel);
  281. // WavOutGetPitch - get current pitch level
  282. // <hWavOut> (i) handle returned from WavOutOpen
  283. // return pitch level (100 is normal, 50 is half, 200 is double, -1 if error)
  284. //
  285. int DLLEXPORT WINAPI WavOutGetPitch(HWAVOUT hWavOut);
  286. // WavOutSetPitch - set current pitch level
  287. // <hWavOut> (i) handle returned from WavOutOpen
  288. // <nLevel> (i) pitch level
  289. // 50 half pitch
  290. // 100 normal pitch
  291. // 200 double pitch, etc.
  292. // return 0 if success
  293. //
  294. int DLLEXPORT WINAPI WavOutSetPitch(HWAVOUT hWavOut, int nLevel);
  295. // WavOutTerm - shut down wav output residuals, if any
  296. // <hInst> (i) instance handle of calling module
  297. // <dwFlags> (i) control flags
  298. // 0 reserved; must be zero
  299. // return 0 if success
  300. //
  301. int DLLEXPORT WINAPI WavOutTerm(HINSTANCE hInst, DWORD dwFlags);
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305. #endif // __WAVOUT_H__