]> icculus.org git repositories - taylor/freespace2.git/blob - include/ia3d.h
Initial revision
[taylor/freespace2.git] / include / ia3d.h
1 /*---------------------------------------------------------------------
2  *
3  * ia3d.h
4  *
5  *---------------------------------------------------------------------
6  *
7  * $Id$
8  *
9  *---------------------------------------------------------------------
10  *
11  * ia3d header file.  It's the part the outside world needs to see.
12  *
13  *---------------------------------------------------------------------
14  *
15  * AUREAL SEMICONDUCTOR, INC. PROPRIETARY AND CONFIDENTIAL
16  * Copyright (c) 1996 Aureal Semiconductor, Inc. - All rights 
17  * reserved. 
18  *
19  *---------------------------------------------------------------------
20  */
21
22
23 #ifndef _IA3D_H_
24 #define _IA3D_H_
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30
31 // A3d Class ID! {D8F1EEE0-F634-11cf-8700-00A0245D918B}
32 DEFINE_GUID(CLSID_A3d, 
33 0xd8f1eee0, 0xf634, 0x11cf, 0x87, 0x0, 0x0, 0xa0, 0x24, 0x5d, 0x91, 0x8b);
34
35 // A3d Interface ID! {D8F1EEE1-F634-11cf-8700-00A0245D918B}
36 DEFINE_GUID(IID_IA3d,
37 0xd8f1eee1, 0xf634, 0x11cf, 0x87, 0x0, 0x0, 0xa0, 0x24, 0x5d, 0x91, 0x8b);
38
39 // GUID generated from UUGENID.EXE, Good until the year 3400 AD
40 // A3d Interface ID! {fb80d1e0-98d3-11d1-90fb-006008a1f441}
41 DEFINE_GUID(IID_IA3d2,
42 0xfb80d1e0, 0x98d3, 0x11d1, 0x90, 0xfb, 0x00, 0x60, 0x08, 0xa1, 0xf4, 0x41);
43
44 // Bits for manipulating output modes
45
46 // Values for bOutputMode
47 #define OUTPUT_MODE_STEREO      0x00000001
48 #define OUTPUT_MODE_QUAD        0x00000002
49
50 // Values for FrontXtalkMode and bRearXtalkMode
51 #define OUTPUT_HEADPHONES               0x00000001    // headphones
52 #define OUTPUT_SPEAKERS_WIDE    0x00000002
53 #define OUTPUT_SPEAKERS_NARROW  0x00000003
54
55 // Values for Resource Management Mode
56 #define A3D_RESOURCE_MODE_OFF                           0x00000000
57 #define A3D_RESOURCE_MODE_NOTIFY                        0x00000001
58 #define A3D_RESOURCE_MODE_DYNAMIC               0x00000002
59 #define A3D_RESOURCE_MODE_DYNAMIC_LOOPERS       0x00000003
60 #define A3D_RESOURCE_MODE_LAST                          0x00000003
61
62
63 // Version Definitions for A3DCAPS 
64
65 #define A3D_CURRENT_VERSION     IA3DVERSION_RELEASE12
66
67 #define IA3DVERSION_RELEASE10   10
68 #define IA3DVERSION_RELEASE12   12
69
70 // A3d Caps structure for A3d2 interface
71 // If Fail to get IA3d2 interface, version of DLL is IA3DVERSION_PRE12
72
73 typedef  struct __A3DCAPS_SOFTWARE
74 {
75    DWORD        dwSize;         // Use for internal version control
76    DWORD        dwVersion;              // For Backwards capablities purposes
77    DWORD        dwFlags;
78    DWORD        dwReserved;
79    DWORD        dwReserved2;
80 }  A3DCAPS_SOFTWARE, *LPA3DCAPS_SOFTWARE;
81
82 typedef  struct __A3DCAPS_HARDWARE
83 {
84    DWORD        dwSize;         // Use for internal version control
85    DWORD        dwFlags;
86    DWORD        dwReserved;
87    DWORD        dwReserved2;
88 }  A3DCAPS_HARDWARE, *LPA3DCAPS_HARDWARE;
89
90
91 // Declare the IA3d Interface.  It's not very complex at all.
92
93 #undef INTERFACE
94 #define INTERFACE IA3d
95
96 typedef struct IA3d *LPIA3D;
97
98 DECLARE_INTERFACE_(IA3d, IUnknown)
99 {
100     // IUnknown 
101     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
102     STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
103     STDMETHOD_(ULONG,Release) (THIS) PURE;
104
105     // IA3d
106     STDMETHOD(SetOutputMode)(THIS_ DWORD    dwFrontXtalkMode, DWORD    dwBackXtalkMode, DWORD    dwQuadMode) PURE;
107     STDMETHOD(GetOutputMode)(THIS_ DWORD *lpdwFrontXtalkMode, DWORD *lpdwBackXtalkMode, DWORD *lpdwQuadMode) PURE;
108
109         STDMETHOD(SetResourceManagerMode) (THIS_ DWORD  ) PURE;
110         STDMETHOD(GetResourceManagerMode) (THIS_ DWORD *) PURE;
111
112         STDMETHOD(SetHFAbsorbFactor)(THIS_ FLOAT  ) PURE;
113     STDMETHOD(GetHFAbsorbFactor)(THIS_ FLOAT *) PURE;
114
115 };
116
117
118 // IA3d2 interface derived from IA3d
119
120 #undef INTERFACE
121 #define INTERFACE IA3d2
122
123 typedef struct IA3d2 *LPIA3D2;
124
125 DECLARE_INTERFACE_(IA3d2, IUnknown)
126 {
127     // IUnknown 
128     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
129     STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
130     STDMETHOD_(ULONG,Release) (THIS) PURE;
131
132     // IA3d
133     STDMETHOD(SetOutputMode)(THIS_ DWORD    dwFrontXtalkMode, DWORD    dwBackXtalkMode, DWORD    dwQuadMode) PURE;
134     STDMETHOD(GetOutputMode)(THIS_ DWORD *lpdwFrontXtalkMode, DWORD *lpdwBackXtalkMode, DWORD *lpdwQuadMode) PURE;
135
136         STDMETHOD(SetResourceManagerMode) (THIS_ DWORD  ) PURE;
137         STDMETHOD(GetResourceManagerMode) (THIS_ DWORD *) PURE;
138
139         STDMETHOD(SetHFAbsorbFactor)(THIS_ FLOAT  ) PURE;
140     STDMETHOD(GetHFAbsorbFactor)(THIS_ FLOAT *) PURE;
141
142     // New Methods inaddition to old ones
143     STDMETHOD(RegisterVersion) (THIS_ DWORD dwVersionNr) PURE;   
144     STDMETHOD(GetSoftwareCaps) (THIS_ LPA3DCAPS_SOFTWARE lpCaps) PURE;
145     STDMETHOD(GetHardwareCaps) (THIS_ LPA3DCAPS_HARDWARE lpCaps) PURE;
146 };
147
148
149 // The library function that gets things going.  It returns an interface
150 // pointer to DirectSound.
151
152 #define A3D_OK                  1           // A3dCreate returns this upon detection of A3D Dll.
153 #define A3D_OK_OLD_DLL  2           // A3dCreate returns this upon detection of A3D Dll but user's version is older than expected.
154
155 // Usefull Macros for C folks.
156
157 #if !defined(__cplusplus) || defined(CINTERFACE)
158 #define IA3d_QueryInterface(p,a,b)                      (p)->lpVtbl->QueryInterface(p,a,b)
159 #define IA3d_AddRef(p)                                          (p)->lpVtbl->AddRef(p)
160 #define IA3d_Release(p)                                         (p)->lpVtbl->Release(p)
161 #define IA3d_SetOutputMode(p,a,b,c)                     (p)->lpVtbl->SetOutputMode(p,a,b,c)
162 #define IA3d_GetOutputMode(p,a,b,c)                     (p)->lpVtbl->GetOutputMode(p,a,b,c)
163 #define IA3d_SetResourceManagerMode(p,a)        (p)->lpVtbl->SetResourceManagerMode(p,a)
164 #define IA3d_GetResourceManagerMode(p,a)        (p)->lpVtbl->GetResourceManagerMode(p,a)
165 #define IA3d_SetHFAbsorbFactor(p,a)                     (p)->lpVtbl->SetHFAbsorbFactor(p,a)
166 #define IA3d_GetHFAbsorbFactor(p,a)                     (p)->lpVtbl->GetHFAbsorbFactor(p,a)
167
168 // C function def
169 #define IA3d2_QueryInterface(p,a,b)                     (p)->lpVtbl->QueryInterface(p,a,b)
170 #define IA3d2_AddRef(p)                                         (p)->lpVtbl->AddRef(p)
171 #define IA3d2_Release(p)                                        (p)->lpVtbl->Release(p)
172 #define IA3d2_SetOutputMode(p,a,b,c)            (p)->lpVtbl->SetOutputMode(p,a,b,c)
173 #define IA3d2_GetOutputMode(p,a,b,c)            (p)->lpVtbl->GetOutputMode(p,a,b,c)
174 #define IA3d2_SetResourceManagerMode(p,a)       (p)->lpVtbl->SetResourceManagerMode(p,a)
175 #define IA3d2_GetResourceManagerMode(p,a)       (p)->lpVtbl->GetResourceManagerMode(p,a)
176 #define IA3d2_SetHFAbsorbFactor(p,a)            (p)->lpVtbl->SetHFAbsorbFactor(p,a)
177 #define IA3d2_GetHFAbsorbFactor(p,a)            (p)->lpVtbl->GetHFAbsorbFactor(p,a)
178 #define IA3d2_RegisterVersion(p,a)                      (p)->lpVtbl->RegisterVersion(p,a)
179 #define IA3d2_GetSoftwareCaps(p,a)                      (p)->lpVtbl->GetSoftwareCaps(p,a)
180 #define IA3d2_GetHardwareCaps(p,a)                      (p)->lpVtbl->GetHardwareCaps(p,a)
181     
182 #else                                                                           
183 #define IA3d_QueryInterface(p,a,b)                      (p)->QueryInterface(a,b)
184 #define IA3d_AddRef(p)                                          (p)->AddRef()
185 #define IA3d_Release(p)                                         (p)->Release()
186 #define IA3d_SetOutputMode(p,a,b,c)                     (p)->SetOutputMode(a,b,c)
187 #define IA3d_GetOutputMode(p,a,b,c)                     (p)->GetOutputMode(a,b,c)
188 #define IA3d_SetResourceManagerMode(p,a)        (p)->SetResourceManagerMode(a)
189 #define IA3d_GetResourceManagerMode(p,a)        (p)->GetResourceManagerMode(a)
190 #define IA3d_SetHFAbsorbFactor(p,a)                     (p)->SetHFAbsorbFactor(a)
191 #define IA3d_GetHFAbsorbFactor(p,a)                     (p)->GetHFAbsorbFactor(a)
192
193 // C++ function def
194 #define IA3d2_QueryInterface(p,a,b)                     (p)->QueryInterface(a,b)
195 #define IA3d2_AddRef(p)                                         (p)->AddRef()
196 #define IA3d2_Release(p)                                        (p)->Release()
197 #define IA3d2_SetOutputMode(p,a,b,c)            (p)->SetOutputMode(a,b,c)
198 #define IA3d2_GetOutputMode(p,a,b,c)            (p)->GetOutputMode(a,b,c)
199 #define IA3d2_SetResourceManagerMode(p,a)       (p)->SetResourceManagerMode(a)
200 #define IA3d2_GetResourceManagerMode(p,a)       (p)->GetResourceManagerMode(a)
201 #define IA3d2_SetHFAbsorbFactor(p,a)            (p)->SetHFAbsorbFactor(a)
202 #define IA3d2_GetHFAbsorbFactor(p,a)            (p)->GetHFAbsorbFactor(a)
203 #define IA3d2_RegisterVersion(p,a)                      (p)->RegisterVersion(a)
204 #define IA3d2_GetSoftwareCaps(p,a)                      (p)->GetSoftwareCaps(a)
205 #define IA3d2_GetHardwareCaps(p,a)                      (p)->GetHardwareCaps(a)
206
207 #endif
208
209 // Convenience Macro A3D_REGISTER_VERSION()
210 // Register version for backwards compatibility
211 // Pass in any COM object from CLSID_A3d
212
213 #if !defined(__cplusplus) || defined(CINTERFACE)
214 #define A3D_UNKNOWN_QI(pU,I,ppI)        (SUCCEEDED((pU)->lpVtbl->QueryInterface(pU,&I,ppI)))
215 #else
216 #define A3D_UNKNOWN_QI(pU,I,ppI)        (SUCCEEDED((pU)->QueryInterface(I,ppI)))
217 #endif
218
219 #define A3D_REGISTER_VERSION(p)                                                         \
220 {                                                                                                                       \
221  LPIA3D2         __pIA3d2__=NULL;                                                       \
222  IUnknown       *__pU__ = (IUnknown *)p;                                        \
223                                                                                                                         \
224  if (p)                                                                                                         \
225  {                                                                                                                      \
226   if (A3D_UNKNOWN_QI(__pU__,IID_IA3d2,(void **)&__pIA3d2__))\
227   {                                                                                                                     \
228    IA3d2_RegisterVersion(__pIA3d2__,A3D_CURRENT_VERSION);       \
229    IA3d2_Release(__pIA3d2__);                                                           \
230   }                                                                                                                     \
231  }                                                                                                                      \
232                                                                                                                         \
233 }
234
235 // Helper functions in ia3d.lib
236
237 extern HRESULT WINAPI A3dInitialize(void);
238
239 extern void    WINAPI A3dUninitialize(void);
240
241 extern HRESULT WINAPI A3dCreate(GUID * lpGUID,                          /* in,  Prefered Driver Guid, NULL ok */
242                                                  void **ppDS,                           /* out, Direct Sound pointer */
243                                                  IUnknown FAR *pUnkOuter);      /* in,  Outer COM object, for Aggregate only NULL oK */
244
245 #ifdef __cplusplus
246 };
247 #endif
248
249 #endif // _IA3D_H_
250