home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / dsound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  31.8 KB  |  759 lines

  1. /*++
  2.  
  3. Copyright (c) 1995-1997  Microsoft Corporation.  All rights reserved.
  4.  
  5. Module Name: dsound.h
  6.  
  7. Contents: DirectSound include file
  8.  
  9. --*/
  10.  
  11. #ifndef __DSOUND_INCLUDED__
  12. #define __DSOUND_INCLUDED__
  13.  
  14. #undef CreatePalette
  15. #undef GetDC
  16. #undef ReleaseDC
  17.  
  18. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19. // Guard D3DVALUE and D3DVECTOR definition to make dsound.h
  20. // independent of d3dtypes.h
  21. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  22. #ifndef DEFINED_D3DVALUE
  23. #define DEFINED_D3DVALUE
  24. #pragma pack(4)
  25.  
  26. /* D3DVALUE is the fundamental Direct3D fractional data type */
  27.  
  28. #define D3DVALP(val, prec) ((float)(val))
  29. #define D3DVAL(val) ((float)(val))
  30. typedef float D3DVALUE, *LPD3DVALUE;
  31.  
  32. #ifdef DRAGON_NODOUBLEMATH
  33. #define D3DDivide(a, b)    (float)((float) (a) / (float) (b))
  34. #else
  35. #define D3DDivide(a, b)    (float)((double) (a) / (double) (b))
  36. #endif
  37. #define D3DMultiply(a, b)    ((a) * (b))
  38.  
  39. #endif //!DEFINED_D3DVALUE
  40.  
  41. #ifndef DEFINED_D3DVECTOR
  42. #define DEFINED_D3DVECTOR
  43.  
  44. #pragma pack(4)
  45.  
  46. typedef struct _D3DVECTOR {
  47.     union {
  48.     D3DVALUE x;
  49.     D3DVALUE dvX;
  50.     };
  51.     union {
  52.     D3DVALUE y;
  53.     D3DVALUE dvY;
  54.     };
  55.     union {
  56.     D3DVALUE z;
  57.     D3DVALUE dvZ;
  58.     };
  59. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  60.  
  61. public:
  62.  
  63.     // =====================================
  64.     // Constructors
  65.     // =====================================
  66.  
  67.     _D3DVECTOR() { }
  68.     _D3DVECTOR(D3DVALUE f);
  69.     _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z);
  70.     _D3DVECTOR(const D3DVALUE f[3]);
  71.  
  72.     // =====================================
  73.     // Access grants
  74.     // =====================================
  75.  
  76.     const D3DVALUE&operator[](int i) const;
  77.     D3DVALUE&operator[](int i);
  78.  
  79.     // =====================================
  80.     // Assignment operators
  81.     // =====================================
  82.  
  83.     _D3DVECTOR& operator += (const _D3DVECTOR& v);
  84.     _D3DVECTOR& operator -= (const _D3DVECTOR& v);
  85.     _D3DVECTOR& operator *= (const _D3DVECTOR& v);
  86.     _D3DVECTOR& operator /= (const _D3DVECTOR& v);
  87.     _D3DVECTOR& operator *= (D3DVALUE s);
  88.     _D3DVECTOR& operator /= (D3DVALUE s);
  89.  
  90.     // =====================================
  91.     // Unary operators
  92.     // =====================================
  93.  
  94.     friend _D3DVECTOR operator + (const _D3DVECTOR& v);
  95.     friend _D3DVECTOR operator - (const _D3DVECTOR& v);
  96.  
  97.  
  98.     // =====================================
  99.     // Binary operators
  100.     // =====================================
  101.  
  102.     // Addition and subtraction
  103.         friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  104.         friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  105.     // Scalar multiplication and division
  106.         friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s);
  107.         friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v);
  108.         friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s);
  109.     // Memberwise multiplication and division
  110.         friend _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  111.         friend _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  112.  
  113.     // Vector dominance
  114.         friend int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  115.         friend int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  116.  
  117.     // Bitwise equality
  118.         friend int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  119.  
  120.     // Length-related functions
  121.         friend D3DVALUE SquareMagnitude (const _D3DVECTOR& v);
  122.         friend D3DVALUE Magnitude (const _D3DVECTOR& v);
  123.  
  124.     // Returns vector with same direction and unit length
  125.         friend _D3DVECTOR Normalize (const _D3DVECTOR& v);
  126.  
  127.     // Return min/max component of the input vector
  128.         friend D3DVALUE Min (const _D3DVECTOR& v);
  129.         friend D3DVALUE Max (const _D3DVECTOR& v);
  130.  
  131.     // Return memberwise min/max of input vectors
  132.         friend _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  133.         friend _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  134.  
  135.     // Dot and cross product
  136.         friend D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  137.         friend _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  138.  
  139. #endif
  140.  
  141. } D3DVECTOR, *LPD3DVECTOR;
  142.  
  143. #endif // !DEFINED_D3DVECTOR
  144.  
  145. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  146.  
  147. #ifdef _WIN32
  148. #define COM_NO_WINDOWS_H
  149. #include <objbase.h>
  150. #endif
  151.  
  152. #define _FACDS  0x878
  153. #define MAKE_DSHRESULT( code )  MAKE_HRESULT( 1, _FACDS, code )
  154.  
  155. #ifdef __cplusplus
  156. extern "C" {
  157. #endif
  158.  
  159.  
  160. #include "pshpack1.h"   // Assume byte packing throughout
  161.  
  162. #ifndef _WAVEFORMATEX_                // This section added by nigelk
  163. #define _WAVEFORMATEX_
  164. typedef struct
  165. {
  166.     WORD        wFormatTag;         // format type
  167.     WORD        nChannels;          // number of channels (i.e. mono, stereo...)
  168.     DWORD       nSamplesPerSec;     // sample rate
  169.     DWORD       nAvgBytesPerSec;    // for buffer estimation
  170.     WORD        nBlockAlign;        // block size of data
  171.     WORD        wBitsPerSample;     // number of bits per sample of mono data
  172.     WORD        cbSize;             // the count in bytes of the size of
  173.                                     // extra information (after cbSize)
  174. } WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
  175. #endif
  176.  
  177. // Direct Sound Component GUID    {47D4D946-62E8-11cf-93BC-444553540000}
  178. DEFINE_GUID(CLSID_DirectSound,
  179. 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
  180.  
  181. // DirectSound 279afa83-4981-11ce-a521-0020af0be560
  182. DEFINE_GUID(IID_IDirectSound,0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  183. // DirectSoundBuffer 279afa85-4981-11ce-a521-0020af0be560
  184. DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  185.  
  186. //DirectSound3DListener 279afa84-4981-11ce-a521-0020af0be560
  187. DEFINE_GUID(IID_IDirectSound3DListener,0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  188. //DirectSound3DBuffer 279afa86-4981-11ce-a521-0020af0be560
  189. DEFINE_GUID(IID_IDirectSound3DBuffer,0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  190.  
  191. #include "poppack.h"        /* Revert to default packing */
  192.  
  193.  
  194. //==========================================================================;
  195. //
  196. //                            Structures...
  197. //
  198. //==========================================================================;
  199. #ifdef __cplusplus
  200. /* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */
  201. struct IDirectSound;
  202. struct IDirectSoundBuffer;
  203. struct IDirectSound3DListener;
  204. struct IDirectSound3DBuffer;
  205. #endif
  206.  
  207. typedef struct IDirectSound           *LPDIRECTSOUND;
  208. typedef struct IDirectSoundBuffer     *LPDIRECTSOUNDBUFFER;
  209. typedef struct IDirectSoundBuffer    **LPLPDIRECTSOUNDBUFFER;
  210. typedef struct IDirectSound3DListener         *LPDIRECTSOUND3DLISTENER;
  211. typedef struct IDirectSound3DBuffer   *LPDIRECTSOUND3DBUFFER;
  212.  
  213.  
  214. typedef struct _DSCAPS
  215. {
  216.     DWORD       dwSize;
  217.     DWORD       dwFlags;
  218.     DWORD       dwMinSecondarySampleRate;
  219.     DWORD       dwMaxSecondarySampleRate;
  220.     DWORD       dwPrimaryBuffers;
  221.     DWORD       dwMaxHwMixingAllBuffers;
  222.     DWORD       dwMaxHwMixingStaticBuffers;
  223.     DWORD       dwMaxHwMixingStreamingBuffers;
  224.     DWORD       dwFreeHwMixingAllBuffers;
  225.     DWORD       dwFreeHwMixingStaticBuffers;
  226.     DWORD       dwFreeHwMixingStreamingBuffers;
  227.     DWORD       dwMaxHw3DAllBuffers;
  228.     DWORD       dwMaxHw3DStaticBuffers;
  229.     DWORD       dwMaxHw3DStreamingBuffers;
  230.     DWORD       dwFreeHw3DAllBuffers;
  231.     DWORD       dwFreeHw3DStaticBuffers;
  232.     DWORD       dwFreeHw3DStreamingBuffers;
  233.     DWORD       dwTotalHwMemBytes;
  234.     DWORD       dwFreeHwMemBytes;
  235.     DWORD       dwMaxContigFreeHwMemBytes;
  236.     DWORD       dwUnlockTransferRateHwBuffers;
  237.     DWORD       dwPlayCpuOverheadSwBuffers;
  238.     DWORD       dwReserved1;
  239.     DWORD       dwReserved2;
  240. } DSCAPS, *LPDSCAPS;
  241.  
  242. typedef struct _DSBCAPS
  243. {
  244.  
  245.     DWORD       dwSize;
  246.     DWORD       dwFlags;
  247.     DWORD       dwBufferBytes;
  248.     DWORD       dwUnlockTransferRate;
  249.     DWORD       dwPlayCpuOverhead;
  250. } DSBCAPS, *LPDSBCAPS;
  251.  
  252. typedef struct _DSBUFFERDESC
  253. {
  254.     DWORD                   dwSize;
  255.     DWORD                   dwFlags;
  256.     DWORD                   dwBufferBytes;
  257.     DWORD                   dwReserved;
  258.     LPWAVEFORMATEX          lpwfxFormat;
  259. } DSBUFFERDESC, *LPDSBUFFERDESC;
  260.  
  261. typedef struct _DS3DBUFFER
  262. {
  263.     DWORD       dwSize;
  264.     D3DVECTOR   vPosition;
  265.     D3DVECTOR   vVelocity;
  266.     DWORD       dwInsideConeAngle;
  267.     DWORD       dwOutsideConeAngle;
  268.     D3DVECTOR   vConeOrientation;
  269.     LONG        lConeOutsideVolume;
  270.     D3DVALUE    flMinDistance;
  271.     D3DVALUE    flMaxDistance;
  272.     DWORD       dwMode;
  273. } DS3DBUFFER, *LPDS3DBUFFER;
  274.  
  275. typedef struct _DS3DLISTENER
  276. {
  277.     DWORD       dwSize;
  278.     D3DVECTOR   vPosition;
  279.     D3DVECTOR   vVelocity;
  280.     D3DVECTOR   vOrientFront;
  281.     D3DVECTOR   vOrientTop;
  282.     D3DVALUE    flDistanceFactor;
  283.     D3DVALUE    flRolloffFactor;
  284.     D3DVALUE    flDopplerFactor;
  285. } DS3DLISTENER, *LPDS3DLISTENER;
  286.  
  287.  
  288.  
  289. typedef LPVOID* LPLPVOID;
  290.  
  291.  
  292. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID);
  293. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID);
  294.  
  295. extern HRESULT WINAPI DirectSoundCreate(const GUID * lpGUID, LPDIRECTSOUND * ppDS, IUnknown FAR *pUnkOuter );
  296. extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID lpContext );
  297. extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext );
  298.  
  299. #ifdef UNICODE
  300. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKW
  301. #define DirectSoundEnumerate    DirectSoundEnumerateW
  302. #else
  303. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKA
  304. #define DirectSoundEnumerate    DirectSoundEnumerateA
  305. #endif
  306.  
  307. //
  308. // IDirectSound
  309. //
  310. #undef INTERFACE
  311. #define INTERFACE IDirectSound
  312. #ifdef _WIN32
  313. DECLARE_INTERFACE_( IDirectSound, IUnknown )
  314. {
  315.     /*** IUnknown methods ***/
  316.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  317.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  318.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  319.     /*** IDirectSound methods ***/
  320.  
  321.     STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
  322.     STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
  323.     STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
  324.     STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE;
  325.     STDMETHOD( Compact)(THIS ) PURE;
  326.     STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
  327.     STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
  328.     STDMETHOD( Initialize)(THIS_ const GUID * ) PURE;
  329. };
  330.  
  331. #if !defined(__cplusplus) || defined(CINTERFACE)
  332. #define IDirectSound_QueryInterface(p,a,b)       (p)->lpVtbl->QueryInterface(p,a,b)
  333. #define IDirectSound_AddRef(p)                   (p)->lpVtbl->AddRef(p)
  334. #define IDirectSound_Release(p)                  (p)->lpVtbl->Release(p)
  335. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
  336. #define IDirectSound_GetCaps(p,a)                (p)->lpVtbl->GetCaps(p,a)
  337. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
  338. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->lpVtbl->SetCooperativeLevel(p,a,b)
  339. #define IDirectSound_Compact(p)                  (p)->lpVtbl->Compact(p)
  340. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->lpVtbl->GetSpeakerConfig(p,a)
  341. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->lpVtbl->SetSpeakerConfig(p,b)
  342. #define IDirectSound_Initialize(p,a)             (p)->lpVtbl->Initialize(p,a)
  343. #else
  344. #define IDirectSound_QueryInterface(p,a,b)       (p)->QueryInterface(a,b)
  345. #define IDirectSound_AddRef(p)                   (p)->AddRef()
  346. #define IDirectSound_Release(p)                  (p)->Release()
  347. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->CreateSoundBuffer(a,b,c)
  348. #define IDirectSound_GetCaps(p,a)                (p)->GetCaps(a)
  349. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b)
  350. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->SetCooperativeLevel(a,b)
  351. #define IDirectSound_Compact(p)                  (p)->Compact()
  352. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->GetSpeakerConfig(a)
  353. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->SetSpeakerConfig(b)
  354. #define IDirectSound_Initialize(p,a)             (p)->Initialize(a)
  355. #endif
  356.  
  357. #endif
  358.  
  359. //
  360. // IDirectSoundBuffer
  361. //
  362. #undef INTERFACE
  363. #define INTERFACE IDirectSoundBuffer
  364. #ifdef _WIN32
  365. DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
  366. {
  367.     /*** IUnknown methods ***/
  368.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  369.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  370.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  371.     /*** IDirectSoundBuffer methods ***/
  372.  
  373.     STDMETHOD(           GetCaps)(THIS_ LPDSBCAPS ) PURE;
  374.     STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
  375.     STDMETHOD(         GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
  376.     STDMETHOD(         GetVolume)(THIS_ LPLONG ) PURE;
  377.     STDMETHOD(            GetPan)(THIS_ LPLONG ) PURE;
  378.     STDMETHOD(      GetFrequency)(THIS_ LPDWORD ) PURE;
  379.     STDMETHOD(         GetStatus)(THIS_ LPDWORD ) PURE;
  380.     STDMETHOD(        Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
  381.     STDMETHOD(              Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
  382.     STDMETHOD(              Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
  383.     STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
  384.     STDMETHOD(         SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
  385.     STDMETHOD(         SetVolume)(THIS_ LONG ) PURE;
  386.     STDMETHOD(            SetPan)(THIS_ LONG ) PURE;
  387.     STDMETHOD(      SetFrequency)(THIS_ DWORD ) PURE;
  388.     STDMETHOD(              Stop)(THIS  ) PURE;
  389.     STDMETHOD(            Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
  390.     STDMETHOD(           Restore)(THIS  ) PURE;
  391. };
  392.  
  393. #if !defined(__cplusplus) || defined(CINTERFACE)
  394. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
  395. #define IDirectSoundBuffer_AddRef(p)                    (p)->lpVtbl->AddRef(p)
  396. #define IDirectSoundBuffer_Release(p)                   (p)->lpVtbl->Release(p)
  397. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->lpVtbl->GetCaps(p,a)
  398. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->lpVtbl->GetCurrentPosition(p,a,b)
  399. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->lpVtbl->GetFormat(p,a,b,c)
  400. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->lpVtbl->GetVolume(p,a)
  401. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->lpVtbl->GetPan(p,a)
  402. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->lpVtbl->GetFrequency(p,a)
  403. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->lpVtbl->GetStatus(p,a)
  404. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->lpVtbl->Initialize(p,a,b)
  405. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
  406. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->lpVtbl->Play(p,a,b,c)
  407. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->lpVtbl->SetCurrentPosition(p,a)
  408. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->lpVtbl->SetFormat(p,a)
  409. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->lpVtbl->SetVolume(p,a)
  410. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->lpVtbl->SetPan(p,a)
  411. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->lpVtbl->SetFrequency(p,a)
  412. #define IDirectSoundBuffer_Stop(p)                      (p)->lpVtbl->Stop(p)
  413. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->lpVtbl->Unlock(p,a,b,c,d)
  414. #define IDirectSoundBuffer_Restore(p)                   (p)->lpVtbl->Restore(p)
  415. #else
  416. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->QueryInterface(a,b)
  417. #define IDirectSoundBuffer_AddRef(p)                    (p)->AddRef()
  418. #define IDirectSoundBuffer_Release(p)                   (p)->Release()
  419. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->GetCaps(a)
  420. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->GetCurrentPosition(a,b)
  421. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->GetFormat(a,b,c)
  422. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->GetVolume(a)
  423. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->GetPan(a)
  424. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->GetFrequency(a)
  425. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->GetStatus(a)
  426. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->Initialize(a,b)
  427. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->Lock(a,b,c,d,e,f,g)
  428. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->Play(a,b,c)
  429. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->SetCurrentPosition(a)
  430. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->SetFormat(a)
  431. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->SetVolume(a)
  432. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->SetPan(a)
  433. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->SetFrequency(a)
  434. #define IDirectSoundBuffer_Stop(p)                      (p)->Stop()
  435. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->Unlock(a,b,c,d)
  436. #define IDirectSoundBuffer_Restore(p)                   (p)->Restore()
  437. #endif
  438.  
  439. #endif
  440.  
  441. //
  442. // IDirectSound3DListener
  443. //
  444. #undef INTERFACE
  445. #define INTERFACE IDirectSound3DListener
  446. #ifdef _WIN32
  447. DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown)
  448. {
  449.     /*** IUnknown methods ***/
  450.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  451.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  452.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  453.  
  454.     /*** IDirectSound3D methods ***/
  455.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DLISTENER) PURE;
  456.     STDMETHOD(GetDistanceFactor)(THIS_ LPD3DVALUE) PURE;
  457.     STDMETHOD(GetDopplerFactor)(THIS_ LPD3DVALUE) PURE;
  458.     STDMETHOD(GetOrientation)(THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE;
  459.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  460.     STDMETHOD(GetRolloffFactor)(THIS_ LPD3DVALUE ) PURE;
  461.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  462.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DLISTENER, DWORD) PURE;
  463.     STDMETHOD(SetDistanceFactor)(THIS_ D3DVALUE, DWORD) PURE;
  464.     STDMETHOD(SetDopplerFactor)(THIS_ D3DVALUE, DWORD) PURE;
  465.     STDMETHOD(SetOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  466.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  467.     STDMETHOD(SetRolloffFactor)(THIS_ D3DVALUE, DWORD) PURE;
  468.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  469.     STDMETHOD(CommitDeferredSettings)(THIS) PURE;
  470. };
  471.  
  472. #if !defined(__cplusplus) || defined(CINTERFACE)
  473. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->lpVtbl->QueryInterface(p,a,b)
  474. #define IDirectSound3DListener_AddRef(p)                        (p)->lpVtbl->AddRef(p)
  475. #define IDirectSound3DListener_Release(p)                       (p)->lpVtbl->Release(p)
  476. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->lpVtbl->GetAllParameters(p,a)
  477. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->lpVtbl->GetDistanceFactor(p,a)
  478. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->lpVtbl->GetDopplerFactor(p,a)
  479. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->lpVtbl->GetOrientation(p,a,b)
  480. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->lpVtbl->GetPosition(p,a)
  481. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->lpVtbl->GetRolloffFactor(p,a)
  482. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->lpVtbl->GetVelocity(p,a)
  483. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->lpVtbl->SetAllParameters(p,a,b)
  484. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->lpVtbl->SetDistanceFactor(p,a,b)
  485. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->lpVtbl->SetDopplerFactor(p,a,b)
  486. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g)
  487. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->lpVtbl->SetPosition(p,a,b,c,d)
  488. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->lpVtbl->SetRolloffFactor(p,a,b)
  489. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  490. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->lpVtbl->CommitDeferredSettings(p)
  491. #else
  492. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->QueryInterface(a,b)
  493. #define IDirectSound3DListener_AddRef(p)                        (p)->AddRef()
  494. #define IDirectSound3DListener_Release(p)                       (p)->Release()
  495. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->GetAllParameters(a)
  496. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->GetDistanceFactor(a)
  497. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->GetDopplerFactor(a)
  498. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->GetOrientation(a,b)
  499. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->GetPosition(a)
  500. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->GetRolloffFactor(a)
  501. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->GetVelocity(a)
  502. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->SetAllParameters(a,b)
  503. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->SetDistanceFactor(a,b)
  504. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->SetDopplerFactor(a,b)
  505. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->SetOrientation(a,b,c,d,e,f,g)
  506. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->SetPosition(a,b,c,d)
  507. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->SetRolloffFactor(a,b)
  508. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->SetVelocity(a,b,c,d)
  509. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->CommitDeferredSettings()
  510. #endif
  511.  
  512. #endif
  513.  
  514. //
  515. // IDirectSound3DBuffer
  516. //
  517. #undef INTERFACE
  518. #define INTERFACE IDirectSound3DBuffer
  519. #ifdef _WIN32
  520. DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown)
  521. {
  522.     /*** IUnknown methods ***/
  523.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  524.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  525.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  526.  
  527.     /*** IDirectSoundBuffer3D methods ***/
  528.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DBUFFER) PURE;
  529.     STDMETHOD(GetConeAngles)(THIS_ LPDWORD, LPDWORD) PURE;
  530.     STDMETHOD(GetConeOrientation)(THIS_ LPD3DVECTOR) PURE;
  531.     STDMETHOD(GetConeOutsideVolume)(THIS_ LPLONG) PURE;
  532.     STDMETHOD(GetMaxDistance)(THIS_ LPD3DVALUE) PURE;
  533.     STDMETHOD(GetMinDistance)(THIS_ LPD3DVALUE) PURE;
  534.     STDMETHOD(GetMode)(THIS_ LPDWORD) PURE;
  535.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  536.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  537.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DBUFFER, DWORD) PURE;
  538.     STDMETHOD(SetConeAngles)(THIS_ DWORD, DWORD, DWORD) PURE;
  539.     STDMETHOD(SetConeOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  540.     STDMETHOD(SetConeOutsideVolume)(THIS_ LONG, DWORD) PURE;
  541.     STDMETHOD(SetMaxDistance)(THIS_ D3DVALUE, DWORD) PURE;
  542.     STDMETHOD(SetMinDistance)(THIS_ D3DVALUE, DWORD) PURE;
  543.     STDMETHOD(SetMode)(THIS_ DWORD, DWORD) PURE;
  544.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  545.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  546. };
  547.  
  548. #if !defined(__cplusplus) || defined(CINTERFACE)
  549. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->lpVtbl->QueryInterface(p,a,b)
  550. #define IDirectSound3DBuffer_AddRef(p)                  (p)->lpVtbl->AddRef(p)
  551. #define IDirectSound3DBuffer_Release(p)                 (p)->lpVtbl->Release(p)
  552. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->lpVtbl->GetAllParameters(p,a)
  553. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->lpVtbl->GetConeAngles(p,a,b)
  554. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->lpVtbl->GetConeOrientation(p,a)
  555. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->lpVtbl->GetConeOutsideVolume(p,a)
  556. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->lpVtbl->GetPosition(p,a)
  557. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->lpVtbl->GetMinDistance(p,a)
  558. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->lpVtbl->GetMaxDistance(p,a)
  559. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->lpVtbl->GetMode(p,a)
  560. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->lpVtbl->GetVelocity(p,a)
  561. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->lpVtbl->SetAllParameters(p,a,b)
  562. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->lpVtbl->SetConeAngles(p,a,b,c)
  563. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d)
  564. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b)
  565. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->lpVtbl->SetPosition(p,a,b,c,d)
  566. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->lpVtbl->SetMinDistance(p,a,b)
  567. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->lpVtbl->SetMaxDistance(p,a,b)
  568. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->lpVtbl->SetMode(p,a,b)
  569. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  570. #else
  571. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->QueryInterface(a,b)
  572. #define IDirectSound3DBuffer_AddRef(p)                  (p)->AddRef()
  573. #define IDirectSound3DBuffer_Release(p)                 (p)->Release()
  574. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->GetAllParameters(a)
  575. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->GetConeAngles(a,b)
  576. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->GetConeOrientation(a)
  577. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->GetConeOutsideVolume(a)
  578. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->GetPosition(a)
  579. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->GetMinDistance(a)
  580. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->GetMaxDistance(a)
  581. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->GetMode(a)
  582. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->GetVelocity(a)
  583. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->SetAllParameters(a,b)
  584. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->SetConeAngles(a,b,c)
  585. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d)
  586. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b)
  587. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->SetPosition(a,b,c,d)
  588. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->SetMinDistance(a,b)
  589. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->SetMaxDistance(a,b)
  590. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->SetMode(a,b)
  591. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->SetVelocity(a,b,c,d)
  592. #endif
  593.  
  594. #endif
  595.  
  596.  
  597. /*
  598.  * Return Codes
  599.  */
  600.  
  601. #define DS_OK                           0
  602.  
  603. /*
  604.  * The call failed because resources (such as a priority level)
  605.  *  were already being used by another caller.
  606.  */
  607. #define DSERR_ALLOCATED                 MAKE_DSHRESULT( 10 )
  608. /*
  609.  * The control (vol,pan,etc.) requested by the caller is not available.
  610.  */
  611. #define DSERR_CONTROLUNAVAIL            MAKE_DSHRESULT( 30 )
  612. /*
  613.  * An invalid parameter was passed to the returning function
  614.  */
  615. #define DSERR_INVALIDPARAM              E_INVALIDARG
  616. /*
  617.  * This call is not valid for the current state of this object
  618.  */
  619. #define DSERR_INVALIDCALL               MAKE_DSHRESULT( 50 )
  620. /*
  621.  * An undetermined error occured inside the DSound subsystem
  622.  */
  623. #define DSERR_GENERIC                   E_FAIL
  624. /*
  625.  * The caller does not have the priority level required for the function to
  626.  * succeed.
  627.  */
  628. #define DSERR_PRIOLEVELNEEDED           MAKE_DSHRESULT( 70 )
  629. /*
  630.  * The DSound subsystem couldn't allocate sufficient memory to complete the
  631.  * caller's request.
  632.  */
  633. #define DSERR_OUTOFMEMORY               E_OUTOFMEMORY
  634. /*
  635.  * The specified WAVE format is not supported
  636.  */
  637. #define DSERR_BADFORMAT                 MAKE_DSHRESULT( 100 )
  638. /*
  639.  * The function called is not supported at this time
  640.  */
  641. #define DSERR_UNSUPPORTED               E_NOTIMPL
  642. /*
  643.  * No sound driver is available for use
  644.  */
  645. #define DSERR_NODRIVER                  MAKE_DSHRESULT( 120 )
  646. /*
  647.  * This object is already initialized
  648.  */
  649. #define DSERR_ALREADYINITIALIZED        MAKE_DSHRESULT( 130 )
  650. /*
  651.  * This object does not support aggregation
  652.  */
  653. #define DSERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
  654. /*
  655.  * The buffer memory has been lost, and must be Restored.
  656.  */
  657. #define DSERR_BUFFERLOST                MAKE_DSHRESULT( 150 )
  658. /*
  659.  * Another app has a higher priority level, preventing this call from
  660.  * succeeding.
  661.  */
  662. #define DSERR_OTHERAPPHASPRIO           MAKE_DSHRESULT( 160 )
  663. /*
  664.  * The Initialize() member on the Direct Sound Object has not been
  665.  * called or called successfully before calls to other members.
  666.  */
  667. #define DSERR_UNINITIALIZED             MAKE_DSHRESULT( 170 )
  668.  
  669.  
  670.  
  671.  
  672. //==========================================================================;
  673. //
  674. //                               Flags...
  675. //
  676. //==========================================================================;
  677.  
  678. #define DSCAPS_PRIMARYMONO          0x00000001
  679. #define DSCAPS_PRIMARYSTEREO        0x00000002
  680. #define DSCAPS_PRIMARY8BIT          0x00000004
  681. #define DSCAPS_PRIMARY16BIT         0x00000008
  682. #define DSCAPS_CONTINUOUSRATE       0x00000010
  683. #define DSCAPS_EMULDRIVER           0x00000020
  684. #define DSCAPS_CERTIFIED            0x00000040
  685. #define DSCAPS_SECONDARYMONO        0x00000100
  686. #define DSCAPS_SECONDARYSTEREO      0x00000200
  687. #define DSCAPS_SECONDARY8BIT        0x00000400
  688. #define DSCAPS_SECONDARY16BIT       0x00000800
  689.  
  690.  
  691.  
  692. #define DSBPLAY_LOOPING                 0x00000001
  693.  
  694.  
  695. #define DSBSTATUS_PLAYING           0x00000001
  696. #define DSBSTATUS_BUFFERLOST        0x00000002
  697. #define DSBSTATUS_LOOPING           0x00000004
  698.  
  699.  
  700. #define DSBLOCK_FROMWRITECURSOR         0x00000001
  701.  
  702.  
  703.  
  704. #define DSSCL_NORMAL                1
  705. #define DSSCL_PRIORITY              2
  706. #define DSSCL_EXCLUSIVE             3
  707. #define DSSCL_WRITEPRIMARY          4
  708.  
  709.  
  710.  
  711. // flags for IDirectSound3DBuffer::SetMode
  712. #define DS3DMODE_NORMAL         0       // default must be 0
  713. #define DS3DMODE_HEADRELATIVE   1
  714. #define DS3DMODE_DISABLE        2
  715.  
  716. // flags for dwApply parameter of some 3D functions
  717. #define DS3D_IMMEDIATE          0
  718. #define DS3D_DEFERRED           1
  719.  
  720. // default values for 3d factors
  721. #define DS3D_DEFAULTDISTANCEFACTOR      1.0f
  722. #define DS3D_DEFAULTROLLOFFFACTOR       1.0f
  723. #define DS3D_DEFAULTDOPPLERFACTOR       1.0f
  724.  
  725. #define DSBCAPS_PRIMARYBUFFER       0x00000001
  726. #define DSBCAPS_STATIC              0x00000002
  727. #define DSBCAPS_LOCHARDWARE         0x00000004
  728. #define DSBCAPS_LOCSOFTWARE         0x00000008
  729. #define DSBCAPS_CTRL3D              0x00000010
  730. #define DSBCAPS_CTRLFREQUENCY       0x00000020
  731. #define DSBCAPS_CTRLPAN             0x00000040
  732. #define DSBCAPS_CTRLVOLUME          0x00000080
  733. #define DSBCAPS_CTRLDEFAULT         0x000000E0  // Pan + volume + frequency.
  734. #define DSBCAPS_CTRLALL             0x000000F0  // All control capabilities
  735. #define DSBCAPS_STICKYFOCUS         0x00004000
  736. #define DSBCAPS_GLOBALFOCUS         0x00008000
  737. #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  // More accurate play cursor under emulation
  738.  
  739.  
  740.  
  741.  
  742. #define DSSPEAKER_HEADPHONE     1
  743. #define DSSPEAKER_MONO          2
  744. #define DSSPEAKER_QUAD          3
  745. #define DSSPEAKER_STEREO        4
  746. #define DSSPEAKER_SURROUND      5
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753. #ifdef __cplusplus
  754. };
  755. #endif
  756.  
  757. #endif  /* __DSOUND_INCLUDED__ */
  758.  
  759.