-
Notifications
You must be signed in to change notification settings - Fork 4
/
IDirectSound3DBufferEx.cpp
executable file
·351 lines (266 loc) · 11.2 KB
/
IDirectSound3DBufferEx.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
//////////////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003-2007, Arne Bockholdt, [email protected]
//
// This file is part of Direct Sound Control.
//
// Direct Sound Control is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Direct Sound Control is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Direct Sound Control. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "idirectsound3dBufferex.h"
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound3DBuffer8Ex::IDirectSound3DBuffer8Ex(void)
{
m_lpDirectSound3DBuffer8 = NULL;
#ifdef ENABLE_LOG
m_cszClassName = IDIRECTSOUND3DBUFFER8EX_CLASS_NAME;
if( g_bLogDirectSound3DBuffer == true )
::LogMessage( m_cszClassName, this, "Constructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound3DBuffer8Ex::~IDirectSound3DBuffer8Ex(void)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
::LogMessage( m_cszClassName, this, "Destructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::QueryInterface( REFIID refIID, LPVOID * pVoid )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
::LogMessage( m_cszClassName, this, "QueryInterface called....");
#endif // ENABLE_LOG
*pVoid = (LPVOID) NULL;
HRESULT hRes;
if(( refIID == IID_IDirectSound3DBuffer ) || ( refIID == IID_IDirectSound3DBuffer8 ))
{
LPVOID pTemp;
hRes = m_lpDirectSound3DBuffer8->QueryInterface( refIID, &pTemp );
if( hRes == S_OK )
{
m_lpDirectSound3DBuffer8 = (LPDIRECTSOUND3DBUFFER8) pTemp;
*pVoid = (LPVOID) this;
//m_lpDirectSoundBuffer8->AddRef();
}
return hRes;
}
// Unknown interface, let DX handle this...
hRes = m_lpDirectSound3DBuffer8->QueryInterface( refIID, pVoid );
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
::LogMessage( m_cszClassName, this, "QueryInterface for unknown interface IID called....");
#endif // ENABLE_LOG
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound3DBuffer8Ex::AddRef()
{
ULONG nRefCnt = m_lpDirectSound3DBuffer8->AddRef();
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
{
CString sLogString;
sLogString.Format("AddRef called....,nRefCnt=%u", nRefCnt );
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
return nRefCnt;
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound3DBuffer8Ex::Release()
{
ULONG nRefCnt = m_lpDirectSound3DBuffer8->Release();
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
{
CString sLogString;
sLogString.Format("Release called....,nRefCnt=%u", nRefCnt );
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
if ( nRefCnt == 0 )
{
delete this;
return 0;
}
return nRefCnt;
}
//////////////////////////////////////////////////////////////////////////////////////////////
// IDirectSound3DBuffer methods
HRESULT IDirectSound3DBuffer8Ex::GetAllParameters(LPDS3DBUFFER pDs3dBuffer)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetAllParameter called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetAllParameters( pDs3dBuffer);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetConeAngles(LPDWORD pdwInsideConeAngle, LPDWORD pdwOutsideConeAngle)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetConeAngles called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetConeAngles( pdwInsideConeAngle,pdwOutsideConeAngle);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetConeOrientation(D3DVECTOR* pvOrientation)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetConeOrientation called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetConeOrientation( pvOrientation);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetConeOutsideVolume(LPLONG plConeOutsideVolume)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetConeOutsideVolume called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetConeOutsideVolume( plConeOutsideVolume );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetMaxDistance(D3DVALUE* pflMaxDistance)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetMaxDistance called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetMaxDistance( pflMaxDistance);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetMinDistance(D3DVALUE* pflMinDistance)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetMinDistance called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetMinDistance( pflMinDistance );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetMode(LPDWORD pdwMode)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetMode called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetMode( pdwMode );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetPosition(D3DVECTOR* pvPosition)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetPosition called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetPosition( pvPosition );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::GetVelocity(D3DVECTOR* pvVelocity)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "GetVelocity called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->GetVelocity( pvVelocity );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetAllParameters(LPCDS3DBUFFER pcDs3dBuffer, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetAllParameters called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetAllParameters( pcDs3dBuffer, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetConeAngles(DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetConeAngles called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetConeAngles( dwInsideConeAngle, dwOutsideConeAngle, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetConeOrientation(D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetConeOrientation called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetConeOrientation( x, y, z, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetConeOutsideVolume(LONG lConeOutsideVolume, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetConeOutsideVolume called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetConeOutsideVolume( lConeOutsideVolume, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetMaxDistance(D3DVALUE flMaxDistance, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetMaxDistance called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetMaxDistance( flMaxDistance, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetMinDistance(D3DVALUE flMinDistance, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetMinDistance called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetMinDistance( flMinDistance, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetMode(DWORD dwMode, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetMode called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetMode( dwMode, dwApply);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetPosition(D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetPosition called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetPosition( x, y, z, dwApply);
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DBuffer8Ex::SetVelocity(D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DBuffer == true )
LogMessage( m_cszClassName, this, "SetVelocity called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DBuffer8->SetVelocity( x, y, z, dwApply);
}
//////////////////////////////////////////////////////////////////////////////////////////////