Team Fortress 2 Source Code as on 22/4/2020
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.

857 lines
33 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. /*==========================================================================;
  9. *
  10. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  11. *
  12. * File: dpvoice.h
  13. * Content: DirectPlayVoice include file
  14. ***************************************************************************/
  15. #ifndef __DVOICE__
  16. #define __DVOICE__
  17. #include <ole2.h> // for DECLARE_INTERFACE and HRESULT
  18. #include <mmsystem.h>
  19. #include <mmreg.h>
  20. #include <msacm.h>
  21. #include "dsound.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /****************************************************************************
  26. *
  27. * DirectPlayVoice CLSIDs
  28. *
  29. ****************************************************************************/
  30. // {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D}
  31. DEFINE_GUID(CLSID_DirectPlayVoiceClient,
  32. 0xb9f3eb85, 0xb781, 0x4ac1, 0x8d, 0x90, 0x93, 0xa0, 0x5e, 0xe3, 0x7d, 0x7d);
  33. // {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3}
  34. DEFINE_GUID(CLSID_DirectPlayVoiceServer,
  35. 0xd3f5b8e6, 0x9b78, 0x4a4c, 0x94, 0xea, 0xca, 0x23, 0x97, 0xb6, 0x63, 0xd3);
  36. // {0F0F094B-B01C-4091-A14D-DD0CD807711A}
  37. DEFINE_GUID(CLSID_DirectPlayVoiceTest,
  38. 0xf0f094b, 0xb01c, 0x4091, 0xa1, 0x4d, 0xdd, 0xc, 0xd8, 0x7, 0x71, 0x1a);
  39. /****************************************************************************
  40. *
  41. * DirectPlayVoice Interface IIDs
  42. *
  43. ****************************************************************************/
  44. // {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306}
  45. DEFINE_GUID(IID_IDirectPlayVoiceClient,
  46. 0x1dfdc8ea, 0xbcf7, 0x41d6, 0xb2, 0x95, 0xab, 0x64, 0xb3, 0xb2, 0x33, 0x6);
  47. // {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9}
  48. DEFINE_GUID(IID_IDirectPlayVoiceServer,
  49. 0xfaa1c173, 0x468, 0x43b6, 0x8a, 0x2a, 0xea, 0x8a, 0x4f, 0x20, 0x76, 0xc9);
  50. // {D26AF734-208B-41da-8224-E0CE79810BE1}
  51. DEFINE_GUID(IID_IDirectPlayVoiceTest,
  52. 0xd26af734, 0x208b, 0x41da, 0x82, 0x24, 0xe0, 0xce, 0x79, 0x81, 0xb, 0xe1);
  53. /****************************************************************************
  54. *
  55. * DirectPlayVoice Compression Type GUIDs
  56. *
  57. ****************************************************************************/
  58. // MS-ADPCM 32.8 kbit/s
  59. //
  60. // {699B52C1-A885-46a8-A308-97172419ADC7}
  61. DEFINE_GUID(DPVCTGUID_ADPCM,
  62. 0x699b52c1, 0xa885, 0x46a8, 0xa3, 0x8, 0x97, 0x17, 0x24, 0x19, 0xad, 0xc7);
  63. // Microsoft GSM 6.10 13 kbit/s
  64. //
  65. // {24768C60-5A0D-11d3-9BE4-525400D985E7}
  66. DEFINE_GUID(DPVCTGUID_GSM,
  67. 0x24768c60, 0x5a0d, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
  68. // MS-PCM 64 kbit/s
  69. //
  70. // {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5}
  71. DEFINE_GUID(DPVCTGUID_NONE,
  72. 0x8de12fd4, 0x7cb3, 0x48ce, 0xa7, 0xe8, 0x9c, 0x47, 0xa2, 0x2e, 0x8a, 0xc5);
  73. // Voxware SC03 3.2kbit/s
  74. //
  75. // {7D82A29B-2242-4f82-8F39-5D1153DF3E41}
  76. DEFINE_GUID(DPVCTGUID_SC03,
  77. 0x7d82a29b, 0x2242, 0x4f82, 0x8f, 0x39, 0x5d, 0x11, 0x53, 0xdf, 0x3e, 0x41);
  78. // Voxware SC06 6.4kbit/s
  79. //
  80. // {53DEF900-7168-4633-B47F-D143916A13C7}
  81. DEFINE_GUID(DPVCTGUID_SC06,
  82. 0x53def900, 0x7168, 0x4633, 0xb4, 0x7f, 0xd1, 0x43, 0x91, 0x6a, 0x13, 0xc7);
  83. // TrueSpeech(TM) 8.6 kbit/s
  84. //
  85. // {D7954361-5A0B-11d3-9BE4-525400D985E7}
  86. DEFINE_GUID(DPVCTGUID_TRUESPEECH,
  87. 0xd7954361, 0x5a0b, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
  88. // Voxware VR12 1.4kbit/s
  89. //
  90. // {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D}
  91. DEFINE_GUID(DPVCTGUID_VR12,
  92. 0xfe44a9fe, 0x8ed4, 0x48bf, 0x9d, 0x66, 0x1b, 0x1a, 0xdf, 0xf9, 0xff, 0x6d);
  93. // Define the default compression type
  94. #define DPVCTGUID_DEFAULT DPVCTGUID_SC03
  95. /****************************************************************************
  96. *
  97. * DirectPlayVoice Interface Pointer definitions
  98. *
  99. ****************************************************************************/
  100. typedef struct IDirectPlayVoiceClient FAR *LPDIRECTPLAYVOICECLIENT, *PDIRECTPLAYVOICECLIENT;
  101. typedef struct IDirectPlayVoiceServer FAR *LPDIRECTPLAYVOICESERVER, *PDIRECTPLAYVOICESERVER;
  102. typedef struct IDirectPlayVoiceTest FAR *LPDIRECTPLAYVOICETEST, *PDIRECTPLAYVOICETEST;
  103. /****************************************************************************
  104. *
  105. * DirectPlayVoice Callback Functions
  106. *
  107. ****************************************************************************/
  108. typedef HRESULT (FAR PASCAL *PDVMESSAGEHANDLER)(
  109. PVOID pvUserContext,
  110. DWORD dwMessageType,
  111. LPVOID lpMessage
  112. );
  113. typedef PDVMESSAGEHANDLER LPDVMESSAGEHANDLER;
  114. /****************************************************************************
  115. *
  116. * DirectPlayVoice Datatypes (Non-Structure / Non-Message)
  117. *
  118. ****************************************************************************/
  119. typedef DWORD DVID, *LPDVID, *PDVID;
  120. /****************************************************************************
  121. *
  122. * DirectPlayVoice Message Types
  123. *
  124. ****************************************************************************/
  125. #define DVMSGID_BASE 0x0000
  126. #define DVMSGID_MINBASE (DVMSGID_CREATEVOICEPLAYER)
  127. #define DVMSGID_CREATEVOICEPLAYER (DVMSGID_BASE+0x0001)
  128. #define DVMSGID_DELETEVOICEPLAYER (DVMSGID_BASE+0x0002)
  129. #define DVMSGID_SESSIONLOST (DVMSGID_BASE+0x0003)
  130. #define DVMSGID_PLAYERVOICESTART (DVMSGID_BASE+0x0004)
  131. #define DVMSGID_PLAYERVOICESTOP (DVMSGID_BASE+0x0005)
  132. #define DVMSGID_RECORDSTART (DVMSGID_BASE+0x0006)
  133. #define DVMSGID_RECORDSTOP (DVMSGID_BASE+0x0007)
  134. #define DVMSGID_CONNECTRESULT (DVMSGID_BASE+0x0008)
  135. #define DVMSGID_DISCONNECTRESULT (DVMSGID_BASE+0x0009)
  136. #define DVMSGID_INPUTLEVEL (DVMSGID_BASE+0x000A)
  137. #define DVMSGID_OUTPUTLEVEL (DVMSGID_BASE+0x000B)
  138. #define DVMSGID_HOSTMIGRATED (DVMSGID_BASE+0x000C)
  139. #define DVMSGID_SETTARGETS (DVMSGID_BASE+0x000D)
  140. #define DVMSGID_PLAYEROUTPUTLEVEL (DVMSGID_BASE+0x000E)
  141. #define DVMSGID_LOSTFOCUS (DVMSGID_BASE+0x0010)
  142. #define DVMSGID_GAINFOCUS (DVMSGID_BASE+0x0011)
  143. #define DVMSGID_LOCALHOSTSETUP (DVMSGID_BASE+0x0012)
  144. #define DVMSGID_MAXBASE (DVMSGID_LOCALHOSTSETUP)
  145. /****************************************************************************
  146. *
  147. * DirectPlayVoice Constants
  148. *
  149. ****************************************************************************/
  150. //
  151. // Buffer Aggresiveness Value Ranges
  152. //
  153. #define DVBUFFERAGGRESSIVENESS_MIN 0x00000001
  154. #define DVBUFFERAGGRESSIVENESS_MAX 0x00000064
  155. #define DVBUFFERAGGRESSIVENESS_DEFAULT 0x00000000
  156. //
  157. // Buffer Quality Value Ranges
  158. //
  159. #define DVBUFFERQUALITY_MIN 0x00000001
  160. #define DVBUFFERQUALITY_MAX 0x00000064
  161. #define DVBUFFERQUALITY_DEFAULT 0x00000000
  162. #define DVID_SYS 0
  163. //
  164. // Used to identify the session host in client/server
  165. //
  166. #define DVID_SERVERPLAYER 1
  167. //
  168. // Used to target all players
  169. //
  170. #define DVID_ALLPLAYERS 0
  171. //
  172. // Used to identify the main buffer
  173. //
  174. #define DVID_REMAINING 0xFFFFFFFF
  175. //
  176. // Input level range
  177. //
  178. #define DVINPUTLEVEL_MIN 0x00000000
  179. #define DVINPUTLEVEL_MAX 0x00000063 // 99 decimal
  180. #define DVNOTIFYPERIOD_MINPERIOD 20
  181. #define DVPLAYBACKVOLUME_DEFAULT DSBVOLUME_MAX
  182. #define DVRECORDVOLUME_LAST 0x00000001
  183. //
  184. // Use the default value
  185. //
  186. #define DVTHRESHOLD_DEFAULT 0xFFFFFFFF
  187. //
  188. // Threshold Ranges
  189. //
  190. #define DVTHRESHOLD_MIN 0x00000000
  191. #define DVTHRESHOLD_MAX 0x00000063 // 99 decimal
  192. //
  193. // Threshold field is not used
  194. //
  195. #define DVTHRESHOLD_UNUSED 0xFFFFFFFE
  196. //
  197. // Session Types
  198. //
  199. #define DVSESSIONTYPE_PEER 0x00000001
  200. #define DVSESSIONTYPE_MIXING 0x00000002
  201. #define DVSESSIONTYPE_FORWARDING 0x00000003
  202. #define DVSESSIONTYPE_ECHO 0x00000004
  203. /****************************************************************************
  204. *
  205. * DirectPlayVoice Flags
  206. *
  207. ****************************************************************************/
  208. //
  209. // Enable automatic adjustment of the recording volume
  210. //
  211. #define DVCLIENTCONFIG_AUTORECORDVOLUME 0x00000008
  212. //
  213. // Enable automatic voice activation
  214. //
  215. #define DVCLIENTCONFIG_AUTOVOICEACTIVATED 0x00000020
  216. //
  217. // Enable echo suppression
  218. //
  219. #define DVCLIENTCONFIG_ECHOSUPPRESSION 0x08000000
  220. //
  221. // Voice Activation manual mode
  222. //
  223. #define DVCLIENTCONFIG_MANUALVOICEACTIVATED 0x00000004
  224. //
  225. // Only playback voices that have buffers created for them
  226. //
  227. #define DVCLIENTCONFIG_MUTEGLOBAL 0x00000010
  228. //
  229. // Mute the playback
  230. //
  231. #define DVCLIENTCONFIG_PLAYBACKMUTE 0x00000002
  232. //
  233. // Mute the recording
  234. //
  235. #define DVCLIENTCONFIG_RECORDMUTE 0x00000001
  236. //
  237. // Complete the operation before returning
  238. //
  239. #define DVFLAGS_SYNC 0x00000001
  240. //
  241. // Just check to see if wizard has been run, and if so what it's results were
  242. //
  243. #define DVFLAGS_QUERYONLY 0x00000002
  244. //
  245. // Shutdown the voice session without migrating the host
  246. //
  247. #define DVFLAGS_NOHOSTMIGRATE 0x00000008
  248. //
  249. // Allow the back button to be enabled in the wizard
  250. //
  251. #define DVFLAGS_ALLOWBACK 0x00000010
  252. //
  253. // Disable host migration in the voice session
  254. //
  255. #define DVSESSION_NOHOSTMIGRATION 0x00000001
  256. //
  257. // Server controlled targetting
  258. //
  259. #define DVSESSION_SERVERCONTROLTARGET 0x00000002
  260. //
  261. // Use DirectSound Normal Mode instead of priority
  262. //
  263. #define DVSOUNDCONFIG_NORMALMODE 0x00000001
  264. //
  265. // Automatically select the microphone
  266. //
  267. #define DVSOUNDCONFIG_AUTOSELECT 0x00000002
  268. //
  269. // Run in half duplex mode
  270. //
  271. #define DVSOUNDCONFIG_HALFDUPLEX 0x00000004
  272. //
  273. // No volume controls are available for the recording device
  274. //
  275. #define DVSOUNDCONFIG_NORECVOLAVAILABLE 0x00000010
  276. //
  277. // Disable capture sharing
  278. //
  279. #define DVSOUNDCONFIG_NOFOCUS 0x20000000
  280. //
  281. // Set system conversion quality to high
  282. //
  283. #define DVSOUNDCONFIG_SETCONVERSIONQUALITY 0x00000008
  284. //
  285. // Enable strict focus mode
  286. //
  287. #define DVSOUNDCONFIG_STRICTFOCUS 0x40000000
  288. //
  289. // Player is in half duplex mode
  290. //
  291. #define DVPLAYERCAPS_HALFDUPLEX 0x00000001
  292. //
  293. // Specifies that player is the local player
  294. //
  295. #define DVPLAYERCAPS_LOCAL 0x00000002
  296. /****************************************************************************
  297. *
  298. * DirectPlayVoice Structures (Non-Message)
  299. *
  300. ****************************************************************************/
  301. //
  302. // DirectPlayVoice Caps
  303. // (GetCaps / SetCaps)
  304. //
  305. typedef struct
  306. {
  307. DWORD dwSize; // Size of this structure
  308. DWORD dwFlags; // Caps flags
  309. } DVCAPS, *LPDVCAPS, *PDVCAPS;
  310. //
  311. // DirectPlayVoice Client Configuration
  312. // (Connect / GetClientConfig)
  313. //
  314. typedef struct
  315. {
  316. DWORD dwSize; // Size of this structure
  317. DWORD dwFlags; // Flags for client config (DVCLIENTCONFIG_...)
  318. LONG lRecordVolume; // Recording volume
  319. LONG lPlaybackVolume; // Playback volume
  320. DWORD dwThreshold; // Voice Activation Threshold
  321. DWORD dwBufferQuality; // Buffer quality
  322. DWORD dwBufferAggressiveness; // Buffer aggressiveness
  323. DWORD dwNotifyPeriod; // Period of notification messages (ms)
  324. } DVCLIENTCONFIG, *LPDVCLIENTCONFIG, *PDVCLIENTCONFIG;
  325. //
  326. // DirectPlayVoice Compression Type Information
  327. // (GetCompressionTypes)
  328. //
  329. typedef struct
  330. {
  331. DWORD dwSize; // Size of this structure
  332. GUID guidType; // GUID that identifies this compression type
  333. LPWSTR lpszName; // String name of this compression type
  334. LPWSTR lpszDescription; // Description for this compression type
  335. DWORD dwFlags; // Flags for this compression type
  336. DWORD dwMaxBitsPerSecond; // Maximum # of bit/s this compression type uses
  337. } DVCOMPRESSIONINFO, *LPDVCOMPRESSIONINFO, *PDVCOMPRESSIONINFO;
  338. //
  339. // DirectPlayVoice Session Description
  340. // (Host / GetSessionDesc)
  341. //
  342. typedef struct
  343. {
  344. DWORD dwSize; // Size of this structure
  345. DWORD dwFlags; // Session flags (DVSESSION_...)
  346. DWORD dwSessionType; // Session type (DVSESSIONTYPE_...)
  347. GUID guidCT; // Compression Type to use
  348. DWORD dwBufferQuality; // Buffer quality
  349. DWORD dwBufferAggressiveness; // Buffer aggresiveness
  350. } DVSESSIONDESC, *LPDVSESSIONDESC, *PDVSESSIONDESC;
  351. //
  352. // DirectPlayVoice Client Sound Device Configuration
  353. // (Connect / GetSoundDeviceConfig)
  354. //
  355. typedef struct
  356. {
  357. DWORD dwSize; // Size of this structure
  358. DWORD dwFlags; // Flags for sound config (DVSOUNDCONFIG_...)
  359. GUID guidPlaybackDevice; // GUID of the playback device to use
  360. LPDIRECTSOUND lpdsPlaybackDevice; // DirectSound Object to use (optional)
  361. GUID guidCaptureDevice; // GUID of the capture device to use
  362. LPDIRECTSOUNDCAPTURE lpdsCaptureDevice; // DirectSoundCapture Object to use (optional)
  363. HWND hwndAppWindow; // HWND of your application's top-level window
  364. LPDIRECTSOUNDBUFFER lpdsMainBuffer; // DirectSoundBuffer to use for playback (optional)
  365. DWORD dwMainBufferFlags; // Flags to pass to Play() on the main buffer
  366. DWORD dwMainBufferPriority; // Priority to set when calling Play() on the main buffer
  367. } DVSOUNDDEVICECONFIG, *LPDVSOUNDDEVICECONFIG, *PDVSOUNDDEVICECONFIG;
  368. /****************************************************************************
  369. *
  370. * DirectPlayVoice message handler call back structures
  371. *
  372. ****************************************************************************/
  373. //
  374. // Result of the Connect() call. (If it wasn't called Async)
  375. // (DVMSGID_CONNECTRESULT)
  376. //
  377. typedef struct
  378. {
  379. DWORD dwSize; // Size of this structure
  380. HRESULT hrResult; // Result of the Connect() call
  381. } DVMSG_CONNECTRESULT, *LPDVMSG_CONNECTRESULT, *PDVMSG_CONNECTRESULT;
  382. //
  383. // A new player has entered the voice session
  384. // (DVMSGID_CREATEVOICEPLAYER)
  385. //
  386. typedef struct
  387. {
  388. DWORD dwSize; // Size of this structure
  389. DVID dvidPlayer; // DVID of the player who joined
  390. DWORD dwFlags; // Player flags (DVPLAYERCAPS_...)
  391. PVOID pvPlayerContext; // Context value for this player (user set)
  392. } DVMSG_CREATEVOICEPLAYER, *LPDVMSG_CREATEVOICEPLAYER, *PDVMSG_CREATEVOICEPLAYER;
  393. //
  394. // A player has left the voice session
  395. // (DVMSGID_DELETEVOICEPLAYER)
  396. //
  397. typedef struct
  398. {
  399. DWORD dwSize; // Size of this structure
  400. DVID dvidPlayer; // DVID of the player who left
  401. PVOID pvPlayerContext; // Context value for the player
  402. } DVMSG_DELETEVOICEPLAYER, *LPDVMSG_DELETEVOICEPLAYER, *PDVMSG_DELETEVOICEPLAYER;
  403. //
  404. // Result of the Disconnect() call. (If it wasn't called Async)
  405. // (DVMSGID_DISCONNECTRESULT)
  406. //
  407. typedef struct
  408. {
  409. DWORD dwSize; // Size of this structure
  410. HRESULT hrResult; // Result of the Disconnect() call
  411. } DVMSG_DISCONNECTRESULT, *LPDVMSG_DISCONNECTRESULT, *PDVMSG_DISCONNECTRESULT;
  412. //
  413. // The voice session host has migrated.
  414. // (DVMSGID_HOSTMIGRATED)
  415. //
  416. typedef struct
  417. {
  418. DWORD dwSize; // Size of this structure
  419. DVID dvidNewHostID; // DVID of the player who is now the host
  420. LPDIRECTPLAYVOICESERVER pdvServerInterface;
  421. // Pointer to the new host object (if local player is now host)
  422. } DVMSG_HOSTMIGRATED, *LPDVMSG_HOSTMIGRATED, *PDVMSG_HOSTMIGRATED;
  423. //
  424. // The current input level / recording volume on the local machine
  425. // (DVMSGID_INPUTLEVEL)
  426. //
  427. typedef struct
  428. {
  429. DWORD dwSize; // Size of this structure
  430. DWORD dwPeakLevel; // Current peak level of the audio
  431. LONG lRecordVolume; // Current recording volume
  432. PVOID pvLocalPlayerContext; // Context value for the local player
  433. } DVMSG_INPUTLEVEL, *LPDVMSG_INPUTLEVEL, *PDVMSG_INPUTLEVEL;
  434. //
  435. // The local client is about to become the new host
  436. // (DVMSGID_LOCALHOSTSETUP)
  437. //
  438. typedef struct
  439. {
  440. DWORD dwSize; // Size of this structure
  441. PVOID pvContext; // Context value to be passed to Initialize() of new host object
  442. PDVMESSAGEHANDLER pMessageHandler; // Message handler to be used by new host object
  443. } DVMSG_LOCALHOSTSETUP, *LPDVMSG_LOCALHOSTSETUP, *PDVMSG_LOCALHOSTSETUP;
  444. //
  445. // The current output level for the combined output of all incoming streams.
  446. // (DVMSGID_OUTPUTLEVEL)
  447. //
  448. typedef struct
  449. {
  450. DWORD dwSize; // Size of this structure
  451. DWORD dwPeakLevel; // Current peak level of the output
  452. LONG lOutputVolume; // Current playback volume
  453. PVOID pvLocalPlayerContext; // Context value for the local player
  454. } DVMSG_OUTPUTLEVEL, *LPDVMSG_OUTPUTLEVEL, *PDVMSG_OUTPUTLEVEL;
  455. //
  456. // The current peak level of an individual player's incoming audio stream as it is
  457. // being played back.
  458. // (DVMSGID_PLAYEROUTPUTLEVEL)
  459. //
  460. typedef struct
  461. {
  462. DWORD dwSize; // Size of this structure
  463. DVID dvidSourcePlayerID; // DVID of the player
  464. DWORD dwPeakLevel; // Peak level of the player's stream
  465. PVOID pvPlayerContext; // Context value for the player
  466. } DVMSG_PLAYEROUTPUTLEVEL, *LPDVMSG_PLAYEROUTPUTLEVEL, *PDVMSG_PLAYEROUTPUTLEVEL;
  467. //
  468. // An audio stream from the specified player has started playing back on the local client.
  469. // (DVMSGID_PLAYERVOICESTART).
  470. //
  471. typedef struct
  472. {
  473. DWORD dwSize; // Size of this structure
  474. DVID dvidSourcePlayerID; // DVID of the Player
  475. PVOID pvPlayerContext; // Context value for this player
  476. } DVMSG_PLAYERVOICESTART, *LPDVMSG_PLAYERVOICESTART, *PDVMSG_PLAYERVOICESTART;
  477. //
  478. // The audio stream from the specified player has stopped playing back on the local client.
  479. // (DVMSGID_PLAYERVOICESTOP)
  480. //
  481. typedef struct
  482. {
  483. DWORD dwSize; // Size of this structure
  484. DVID dvidSourcePlayerID; // DVID of the player
  485. PVOID pvPlayerContext; // Context value for this player
  486. } DVMSG_PLAYERVOICESTOP, *LPDVMSG_PLAYERVOICESTOP, *PDVMSG_PLAYERVOICESTOP;
  487. //
  488. // Transmission has started on the local machine
  489. // (DVMSGID_RECORDSTART)
  490. //
  491. typedef struct
  492. {
  493. DWORD dwSize; // Size of this structure
  494. DWORD dwPeakLevel; // Peak level that caused transmission to start
  495. PVOID pvLocalPlayerContext; // Context value for the local player
  496. } DVMSG_RECORDSTART, *LPDVMSG_RECORDSTART, *PDVMSG_RECORDSTART;
  497. //
  498. // Transmission has stopped on the local machine
  499. // (DVMSGID_RECORDSTOP)
  500. //
  501. typedef struct
  502. {
  503. DWORD dwSize; // Size of this structure
  504. DWORD dwPeakLevel; // Peak level that caused transmission to stop
  505. PVOID pvLocalPlayerContext; // Context value for the local player
  506. } DVMSG_RECORDSTOP, *LPDVMSG_RECORDSTOP, *PDVMSG_RECORDSTOP;
  507. //
  508. // The voice session has been lost
  509. // (DVMSGID_SESSIONLOST)
  510. //
  511. typedef struct
  512. {
  513. DWORD dwSize; // Size of this structure
  514. HRESULT hrResult; // Reason the session was disconnected
  515. } DVMSG_SESSIONLOST, *LPDVMSG_SESSIONLOST, *PDVMSG_SESSIONLOST;
  516. //
  517. // The target list has been updated for the local client
  518. // (DVMSGID_SETTARGETS)
  519. //
  520. typedef struct
  521. {
  522. DWORD dwSize; // Size of this structure
  523. DWORD dwNumTargets; // # of targets
  524. PDVID pdvidTargets; // An array of DVIDs specifying the current targets
  525. } DVMSG_SETTARGETS, *LPDVMSG_SETTARGETS, *PDVMSG_SETTARGETS;
  526. /****************************************************************************
  527. *
  528. * DirectPlayVoice Functions
  529. *
  530. ****************************************************************************/
  531. extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
  532. /****************************************************************************
  533. *
  534. * DirectPlay8 Application Interfaces
  535. *
  536. ****************************************************************************/
  537. #undef INTERFACE
  538. #define INTERFACE IDirectPlayVoiceClient
  539. DECLARE_INTERFACE_( IDirectPlayVoiceClient, IUnknown )
  540. {
  541. /*** IUnknown methods ***/
  542. STDMETHOD(QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE;
  543. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  544. STDMETHOD_(ULONG,Release)(THIS) PURE;
  545. /*** IDirectPlayVoiceClient methods ***/
  546. STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, PDWORD, DWORD ) PURE;
  547. STDMETHOD_(HRESULT, Connect) (THIS_ PDVSOUNDDEVICECONFIG, PDVCLIENTCONFIG, DWORD ) PURE;
  548. STDMETHOD_(HRESULT, Disconnect) (THIS_ DWORD ) PURE;
  549. STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
  550. STDMETHOD_(HRESULT, GetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE;
  551. STDMETHOD_(HRESULT, SetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE;
  552. STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE;
  553. STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE;
  554. STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ PDVID, DWORD, DWORD ) PURE;
  555. STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ PDVID, PDWORD, DWORD ) PURE;
  556. STDMETHOD_(HRESULT, Create3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUNDBUFFER, DWORD, DWORD, LPDIRECTSOUND3DBUFFER * ) PURE;
  557. STDMETHOD_(HRESULT, Delete3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUND3DBUFFER * ) PURE;
  558. STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE;
  559. STDMETHOD_(HRESULT, GetSoundDeviceConfig)( THIS_ PDVSOUNDDEVICECONFIG, PDWORD ) PURE;
  560. };
  561. #undef INTERFACE
  562. #define INTERFACE IDirectPlayVoiceServer
  563. DECLARE_INTERFACE_( IDirectPlayVoiceServer, IUnknown )
  564. {
  565. /*** IUnknown methods ***/
  566. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  567. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  568. STDMETHOD_(ULONG,Release) (THIS) PURE;
  569. /*** IDirectPlayVoiceServer methods ***/
  570. STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, LPDWORD, DWORD ) PURE;
  571. STDMETHOD_(HRESULT, StartSession) (THIS_ PDVSESSIONDESC, DWORD ) PURE;
  572. STDMETHOD_(HRESULT, StopSession) (THIS_ DWORD ) PURE;
  573. STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
  574. STDMETHOD_(HRESULT, SetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
  575. STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE;
  576. STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE;
  577. STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ DVID, PDVID, DWORD, DWORD ) PURE;
  578. STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ DVID, PDVID, PDWORD, DWORD ) PURE;
  579. STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE;
  580. };
  581. #undef INTERFACE
  582. #define INTERFACE IDirectPlayVoiceTest
  583. DECLARE_INTERFACE_( IDirectPlayVoiceTest, IUnknown )
  584. {
  585. /*** IUnknown methods ***/
  586. STDMETHOD(QueryInterface) (THIS_ REFIID riid, PVOID * ppvObj) PURE;
  587. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  588. STDMETHOD_(ULONG,Release) (THIS) PURE;
  589. /*** IDirectPlayVoiceTest methods ***/
  590. STDMETHOD_(HRESULT, CheckAudioSetup) (THIS_ const GUID *, const GUID * , HWND, DWORD ) PURE;
  591. };
  592. #if !defined(__cplusplus) || defined(CINTERFACE)
  593. #define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  594. #define IDirectPlayVoiceClient_AddRef(p) (p)->lpVtbl->AddRef(p)
  595. #define IDirectPlayVoiceClient_Release(p) (p)->lpVtbl->Release(p)
  596. #define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e)
  597. #define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c)
  598. #define IDirectPlayVoiceClient_Disconnect(p,a) (p)->lpVtbl->Disconnect(p,a)
  599. #define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a)
  600. #define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->lpVtbl->GetClientConfig(p,a)
  601. #define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->lpVtbl->SetClientConfig(p,a)
  602. #define IDirectPlayVoiceClient_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
  603. #define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d)
  604. #define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->lpVtbl->SetTransmitTargets(p,a,b,c)
  605. #define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->lpVtbl->GetTransmitTargets(p,a,b,c)
  606. #define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->lpVtbl->Create3DSoundBuffer(p,a,b,c,d,e)
  607. #define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->lpVtbl->Delete3DSoundBuffer(p,a,b)
  608. #define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b)
  609. #define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->lpVtbl->GetSoundDeviceConfig(p,a,b)
  610. #define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  611. #define IDirectPlayVoiceServer_AddRef(p) (p)->lpVtbl->AddRef(p)
  612. #define IDirectPlayVoiceServer_Release(p) (p)->lpVtbl->Release(p)
  613. #define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e)
  614. #define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b)
  615. #define IDirectPlayVoiceServer_StopSession(p,a) (p)->lpVtbl->StopSession(p,a)
  616. #define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a)
  617. #define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->lpVtbl->SetSessionDesc(p,a)
  618. #define IDirectPlayVoiceServer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
  619. #define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d)
  620. #define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->SetTransmitTargets(p,a,b,c,d)
  621. #define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->GetTransmitTargets(p,a,b,c,d)
  622. #define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b)
  623. #define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  624. #define IDirectPlayVoiceTest_AddRef(p) (p)->lpVtbl->AddRef(p)
  625. #define IDirectPlayVoiceTest_Release(p) (p)->lpVtbl->Release(p)
  626. #define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->lpVtbl->CheckAudioSetup(p,a,b,c,d)
  627. #else /* C++ */
  628. #define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
  629. #define IDirectPlayVoiceClient_AddRef(p) (p)->AddRef()
  630. #define IDirectPlayVoiceClient_Release(p) (p)->Release()
  631. #define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e)
  632. #define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->Connect(a,b,c)
  633. #define IDirectPlayVoiceClient_Disconnect(p,a) (p)->Disconnect(a)
  634. #define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->GetSessionDesc(a)
  635. #define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->GetClientConfig(a)
  636. #define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->SetClientConfig(a)
  637. #define IDirectPlayVoiceClient_GetCaps(p,a) (p)->GetCaps(a)
  638. #define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d)
  639. #define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->SetTransmitTargets(a,b,c)
  640. #define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->GetTransmitTargets(a,b,c)
  641. #define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->Create3DSoundBuffer(a,b,c,d,e)
  642. #define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->Delete3DSoundBuffer(a,b)
  643. #define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b)
  644. #define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->GetSoundDeviceConfig(a,b)
  645. #define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
  646. #define IDirectPlayVoiceServer_AddRef(p) (p)->AddRef()
  647. #define IDirectPlayVoiceServer_Release(p) (p)->Release()
  648. #define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e)
  649. #define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->StartSession(a,b)
  650. #define IDirectPlayVoiceServer_StopSession(p,a) (p)->StopSession(a)
  651. #define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->GetSessionDesc(a)
  652. #define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->SetSessionDesc(a)
  653. #define IDirectPlayVoiceServer_GetCaps(p,a) (p)->GetCaps(a)
  654. #define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d)
  655. #define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->SetTransmitTargets(a,b,c,d)
  656. #define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->GetTransmitTargets(a,b,c,d)
  657. #define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b)
  658. #define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
  659. #define IDirectPlayVoiceTest_AddRef(p) (p)->AddRef()
  660. #define IDirectPlayVoiceTest_Release(p) (p)->Release()
  661. #define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->CheckAudioSetup(a,b,c,d)
  662. #endif
  663. /****************************************************************************
  664. *
  665. * DIRECTPLAYVOICE ERRORS
  666. *
  667. * Errors are represented by negative values and cannot be combined.
  668. *
  669. ****************************************************************************/
  670. #define _FACDPV 0x15
  671. #define MAKE_DVHRESULT( code ) MAKE_HRESULT( 1, _FACDPV, code )
  672. #define DV_OK S_OK
  673. #define DV_FULLDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x0005 )
  674. #define DV_HALFDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x000A )
  675. #define DV_PENDING MAKE_HRESULT( 0, _FACDPV, 0x0010 )
  676. #define DVERR_BUFFERTOOSMALL MAKE_DVHRESULT( 0x001E )
  677. #define DVERR_EXCEPTION MAKE_DVHRESULT( 0x004A )
  678. #define DVERR_GENERIC E_FAIL
  679. #define DVERR_INVALIDFLAGS MAKE_DVHRESULT( 0x0078 )
  680. #define DVERR_INVALIDOBJECT MAKE_DVHRESULT( 0x0082 )
  681. #define DVERR_INVALIDPARAM E_INVALIDARG
  682. #define DVERR_INVALIDPLAYER MAKE_DVHRESULT( 0x0087 )
  683. #define DVERR_INVALIDGROUP MAKE_DVHRESULT( 0x0091 )
  684. #define DVERR_INVALIDHANDLE MAKE_DVHRESULT( 0x0096 )
  685. #define DVERR_OUTOFMEMORY E_OUTOFMEMORY
  686. #define DVERR_PENDING DV_PENDING
  687. #define DVERR_NOTSUPPORTED E_NOTIMPL
  688. #define DVERR_NOINTERFACE E_NOINTERFACE
  689. #define DVERR_SESSIONLOST MAKE_DVHRESULT( 0x012C )
  690. #define DVERR_NOVOICESESSION MAKE_DVHRESULT( 0x012E )
  691. #define DVERR_CONNECTIONLOST MAKE_DVHRESULT( 0x0168 )
  692. #define DVERR_NOTINITIALIZED MAKE_DVHRESULT( 0x0169 )
  693. #define DVERR_CONNECTED MAKE_DVHRESULT( 0x016A )
  694. #define DVERR_NOTCONNECTED MAKE_DVHRESULT( 0x016B )
  695. #define DVERR_CONNECTABORTING MAKE_DVHRESULT( 0x016E )
  696. #define DVERR_NOTALLOWED MAKE_DVHRESULT( 0x016F )
  697. #define DVERR_INVALIDTARGET MAKE_DVHRESULT( 0x0170 )
  698. #define DVERR_TRANSPORTNOTHOST MAKE_DVHRESULT( 0x0171 )
  699. #define DVERR_COMPRESSIONNOTSUPPORTED MAKE_DVHRESULT( 0x0172 )
  700. #define DVERR_ALREADYPENDING MAKE_DVHRESULT( 0x0173 )
  701. #define DVERR_SOUNDINITFAILURE MAKE_DVHRESULT( 0x0174 )
  702. #define DVERR_TIMEOUT MAKE_DVHRESULT( 0x0175 )
  703. #define DVERR_CONNECTABORTED MAKE_DVHRESULT( 0x0176 )
  704. #define DVERR_NO3DSOUND MAKE_DVHRESULT( 0x0177 )
  705. #define DVERR_ALREADYBUFFERED MAKE_DVHRESULT( 0x0178 )
  706. #define DVERR_NOTBUFFERED MAKE_DVHRESULT( 0x0179 )
  707. #define DVERR_HOSTING MAKE_DVHRESULT( 0x017A )
  708. #define DVERR_NOTHOSTING MAKE_DVHRESULT( 0x017B )
  709. #define DVERR_INVALIDDEVICE MAKE_DVHRESULT( 0x017C )
  710. #define DVERR_RECORDSYSTEMERROR MAKE_DVHRESULT( 0x017D )
  711. #define DVERR_PLAYBACKSYSTEMERROR MAKE_DVHRESULT( 0x017E )
  712. #define DVERR_SENDERROR MAKE_DVHRESULT( 0x017F )
  713. #define DVERR_USERCANCEL MAKE_DVHRESULT( 0x0180 )
  714. #define DVERR_RUNSETUP MAKE_DVHRESULT( 0x0183 )
  715. #define DVERR_INCOMPATIBLEVERSION MAKE_DVHRESULT( 0x0184 )
  716. #define DVERR_INITIALIZED MAKE_DVHRESULT( 0x0187 )
  717. #define DVERR_INVALIDPOINTER E_POINTER
  718. #define DVERR_NOTRANSPORT MAKE_DVHRESULT( 0x0188 )
  719. #define DVERR_NOCALLBACK MAKE_DVHRESULT( 0x0189 )
  720. #define DVERR_TRANSPORTNOTINIT MAKE_DVHRESULT( 0x018A )
  721. #define DVERR_TRANSPORTNOSESSION MAKE_DVHRESULT( 0x018B )
  722. #define DVERR_TRANSPORTNOPLAYER MAKE_DVHRESULT( 0x018C )
  723. #define DVERR_USERBACK MAKE_DVHRESULT( 0x018D )
  724. #define DVERR_NORECVOLAVAILABLE MAKE_DVHRESULT( 0x018E )
  725. #define DVERR_INVALIDBUFFER MAKE_DVHRESULT( 0x018F )
  726. #define DVERR_LOCKEDBUFFER MAKE_DVHRESULT( 0x0190 )
  727. #ifdef __cplusplus
  728. }
  729. #endif
  730. #endif