dvoice.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:34k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1999 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dpvoice.h
  6.  *  Content:    DirectPlayVoice include file
  7.  ***************************************************************************/
  8. #ifndef __DVOICE__
  9. #define __DVOICE__
  10. #include <ole2.h> // for DECLARE_INTERFACE and HRESULT
  11. #include <mmsystem.h>
  12. #include <mmreg.h>
  13. #include <msacm.h>
  14. #include "dsound.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /****************************************************************************
  19.  *
  20.  * DirectPlayVoice CLSIDs
  21.  *
  22.  ****************************************************************************/
  23. // {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D}
  24. DEFINE_GUID(CLSID_DirectPlayVoiceClient, 
  25. 0xb9f3eb85, 0xb781, 0x4ac1, 0x8d, 0x90, 0x93, 0xa0, 0x5e, 0xe3, 0x7d, 0x7d);
  26. // {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3}
  27. DEFINE_GUID(CLSID_DirectPlayVoiceServer, 
  28. 0xd3f5b8e6, 0x9b78, 0x4a4c, 0x94, 0xea, 0xca, 0x23, 0x97, 0xb6, 0x63, 0xd3);
  29. // {0F0F094B-B01C-4091-A14D-DD0CD807711A}
  30. DEFINE_GUID(CLSID_DirectPlayVoiceTest, 
  31. 0xf0f094b, 0xb01c, 0x4091, 0xa1, 0x4d, 0xdd, 0xc, 0xd8, 0x7, 0x71, 0x1a);
  32. /****************************************************************************
  33.  *
  34.  * DirectPlayVoice Interface IIDs
  35.  *
  36.  ****************************************************************************/
  37. // {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306}
  38. DEFINE_GUID(IID_IDirectPlayVoiceClient, 
  39. 0x1dfdc8ea, 0xbcf7, 0x41d6, 0xb2, 0x95, 0xab, 0x64, 0xb3, 0xb2, 0x33, 0x6);
  40. // {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9}
  41. DEFINE_GUID(IID_IDirectPlayVoiceServer, 
  42. 0xfaa1c173, 0x468, 0x43b6, 0x8a, 0x2a, 0xea, 0x8a, 0x4f, 0x20, 0x76, 0xc9);
  43. // {D26AF734-208B-41da-8224-E0CE79810BE1}
  44. DEFINE_GUID(IID_IDirectPlayVoiceTest,
  45. 0xd26af734, 0x208b, 0x41da, 0x82, 0x24, 0xe0, 0xce, 0x79, 0x81, 0xb, 0xe1);
  46. /****************************************************************************
  47.  *
  48.  * DirectPlayVoice Compression Type GUIDs
  49.  *
  50.  ****************************************************************************/
  51. // MS-ADPCM 32.8 kbit/s
  52. //
  53. // {699B52C1-A885-46a8-A308-97172419ADC7}
  54. DEFINE_GUID(DPVCTGUID_ADPCM,
  55. 0x699b52c1, 0xa885, 0x46a8, 0xa3, 0x8, 0x97, 0x17, 0x24, 0x19, 0xad, 0xc7);
  56. // Microsoft GSM 6.10 13 kbit/s
  57. //
  58. // {24768C60-5A0D-11d3-9BE4-525400D985E7}
  59. DEFINE_GUID(DPVCTGUID_GSM,
  60. 0x24768c60, 0x5a0d, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
  61. // MS-PCM 64 kbit/s
  62. // 
  63. // {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5}
  64. DEFINE_GUID(DPVCTGUID_NONE,
  65. 0x8de12fd4, 0x7cb3, 0x48ce, 0xa7, 0xe8, 0x9c, 0x47, 0xa2, 0x2e, 0x8a, 0xc5);
  66. // Voxware SC03 3.2kbit/s
  67. //
  68. // {7D82A29B-2242-4f82-8F39-5D1153DF3E41}
  69. DEFINE_GUID(DPVCTGUID_SC03,
  70. 0x7d82a29b, 0x2242, 0x4f82, 0x8f, 0x39, 0x5d, 0x11, 0x53, 0xdf, 0x3e, 0x41);
  71. // Voxware SC06 6.4kbit/s
  72. //
  73. // {53DEF900-7168-4633-B47F-D143916A13C7}
  74. DEFINE_GUID(DPVCTGUID_SC06,
  75. 0x53def900, 0x7168, 0x4633, 0xb4, 0x7f, 0xd1, 0x43, 0x91, 0x6a, 0x13, 0xc7);
  76. // TrueSpeech(TM) 8.6 kbit/s
  77. //
  78. // {D7954361-5A0B-11d3-9BE4-525400D985E7}
  79. DEFINE_GUID(DPVCTGUID_TRUESPEECH,
  80. 0xd7954361, 0x5a0b, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
  81. // Voxware VR12 1.4kbit/s
  82. //
  83. // {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D}
  84. DEFINE_GUID(DPVCTGUID_VR12,
  85. 0xfe44a9fe, 0x8ed4, 0x48bf, 0x9d, 0x66, 0x1b, 0x1a, 0xdf, 0xf9, 0xff, 0x6d);
  86. // Define the default compression type
  87. #define DPVCTGUID_DEFAULT DPVCTGUID_SC03
  88. /****************************************************************************
  89.  *
  90.  * DirectPlayVoice Interface Pointer definitions
  91.  *
  92.  ****************************************************************************/
  93. typedef struct IDirectPlayVoiceClient FAR *LPDIRECTPLAYVOICECLIENT, *PDIRECTPLAYVOICECLIENT;
  94. typedef struct IDirectPlayVoiceServer FAR *LPDIRECTPLAYVOICESERVER, *PDIRECTPLAYVOICESERVER;
  95. typedef struct IDirectPlayVoiceTest FAR *LPDIRECTPLAYVOICETEST, *PDIRECTPLAYVOICETEST;
  96. /****************************************************************************
  97.  *
  98.  * DirectPlayVoice Callback Functions
  99.  *
  100.  ****************************************************************************/
  101. typedef HRESULT (FAR PASCAL *PDVMESSAGEHANDLER)(
  102.     PVOID   pvUserContext,
  103.     DWORD   dwMessageType,
  104.     LPVOID  lpMessage
  105. );
  106. typedef PDVMESSAGEHANDLER LPDVMESSAGEHANDLER;
  107. /****************************************************************************
  108.  *
  109.  * DirectPlayVoice Datatypes (Non-Structure / Non-Message)
  110.  *
  111.  ****************************************************************************/
  112. typedef DWORD DVID, *LPDVID, *PDVID;
  113. /****************************************************************************
  114.  *
  115.  * DirectPlayVoice Message Types
  116.  *
  117.  ****************************************************************************/
  118. #define DVMSGID_BASE                        0x0000
  119. #define DVMSGID_MINBASE                     (DVMSGID_CREATEVOICEPLAYER)
  120. #define DVMSGID_CREATEVOICEPLAYER           (DVMSGID_BASE+0x0001)
  121. #define DVMSGID_DELETEVOICEPLAYER           (DVMSGID_BASE+0x0002)
  122. #define DVMSGID_SESSIONLOST                 (DVMSGID_BASE+0x0003)
  123. #define DVMSGID_PLAYERVOICESTART            (DVMSGID_BASE+0x0004)
  124. #define DVMSGID_PLAYERVOICESTOP             (DVMSGID_BASE+0x0005)
  125. #define DVMSGID_RECORDSTART                 (DVMSGID_BASE+0x0006)
  126. #define DVMSGID_RECORDSTOP                  (DVMSGID_BASE+0x0007)
  127. #define DVMSGID_CONNECTRESULT               (DVMSGID_BASE+0x0008)
  128. #define DVMSGID_DISCONNECTRESULT            (DVMSGID_BASE+0x0009)
  129. #define DVMSGID_INPUTLEVEL                  (DVMSGID_BASE+0x000A)
  130. #define DVMSGID_OUTPUTLEVEL                 (DVMSGID_BASE+0x000B)
  131. #define DVMSGID_HOSTMIGRATED                (DVMSGID_BASE+0x000C)
  132. #define DVMSGID_SETTARGETS                  (DVMSGID_BASE+0x000D)
  133. #define DVMSGID_PLAYEROUTPUTLEVEL           (DVMSGID_BASE+0x000E)
  134. #define DVMSGID_LOSTFOCUS                   (DVMSGID_BASE+0x0010)
  135. #define DVMSGID_GAINFOCUS                   (DVMSGID_BASE+0x0011)
  136. #define DVMSGID_LOCALHOSTSETUP (DVMSGID_BASE+0x0012)
  137. #define DVMSGID_MAXBASE                     (DVMSGID_LOCALHOSTSETUP)
  138. /****************************************************************************
  139.  *
  140.  * DirectPlayVoice Constants
  141.  *
  142.  ****************************************************************************/
  143. //
  144. // Buffer Aggresiveness Value Ranges
  145. //
  146. #define DVBUFFERAGGRESSIVENESS_MIN          0x00000001
  147. #define DVBUFFERAGGRESSIVENESS_MAX          0x00000064
  148. #define DVBUFFERAGGRESSIVENESS_DEFAULT      0x00000000
  149. // 
  150. // Buffer Quality Value Ranges
  151. //
  152. #define DVBUFFERQUALITY_MIN                 0x00000001
  153. #define DVBUFFERQUALITY_MAX                 0x00000064
  154. #define DVBUFFERQUALITY_DEFAULT             0x00000000
  155. #define DVID_SYS                0
  156. //
  157. // Used to identify the session host in client/server
  158. //
  159. #define DVID_SERVERPLAYER       1
  160. //
  161. // Used to target all players
  162. //
  163. #define DVID_ALLPLAYERS         0
  164. //
  165. // Used to identify the main buffer
  166. //
  167. #define DVID_REMAINING          0xFFFFFFFF
  168. // 
  169. // Input level range
  170. //
  171. #define DVINPUTLEVEL_MIN                    0x00000000
  172. #define DVINPUTLEVEL_MAX                    0x00000063 // 99 decimal
  173. #define DVNOTIFYPERIOD_MINPERIOD            20
  174. #define DVPLAYBACKVOLUME_DEFAULT            DSBVOLUME_MAX
  175. #define DVRECORDVOLUME_LAST                 0x00000001
  176. //
  177. // Use the default value
  178. //
  179. #define DVTHRESHOLD_DEFAULT               0xFFFFFFFF
  180. //
  181. // Threshold Ranges
  182. //
  183. #define DVTHRESHOLD_MIN                   0x00000000
  184. #define DVTHRESHOLD_MAX                   0x00000063 // 99 decimal
  185. //
  186. // Threshold field is not used 
  187. //
  188. #define DVTHRESHOLD_UNUSED                0xFFFFFFFE
  189. //
  190. // Session Types
  191. //
  192. #define DVSESSIONTYPE_PEER                  0x00000001
  193. #define DVSESSIONTYPE_MIXING                0x00000002
  194. #define DVSESSIONTYPE_FORWARDING            0x00000003
  195. #define DVSESSIONTYPE_ECHO                  0x00000004
  196. /****************************************************************************
  197.  *
  198.  * DirectPlayVoice Flags
  199.  *
  200.  ****************************************************************************/
  201. // 
  202. // Enable automatic adjustment of the recording volume
  203. //
  204. #define DVCLIENTCONFIG_AUTORECORDVOLUME     0x00000008
  205. //
  206. // Enable automatic voice activation
  207. //
  208. #define DVCLIENTCONFIG_AUTOVOICEACTIVATED   0x00000020
  209. // 
  210. // Enable echo suppression
  211. //
  212. #define DVCLIENTCONFIG_ECHOSUPPRESSION      0x08000000
  213. // 
  214. // Voice Activation manual mode
  215. //
  216. #define DVCLIENTCONFIG_MANUALVOICEACTIVATED 0x00000004
  217. // 
  218. // Only playback voices that have buffers created for them
  219. //
  220. #define DVCLIENTCONFIG_MUTEGLOBAL           0x00000010
  221. // 
  222. // Mute the playback
  223. //
  224. #define DVCLIENTCONFIG_PLAYBACKMUTE         0x00000002
  225. //
  226. // Mute the recording 
  227. //
  228. #define DVCLIENTCONFIG_RECORDMUTE           0x00000001
  229. // 
  230. // Complete the operation before returning
  231. //
  232. #define DVFLAGS_SYNC                        0x00000001
  233. // 
  234. // Just check to see if wizard has been run, and if so what it's results were
  235. //
  236. #define DVFLAGS_QUERYONLY                   0x00000002
  237. //
  238. // Shutdown the voice session without migrating the host
  239. //
  240. #define DVFLAGS_NOHOSTMIGRATE               0x00000008
  241. // 
  242. // Allow the back button to be enabled in the wizard
  243. //
  244. #define DVFLAGS_ALLOWBACK                   0x00000010
  245. //
  246. // Disable host migration in the voice session
  247. //
  248. #define DVSESSION_NOHOSTMIGRATION           0x00000001
  249. // 
  250. // Server controlled targetting
  251. //
  252. #define DVSESSION_SERVERCONTROLTARGET       0x00000002
  253. //
  254. // Use DirectSound Normal Mode instead of priority 
  255. //
  256. #define DVSOUNDCONFIG_NORMALMODE            0x00000001
  257. //
  258. // Automatically select the microphone
  259. //
  260. #define DVSOUNDCONFIG_AUTOSELECT            0x00000002
  261. // 
  262. // Run in half duplex mode
  263. //
  264. #define DVSOUNDCONFIG_HALFDUPLEX            0x00000004
  265. // 
  266. // No volume controls are available for the recording device
  267. //
  268. #define DVSOUNDCONFIG_NORECVOLAVAILABLE     0x00000010
  269. // 
  270. // Disable capture sharing
  271. //
  272. #define DVSOUNDCONFIG_NOFOCUS               0x20000000
  273. // 
  274. // Set system conversion quality to high
  275. //
  276. #define DVSOUNDCONFIG_SETCONVERSIONQUALITY 0x00000008
  277. //
  278. // Enable strict focus mode
  279. // 
  280. #define DVSOUNDCONFIG_STRICTFOCUS           0x40000000
  281. //
  282. // Player is in half duplex mode
  283. //
  284. #define DVPLAYERCAPS_HALFDUPLEX             0x00000001
  285. // 
  286. // Specifies that player is the local player
  287. //
  288. #define DVPLAYERCAPS_LOCAL                  0x00000002
  289. /****************************************************************************
  290.  *
  291.  * DirectPlayVoice Structures (Non-Message)
  292.  *
  293.  ****************************************************************************/
  294. //
  295. // DirectPlayVoice Caps
  296. // (GetCaps / SetCaps)
  297. //
  298. typedef struct
  299. {
  300.     DWORD   dwSize;                 // Size of this structure
  301.     DWORD   dwFlags;                // Caps flags
  302. } DVCAPS, *LPDVCAPS, *PDVCAPS;
  303. //
  304. // DirectPlayVoice Client Configuration
  305. // (Connect / GetClientConfig)
  306. //
  307. typedef struct
  308. {
  309.     DWORD   dwSize;                 // Size of this structure
  310.     DWORD   dwFlags;                // Flags for client config (DVCLIENTCONFIG_...)
  311.     LONG    lRecordVolume;          // Recording volume 
  312.     LONG    lPlaybackVolume;        // Playback volume
  313.     DWORD   dwThreshold;          // Voice Activation Threshold
  314.     DWORD   dwBufferQuality;        // Buffer quality
  315.     DWORD   dwBufferAggressiveness; // Buffer aggressiveness
  316.     DWORD   dwNotifyPeriod;         // Period of notification messages (ms)
  317. } DVCLIENTCONFIG, *LPDVCLIENTCONFIG, *PDVCLIENTCONFIG;
  318. //
  319. // DirectPlayVoice Compression Type Information
  320. // (GetCompressionTypes)
  321. //
  322. typedef struct
  323. {
  324.     DWORD   dwSize;                 // Size of this structure
  325.     GUID    guidType;               // GUID that identifies this compression type
  326.     LPWSTR  lpszName;               // String name of this compression type
  327.     LPWSTR  lpszDescription;        // Description for this compression type
  328.     DWORD   dwFlags;                // Flags for this compression type
  329.     DWORD   dwMaxBitsPerSecond; // Maximum # of bit/s this compression type uses
  330. } DVCOMPRESSIONINFO, *LPDVCOMPRESSIONINFO, *PDVCOMPRESSIONINFO;
  331. //
  332. // DirectPlayVoice Session Description
  333. // (Host / GetSessionDesc)
  334. //
  335. typedef struct
  336. {
  337.     DWORD   dwSize;                 // Size of this structure
  338.     DWORD   dwFlags;                // Session flags (DVSESSION_...)
  339.     DWORD   dwSessionType;          // Session type (DVSESSIONTYPE_...)
  340.     GUID    guidCT;                 // Compression Type to use
  341.     DWORD   dwBufferQuality;        // Buffer quality
  342.     DWORD   dwBufferAggressiveness; // Buffer aggresiveness
  343. } DVSESSIONDESC, *LPDVSESSIONDESC, *PDVSESSIONDESC;
  344. // 
  345. // DirectPlayVoice Client Sound Device Configuration
  346. // (Connect / GetSoundDeviceConfig)
  347. //
  348. typedef struct
  349. {
  350.     DWORD                   dwSize;                 // Size of this structure
  351.     DWORD                   dwFlags;                // Flags for sound config (DVSOUNDCONFIG_...)
  352.     GUID                    guidPlaybackDevice;     // GUID of the playback device to use
  353.     LPDIRECTSOUND           lpdsPlaybackDevice;     // DirectSound Object to use (optional)
  354.     GUID                    guidCaptureDevice;      // GUID of the capture device to use
  355.     LPDIRECTSOUNDCAPTURE    lpdsCaptureDevice;      // DirectSoundCapture Object to use (optional)
  356.     HWND                    hwndAppWindow;          // HWND of your application's top-level window
  357.     LPDIRECTSOUNDBUFFER     lpdsMainBuffer;         // DirectSoundBuffer to use for playback (optional)
  358.     DWORD                   dwMainBufferFlags;      // Flags to pass to Play() on the main buffer
  359.     DWORD                   dwMainBufferPriority;   // Priority to set when calling Play() on the main buffer
  360. } DVSOUNDDEVICECONFIG, *LPDVSOUNDDEVICECONFIG, *PDVSOUNDDEVICECONFIG;
  361. /****************************************************************************
  362.  *
  363.  * DirectPlayVoice message handler call back structures
  364.  *
  365.  ****************************************************************************/
  366. //
  367. // Result of the Connect() call.  (If it wasn't called Async)
  368. // (DVMSGID_CONNECTRESULT)
  369. //
  370. typedef struct
  371. {
  372.     DWORD   dwSize;                         // Size of this structure
  373.     HRESULT hrResult;                       // Result of the Connect() call
  374. } DVMSG_CONNECTRESULT, *LPDVMSG_CONNECTRESULT, *PDVMSG_CONNECTRESULT;
  375. //
  376. // A new player has entered the voice session
  377. // (DVMSGID_CREATEVOICEPLAYER)
  378. // 
  379. typedef struct
  380. {
  381.     DWORD   dwSize;                         // Size of this structure
  382.     DVID    dvidPlayer;                     // DVID of the player who joined
  383.     DWORD   dwFlags;                        // Player flags (DVPLAYERCAPS_...)
  384.     PVOID pvPlayerContext;                // Context value for this player (user set)
  385. } DVMSG_CREATEVOICEPLAYER, *LPDVMSG_CREATEVOICEPLAYER, *PDVMSG_CREATEVOICEPLAYER;
  386. //
  387. // A player has left the voice session
  388. // (DVMSGID_DELETEVOICEPLAYER)
  389. //
  390. typedef struct
  391. {
  392.     DWORD   dwSize;                         // Size of this structure
  393.     DVID    dvidPlayer;                     // DVID of the player who left
  394.     PVOID pvPlayerContext;                // Context value for the player
  395. } DVMSG_DELETEVOICEPLAYER, *LPDVMSG_DELETEVOICEPLAYER, *PDVMSG_DELETEVOICEPLAYER;
  396. //
  397. // Result of the Disconnect() call.  (If it wasn't called Async)
  398. // (DVMSGID_DISCONNECTRESULT)
  399. //
  400. typedef struct
  401. {
  402.     DWORD   dwSize;                         // Size of this structure
  403.     HRESULT hrResult;                       // Result of the Disconnect() call
  404. } DVMSG_DISCONNECTRESULT, *LPDVMSG_DISCONNECTRESULT, *PDVMSG_DISCONNECTRESULT;
  405. // 
  406. // The voice session host has migrated.
  407. // (DVMSGID_HOSTMIGRATED) 
  408. //
  409. typedef struct
  410. {
  411.     DWORD                   dwSize;         // Size of this structure
  412.     DVID                    dvidNewHostID;  // DVID of the player who is now the host
  413.     LPDIRECTPLAYVOICESERVER pdvServerInterface;
  414.                                             // Pointer to the new host object (if local player is now host)
  415. } DVMSG_HOSTMIGRATED, *LPDVMSG_HOSTMIGRATED, *PDVMSG_HOSTMIGRATED;
  416. //
  417. // The current input level / recording volume on the local machine
  418. // (DVMSGID_INPUTLEVEL)
  419. //
  420. typedef struct
  421. {
  422.     DWORD   dwSize;                         // Size of this structure
  423.     DWORD   dwPeakLevel;                    // Current peak level of the audio
  424.     LONG    lRecordVolume;                  // Current recording volume
  425.     PVOID pvLocalPlayerContext;           // Context value for the local player
  426. } DVMSG_INPUTLEVEL, *LPDVMSG_INPUTLEVEL, *PDVMSG_INPUTLEVEL;
  427. //
  428. // The local client is about to become the new host
  429. // (DVMSGID_LOCALHOSTSETUP)
  430. //
  431. typedef struct
  432. {
  433. DWORD dwSize;             // Size of this structure
  434. PVOID pvContext; // Context value to be passed to Initialize() of new host object
  435. PDVMESSAGEHANDLER pMessageHandler; // Message handler to be used by new host object
  436. } DVMSG_LOCALHOSTSETUP, *LPDVMSG_LOCALHOSTSETUP, *PDVMSG_LOCALHOSTSETUP;
  437. //
  438. // The current output level for the combined output of all incoming streams.
  439. // (DVMSGID_OUTPUTLEVEL)
  440. //
  441. typedef struct
  442. {
  443.     DWORD   dwSize;                         // Size of this structure
  444.     DWORD   dwPeakLevel;                    // Current peak level of the output
  445.     LONG    lOutputVolume;                  // Current playback volume
  446.     PVOID pvLocalPlayerContext;           // Context value for the local player
  447. } DVMSG_OUTPUTLEVEL, *LPDVMSG_OUTPUTLEVEL, *PDVMSG_OUTPUTLEVEL;
  448. //
  449. // The current peak level of an individual player's incoming audio stream as it is
  450. // being played back.
  451. // (DVMSGID_PLAYEROUTPUTLEVEL)
  452. //
  453. typedef struct
  454. {
  455.     DWORD   dwSize;                         // Size of this structure
  456.     DVID    dvidSourcePlayerID;                   // DVID of the player
  457.     DWORD   dwPeakLevel;                    // Peak level of the player's stream
  458.     PVOID pvPlayerContext;                // Context value for the player
  459. } DVMSG_PLAYEROUTPUTLEVEL, *LPDVMSG_PLAYEROUTPUTLEVEL, *PDVMSG_PLAYEROUTPUTLEVEL;
  460. // 
  461. // An audio stream from the specified player has started playing back on the local client.
  462. // (DVMSGID_PLAYERVOICESTART).
  463. //
  464. typedef struct
  465. {
  466.     DWORD   dwSize;                         // Size of this structure
  467.     DVID    dvidSourcePlayerID;             // DVID of the Player 
  468.     PVOID pvPlayerContext;                // Context value for this player
  469. } DVMSG_PLAYERVOICESTART, *LPDVMSG_PLAYERVOICESTART, *PDVMSG_PLAYERVOICESTART;
  470. //
  471. // The audio stream from the specified player has stopped playing back on the local client.
  472. // (DVMSGID_PLAYERVOICESTOP)
  473. //
  474. typedef struct
  475. {
  476.     DWORD   dwSize;                         // Size of this structure
  477.     DVID    dvidSourcePlayerID;             // DVID of the player
  478.     PVOID pvPlayerContext;                // Context value for this player
  479. } DVMSG_PLAYERVOICESTOP, *LPDVMSG_PLAYERVOICESTOP, *PDVMSG_PLAYERVOICESTOP;
  480. // 
  481. // Transmission has started on the local machine
  482. // (DVMSGID_RECORDSTART)
  483. //
  484. typedef struct
  485. {
  486.     DWORD   dwSize;                         // Size of this structure
  487.     DWORD   dwPeakLevel;                    // Peak level that caused transmission to start
  488.     PVOID pvLocalPlayerContext;           // Context value for the local player
  489. } DVMSG_RECORDSTART, *LPDVMSG_RECORDSTART, *PDVMSG_RECORDSTART;
  490. // 
  491. // Transmission has stopped on the local machine
  492. // (DVMSGID_RECORDSTOP)
  493. // 
  494. typedef struct
  495. {
  496.     DWORD   dwSize;                         // Size of this structure
  497.     DWORD   dwPeakLevel;                    // Peak level that caused transmission to stop
  498.     PVOID pvLocalPlayerContext;           // Context value for the local player
  499. } DVMSG_RECORDSTOP, *LPDVMSG_RECORDSTOP, *PDVMSG_RECORDSTOP;
  500. // 
  501. // The voice session has been lost
  502. // (DVMSGID_SESSIONLOST)
  503. //
  504. typedef struct
  505. {
  506.     DWORD   dwSize;                         // Size of this structure
  507.     HRESULT hrResult;                     // Reason the session was disconnected
  508. } DVMSG_SESSIONLOST, *LPDVMSG_SESSIONLOST, *PDVMSG_SESSIONLOST;
  509. //
  510. // The target list has been updated for the local client
  511. // (DVMSGID_SETTARGETS)
  512. //
  513. typedef struct
  514. {
  515.     DWORD   dwSize;                         // Size of this structure
  516.     DWORD   dwNumTargets;                   // # of targets 
  517.     PDVID   pdvidTargets;                   // An array of DVIDs specifying the current targets
  518. } DVMSG_SETTARGETS, *LPDVMSG_SETTARGETS, *PDVMSG_SETTARGETS;
  519. /****************************************************************************
  520.  *
  521.  * DirectPlayVoice Functions
  522.  *
  523.  ****************************************************************************/
  524. /*
  525.  * 
  526.  * This function is no longer supported.  It is recommended that CoCreateInstance be used to create 
  527.  * DirectPlay voice objects.  
  528.  *
  529.  * extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); 
  530.  *
  531.  */
  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