-
Notifications
You must be signed in to change notification settings - Fork 4
/
IDirectSoundEx.cpp
executable file
·553 lines (439 loc) · 18.4 KB
/
IDirectSoundEx.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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
//////////////////////////////////////////////////////////////////////////////////////////////
//
// 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 "idirectsoundex.h"
#include "idirectsoundbufferex.h"
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound8Ex::IDirectSound8Ex(void)
{
m_lpDirectSound8 = NULL;
#ifdef ENABLE_LOG
m_cszClassName = IDIRECTSOUND8EX_CLASS_NAME;
if( g_bLogDirectSound == true )
LogMessage( m_cszClassName, this, "Constructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
IDirectSound8Ex::~IDirectSound8Ex(void)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
LogMessage( m_cszClassName, this, "Destructor called....");
#endif // ENABLE_LOG
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::QueryInterface( REFIID refIID, LPVOID * pVoid )
{
*pVoid = NULL;
if(( refIID == IID_IDirectSound ) || ( refIID == IID_IDirectSound8 ))
{
LPVOID pTemp;
HRESULT hRes = m_lpDirectSound8->QueryInterface( refIID, &pTemp );
if( hRes != S_OK )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "QueryInterface for interface IID_IDirectSound8 failed...");
#endif // ENABLE_LOG
return hRes;
}
m_lpDirectSound8 = (LPDIRECTSOUND8) pTemp;
*pVoid = (LPVOID) this;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "QueryInterface called,Interface=IID_IDirectSound8");
#endif // ENABLE_LOG
return S_OK;
}
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
LogMessage( m_cszClassName, this, "QueryInterface called for unknown IID interface ....");
#endif // ENABLE_LOG
return m_lpDirectSound8->QueryInterface( refIID, pVoid );
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound8Ex::AddRef()
{
ULONG nRefCnt = m_lpDirectSound8->AddRef();
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
CString sLogString;
sLogString.Format("AddRef called....,nRefCnt=%u", nRefCnt );
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
return nRefCnt;
}
//////////////////////////////////////////////////////////////////////////////////////////////
ULONG IDirectSound8Ex::Release()
{
ULONG nRefCnt = m_lpDirectSound8->Release();
#ifdef ENABLE_LOG
if( g_bLogDirectSound == 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;
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::CreateSoundBuffer (LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter)
{
DSBUFFERDESC dsdesc = *pcDSBufferDesc;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
CString sLogString;
CString sTempString;
sLogString = "CreateSoundBuffer called,";
sTempString.Format("dwBufferBytes=%u,Flags=", pcDSBufferDesc->dwBufferBytes );
sLogString += sTempString;
if( pcDSBufferDesc->dwFlags & DSBCAPS_PRIMARYBUFFER )
sLogString += "DSBCAPS_PRIMARYBUFFER";
if( pcDSBufferDesc->dwFlags & DSBCAPS_CTRL3D )
sLogString += "|DSBCAPS_CTRL3D";
if( pcDSBufferDesc->dwFlags & DSBCAPS_STATIC )
sLogString += "|DSBCAPS_STATIC";
if( pcDSBufferDesc->dwFlags & DSBCAPS_LOCDEFER )
sLogString += "|DSBCAPS_LOCDEFER";
if( pcDSBufferDesc->dwFlags & DSBCAPS_LOCHARDWARE )
sLogString += "|DSBCAPS_LOCHARDWARE";
if( pcDSBufferDesc->dwFlags & DSBCAPS_LOCSOFTWARE )
sLogString += "|DSBCAPS_LOCSOFTWARE";
if( pcDSBufferDesc->dwFlags & DSBCAPS_CTRLFREQUENCY )
sLogString += "|DSBCAPS_CTRLFREQUENCY";
if( pcDSBufferDesc->dwFlags & DSBCAPS_CTRLPAN )
sLogString += "|DSBCAPS_CTRLPAN";
if( pcDSBufferDesc->dwFlags & DSBCAPS_CTRLPOSITIONNOTIFY )
sLogString += "|DSBCAPS_CTRLPOSITIONNOTIFY";
if( pcDSBufferDesc->dwFlags & DSBCAPS_CTRLVOLUME )
sLogString += "|DSBCAPS_CTRLVOLUME";
if( pcDSBufferDesc->dwFlags & DSBCAPS_GETCURRENTPOSITION2 )
sLogString += "|DSBCAPS_GETCURRENTPOSITION2";
if( pcDSBufferDesc->dwFlags & DSBCAPS_GLOBALFOCUS )
sLogString += "|DSBCAPS_GLOBALFOCUS";
if( pcDSBufferDesc->dwFlags & DSBCAPS_MUTE3DATMAXDISTANCE )
sLogString += "|DSBCAPS_MUTE3DATMAXDISTANCE";
if( pcDSBufferDesc->dwFlags & DSBCAPS_STICKYFOCUS )
sLogString += "|DSBCAPS_STICKYFOCUS";
if(( pcDSBufferDesc->dwFlags & DSBCAPS_CTRL3D ) && (pcDSBufferDesc->dwFlags & DSBCAPS_LOCSOFTWARE) )
{
sLogString += ",3DALGORITHM=";
if( pcDSBufferDesc->guid3DAlgorithm == DS3DALG_DEFAULT )
sLogString += "DS3DALG_DEFAULT";
if( pcDSBufferDesc->guid3DAlgorithm == DS3DALG_NO_VIRTUALIZATION )
sLogString += "DS3DALG_NO_VIRTUALIZATION";
if( pcDSBufferDesc->guid3DAlgorithm == DS3DALG_HRTF_FULL )
sLogString += "DS3DALG_HRTF_FULL";
if( pcDSBufferDesc->guid3DAlgorithm == DS3DALG_HRTF_LIGHT )
sLogString += "DS3DALG_HRTF_LIGHT";
}
if( pcDSBufferDesc->lpwfxFormat != NULL )
{
sTempString.Format(",Format=%ub %uhz %uch", pcDSBufferDesc->lpwfxFormat->wBitsPerSample, pcDSBufferDesc->lpwfxFormat->nSamplesPerSec, pcDSBufferDesc->lpwfxFormat->nChannels );
sLogString += sTempString;
}
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
if( g_bForceSoftwareMixing == true )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "CreateSoundBuffer FORCING SOFTWARE MIXED BUFFER....");
#endif // ENABLE_LOG
dsdesc.dwFlags &= ~DSBCAPS_LOCHARDWARE;
dsdesc.dwFlags |= DSBCAPS_LOCSOFTWARE;
}
if( g_bForceHardwareMixing == true )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "CreateSoundBuffer FORCING HARDWARE MIXED BUFFER....");
#endif // ENABLE_LOG
dsdesc.dwFlags &= ~DSBCAPS_LOCSOFTWARE;
dsdesc.dwFlags |= DSBCAPS_LOCHARDWARE;
}
if(( g_bForceHQSoftware3D == true ) && (dsdesc.dwFlags & DSBCAPS_LOCSOFTWARE) && (dsdesc.dwFlags & DSBCAPS_CTRL3D))
{
dsdesc.guid3DAlgorithm = DS3DALG_HRTF_FULL;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "CreateSoundBuffer FORCING HQ 3D SOFTWARE PROCESSING....");
#endif // ENABLE_LOG
}
if(( g_bForceNonStatic == true ) && ( dsdesc.dwFlags & DSBCAPS_STATIC ))
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "CreateSoundBuffer FORCING NON-STATIC BUFFER....");
#endif // ENABLE_LOG
dsdesc.dwFlags &= ~DSBCAPS_STATIC;
}
if(( g_bForceVoiceManagement == true ) && (( dsdesc.dwFlags & DSBCAPS_LOCDEFER ) == 0 ))
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage(m_cszClassName, this, "CreateSoundBuffer FORCING BUFFER MANAGMEMENT....");
#endif // ENABLE_LOG
dsdesc.dwFlags &= ~DSBCAPS_LOCSOFTWARE;
dsdesc.dwFlags &= ~DSBCAPS_LOCHARDWARE;
dsdesc.dwFlags |= DSBCAPS_LOCDEFER;
}
IDirectSoundBuffer8Ex* pDSBX = new IDirectSoundBuffer8Ex;
HRESULT hRes = m_lpDirectSound8->CreateSoundBuffer( &dsdesc, (LPDIRECTSOUNDBUFFER*) &( pDSBX->m_lpDirectSoundBuffer8 ) /*ppDSBuffer*/, pUnkOuter ) ;
*ppDSBuffer = (LPDIRECTSOUNDBUFFER8) pDSBX;
if( pcDSBufferDesc->dwFlags & DSBCAPS_PRIMARYBUFFER )
{
pDSBX->SetPrimaryBuffer( true );
if((hRes == S_OK) && ( g_bForcePrimaryBufferFormat == true ))
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
CString sMessage;
sMessage.Format("FORCING PRIMARY BUFFER FORMAT,Format=%ub %uhz %uch", g_nPrimaryBufferBits,g_nPrimaryBufferSamples,g_nPrimaryBufferChannels );
::LogMessage(m_cszClassName, this, sMessage.GetBuffer() );
}
#endif // ENABLE_LOG
WAVEFORMATEX fxFormat;
fxFormat.wFormatTag = WAVE_FORMAT_PCM;
fxFormat.cbSize = 0;
fxFormat.nChannels = (WORD) g_nPrimaryBufferChannels;
fxFormat.wBitsPerSample = (WORD) g_nPrimaryBufferBits;
fxFormat.nSamplesPerSec = g_nPrimaryBufferSamples;
fxFormat.nBlockAlign = (fxFormat.nChannels * fxFormat.wBitsPerSample) / 8;
fxFormat.nAvgBytesPerSec= fxFormat.nBlockAlign * fxFormat.nSamplesPerSec;
HRESULT hResult = pDSBX->m_lpDirectSoundBuffer8->SetFormat ( &fxFormat );
#ifdef ENABLE_LOG
if(( g_bLogDirectSound == true ) && ( hResult != S_OK ))
::LogMessage(m_cszClassName, this, "ERROR: FORCING PRIMARY BUFFER FORMAT failed....");
#endif // ENABLE_LOG
}
}
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::GetCaps (LPDSCAPS pDSCaps)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage(m_cszClassName, this, "GetCaps called....");
#endif // ENABLE_LOG
HRESULT hRes = m_lpDirectSound8->GetCaps( pDSCaps );
if( g_nNum2DBuffers != 0 )
{
if( pDSCaps->dwMaxHwMixingAllBuffers >= (DWORD) g_nNum2DBuffers )
{
ASSERT( g_nNum2DBuffers >= (int)( pDSCaps->dwMaxHwMixingAllBuffers - pDSCaps->dwFreeHwMixingAllBuffers ));
ASSERT( g_nNum2DBuffers >= (int)( pDSCaps->dwMaxHwMixingStaticBuffers - pDSCaps->dwFreeHwMixingStaticBuffers ));
ASSERT( g_nNum2DBuffers >= (int)( pDSCaps->dwFreeHwMixingStreamingBuffers - pDSCaps->dwMaxHwMixingStreamingBuffers ));
pDSCaps->dwFreeHwMixingAllBuffers = g_nNum2DBuffers - ( pDSCaps->dwMaxHwMixingAllBuffers - pDSCaps->dwFreeHwMixingAllBuffers );
pDSCaps->dwFreeHwMixingStaticBuffers = g_nNum2DBuffers - ( pDSCaps->dwMaxHwMixingStaticBuffers - pDSCaps->dwFreeHwMixingStaticBuffers );
pDSCaps->dwFreeHwMixingStreamingBuffers = g_nNum2DBuffers - ( pDSCaps->dwFreeHwMixingStreamingBuffers - pDSCaps->dwMaxHwMixingStreamingBuffers );
pDSCaps->dwMaxHwMixingAllBuffers = g_nNum2DBuffers;
pDSCaps->dwMaxHwMixingStaticBuffers = g_nNum2DBuffers;
pDSCaps->dwMaxHwMixingStreamingBuffers = g_nNum2DBuffers;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "GetCaps number of 2D buffers changed....");
#endif // ENABLE_LOG
}
else
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
LogMessage( m_cszClassName, this, "ERROR: GetCaps INVALID number of 2D buffers given, no change....");
#endif // ENABLE_LOG
}
}
if( g_nNum3DBuffers != 0 )
{
if( pDSCaps->dwMaxHw3DAllBuffers >= (DWORD) g_nNum3DBuffers )
{
ASSERT( g_nNum3DBuffers >= (int)( pDSCaps->dwMaxHw3DAllBuffers - pDSCaps->dwFreeHw3DAllBuffers ));
ASSERT( g_nNum3DBuffers >= (int)( pDSCaps->dwMaxHw3DStaticBuffers - pDSCaps->dwFreeHw3DStaticBuffers ));
ASSERT( g_nNum3DBuffers >= (int)( pDSCaps->dwFreeHw3DStreamingBuffers - pDSCaps->dwMaxHw3DStreamingBuffers ));
pDSCaps->dwFreeHw3DAllBuffers = g_nNum3DBuffers - ( pDSCaps->dwMaxHw3DAllBuffers - pDSCaps->dwFreeHw3DAllBuffers );
pDSCaps->dwFreeHw3DStaticBuffers = g_nNum3DBuffers - ( pDSCaps->dwMaxHw3DStaticBuffers - pDSCaps->dwFreeHw3DStaticBuffers );
pDSCaps->dwFreeHw3DStreamingBuffers = g_nNum3DBuffers - ( pDSCaps->dwFreeHw3DStreamingBuffers - pDSCaps->dwMaxHw3DStreamingBuffers );
pDSCaps->dwMaxHw3DAllBuffers = g_nNum3DBuffers;
pDSCaps->dwMaxHw3DStaticBuffers = g_nNum3DBuffers;
pDSCaps->dwMaxHw3DStreamingBuffers = g_nNum3DBuffers;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "GetCaps number of 3D buffers changed....");
#endif // ENABLE_LOG
}
else
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "ERROR: GetCaps INVALID number of 3D buffers given, no change....");
#endif // ENABLE_LOG
}
}
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::DuplicateSoundBuffer (LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
CString sLogString;
sLogString.Format("DuplicateSoundBuffer called....,pDSBufferOriginal=0x%x,ppDSBufferDuplicate=0x%x",pDSBufferOriginal,ppDSBufferDuplicate );
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
*ppDSBufferDuplicate = NULL;
IDirectSoundBuffer8Ex* pDSBX = new IDirectSoundBuffer8Ex;
HRESULT hRes = m_lpDirectSound8->DuplicateSoundBuffer( (LPDIRECTSOUNDBUFFER) (((IDirectSoundBuffer8Ex*) pDSBufferOriginal)->m_lpDirectSoundBuffer8 ), (LPDIRECTSOUNDBUFFER*) &( pDSBX->m_lpDirectSoundBuffer8 ) ) ;
if( hRes != S_OK )
{
delete pDSBX;
return hRes;
}
*ppDSBufferDuplicate = (LPDIRECTSOUNDBUFFER8) pDSBX;
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::SetCooperativeLevel (HWND hwnd, DWORD dwLevel)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
switch (dwLevel )
{
case DSSCL_EXCLUSIVE : ::LogMessage( m_cszClassName, this, "SetCooperativeLevel called,Level=DSSCL_EXCLUSIVE"); break;
case DSSCL_NORMAL : ::LogMessage( m_cszClassName, this, "SetCooperativeLevel called,Level=DSSCL_NORMAL"); break;
case DSSCL_PRIORITY : ::LogMessage( m_cszClassName, this, "SetCooperativeLevel called,Level=DSSCL_PRIORITY"); break;
case DSSCL_WRITEPRIMARY : ::LogMessage( m_cszClassName, this, "SetCooperativeLevel called,Level=DSSCL_WRITEPRIMARY"); break;
}
}
#endif // ENABLE_LOG
if( dwLevel == DSSCL_NORMAL )
{
if ( g_bForceExclusiveMode == true )
{
dwLevel = DSSCL_EXCLUSIVE;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "SetCooperativeLevel FORCING EXCLUSIVE MODE ....");
#endif // ENABLE_LOG
}
}
return m_lpDirectSound8->SetCooperativeLevel( hwnd, dwLevel );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::Compact()
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "Compact called....");
#endif // ENABLE_LOG
return m_lpDirectSound8->Compact();
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::GetSpeakerConfig (LPDWORD pdwSpeakerConfig)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "GetSpeakerConfig called....");
#endif // ENABLE_LOG
if( g_bForceSpeakerConfig == true )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "GetSpeakerConfig FORCED....");
#endif // ENABLE_LOG
*pdwSpeakerConfig = g_nSpeakerConfig;
return S_OK;
}
return m_lpDirectSound8->GetSpeakerConfig( pdwSpeakerConfig );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::SetSpeakerConfig (DWORD dwSpeakerConfig)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
{
CString sLogString;
sLogString = "SetSpeakerConfig called....,dwSpeakerConfig=";
if( dwSpeakerConfig == DSSPEAKER_DIRECTOUT ) sLogString += "DSSPEAKER_DIRECTOUT";
if( dwSpeakerConfig == DSSPEAKER_HEADPHONE ) sLogString += "DSSPEAKER_HEADPHONE";
if( dwSpeakerConfig == DSSPEAKER_MONO ) sLogString += "DSSPEAKER_MONO";
if( dwSpeakerConfig == DSSPEAKER_QUAD ) sLogString += "DSSPEAKER_QUAD";
if( dwSpeakerConfig == DSSPEAKER_STEREO ) sLogString += "DSSPEAKER_STEREO";
if( dwSpeakerConfig == DSSPEAKER_SURROUND ) sLogString += "DSSPEAKER_SURROUND";
if( dwSpeakerConfig == DSSPEAKER_5POINT1 ) sLogString += "DSSPEAKER_5POINT1";
if( dwSpeakerConfig == DSSPEAKER_7POINT1 ) sLogString += "DSSPEAKER_7POINT1";
if( dwSpeakerConfig == DSSPEAKER_7POINT1_SURROUND ) sLogString += "DSSPEAKER_7POINT1_SURROUND";
::LogMessage( m_cszClassName, this, sLogString.GetBuffer());
}
#endif // ENABLE_LOG
if( g_bPreventSpeakerSetup == true )
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "SetSpeakerConfig PREVENTED....");
#endif // ENABLE_LOG
return S_OK;
}
return m_lpDirectSound8->SetSpeakerConfig( dwSpeakerConfig );
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::Initialize(LPCGUID pcGuidDevice)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "Initialize called....");
#endif // ENABLE_LOG
return m_lpDirectSound8->Initialize( pcGuidDevice ) ;
}
//////////////////////////////////////////////////////////////////////////////////////////////
HRESULT IDirectSound8Ex::VerifyCertification(LPDWORD pdwCertified)
{
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "VerifyCertification called....");
#endif // ENABLE_LOG
HRESULT hRes = m_lpDirectSound8->VerifyCertification( pdwCertified ) ;
if( g_bForceCertification == true )
{
*pdwCertified = DS_CERTIFIED;
#ifdef ENABLE_LOG
if( g_bLogDirectSound == true )
::LogMessage( m_cszClassName, this, "VerifyCertification WHQL certification FORCED....");
#endif // ENABLE_LOG
return S_OK;
}
return hRes;
}
//////////////////////////////////////////////////////////////////////////////////////////////