-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathIDirectSound3DListenerEx.cpp
executable file
·317 lines (240 loc) · 10.3 KB
/
IDirectSound3DListenerEx.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
//////////////////////////////////////////////////////////////////////////////////////////////
//
// 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 "idirectsound3dListenerEx.h"
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound3DListener8Ex::IDirectSound3DListener8Ex(void)
{
m_lpDirectSound3DListener8 = NULL;
#ifdef ENABLE_LOG
m_cszClassName = IDIRECTSOUND3DLISTENER8EX_CLASS_NAME;
if( g_bLogDirectSound3DListener == true )
::LogMessage( m_cszClassName, this, "Constructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound3DListener8Ex::~IDirectSound3DListener8Ex(void)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
::LogMessage( m_cszClassName, this, "Destructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::QueryInterface( REFIID refIID, LPVOID * pVoid )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
::LogMessage( m_cszClassName, this, "QueryInterface called....");
#endif // ENABLE_LOG
*pVoid = (LPVOID) NULL;
HRESULT hRes;
if(( refIID == IID_IDirectSound3DListener ) || ( refIID == IID_IDirectSound3DListener8 ))
{
LPVOID pTemp;
hRes = m_lpDirectSound3DListener8->QueryInterface( refIID, &pTemp );
if( hRes == S_OK )
{
m_lpDirectSound3DListener8 = (LPDIRECTSOUND3DLISTENER8) pTemp;
*pVoid = (LPVOID) this;
//m_lpDirectSoundListener8->AddRef();
}
return hRes;
}
// Unknown interface, let DX handle this...
hRes = m_lpDirectSound3DListener8->QueryInterface( refIID, pVoid );
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
::LogMessage( m_cszClassName, this, "QueryInterface for unknown interface IID called....");
#endif // ENABLE_LOG
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound3DListener8Ex::AddRef()
{
ULONG nRefCnt = m_lpDirectSound3DListener8->AddRef();
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
{
CString sLogString;
sLogString.Format("AddRef called....,nRefCnt=%u", nRefCnt );
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
return nRefCnt;
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound3DListener8Ex::Release()
{
ULONG nRefCnt = m_lpDirectSound3DListener8->Release();
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == 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;
}
//////////////////////////////////////////////////////////////////////////////////////////////
// IDirectSound3DListener methods
// IDirectSound3DListener methods
HRESULT IDirectSound3DListener8Ex::GetAllParameters( LPDS3DLISTENER pListener )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetAllParameter called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetAllParameters( pListener );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetDistanceFactor( D3DVALUE* pflDistanceFactor )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetDistanceFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetDistanceFactor( pflDistanceFactor );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetDopplerFactor( D3DVALUE* pflDopplerFactor )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetDopplerFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetDopplerFactor( pflDopplerFactor );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetOrientation( D3DVECTOR* pvOrientFront, D3DVECTOR* pvOrientTop)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetOrientation called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetOrientation( pvOrientFront, pvOrientTop );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetPosition( D3DVECTOR* pvPosition)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetPosition called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetPosition( pvPosition );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetRolloffFactor( D3DVALUE* pflRolloffFactor)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetRolloffFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetRolloffFactor( pflRolloffFactor );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::GetVelocity( D3DVECTOR* pvVelocity)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "GetVelocity called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->GetVelocity( pvVelocity );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetAllParameters( LPCDS3DLISTENER pcListener, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetAllParameters called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetAllParameters( pcListener, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetDistanceFactor( D3DVALUE flDistanceFactor, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetDistanceFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetDistanceFactor( flDistanceFactor, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetDopplerFactor( D3DVALUE flDopplerFactor, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetDopplerFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetDopplerFactor( flDopplerFactor, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetOrientation( D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetOrientation called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetOrientation( xFront, yFront, zFront, xTop, yTop, zTop, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetPosition( D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetPosition called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetPosition( x, y, z, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetRolloffFactor( D3DVALUE flRolloffFactor, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetRolloffFactor called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetRolloffFactor( flRolloffFactor, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::SetVelocity( D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "SetVelocity called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->SetVelocity( x, y, z, dwApply );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound3DListener8Ex::CommitDeferredSettings()
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound3DListener == true )
LogMessage( m_cszClassName, this, "CommitDeferredSettings called....");
#endif // ENABLE_LOG
return m_lpDirectSound3DListener8->CommitDeferredSettings();
}
//////////////////////////////////////////////////////////////////////////////////////////////