ReactOS 0.4.15-dev-7906-g1b85a5f
dsound_main.c File Reference
#include "dsound_private.h"
#include <winreg.h>
#include <rpcproxy.h>
Include dependency graph for dsound_main.c:

Go to the source code of this file.

Classes

struct  morecontext
 
struct  IClassFactoryImpl
 

Macros

#define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
 

Typedefs

typedef HRESULT(* FnCreateInstance) (REFIID riid, LPVOID *ppobj)
 

Functions

HRESULT mmErr (UINT err)
 
static DWORD get_config_key (HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
 
void setup_dsound_options (void)
 
static const charget_device_id (LPCGUID pGuid)
 
HRESULT WINAPI GetDeviceID (LPCGUID pGuidSrc, LPGUID pGuidDest)
 
static BOOL CALLBACK a_to_w_callback (LPGUID guid, LPCWSTR descW, LPCWSTR modW, LPVOID data)
 
HRESULT WINAPI DirectSoundEnumerateA (LPDSENUMCALLBACKA lpDSEnumCallback, LPVOID lpContext)
 
HRESULT WINAPI DirectSoundEnumerateW (LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
 
HRESULT WINAPI DirectSoundCaptureEnumerateA (LPDSENUMCALLBACKA lpDSEnumCallback, LPVOID lpContext)
 
HRESULT WINAPI DirectSoundCaptureEnumerateW (LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI DSCF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI DSCF_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI DSCF_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI DSCF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI DSCF_LockServer (LPCLASSFACTORY iface, BOOL dolock)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

DirectSoundDeviceDSOUND_renderer [MAXWAVEDRIVERS]
 
GUID DSOUND_renderer_guids [MAXWAVEDRIVERS]
 
GUID DSOUND_capture_guids [MAXWAVEDRIVERS]
 
int ds_emuldriver = 0
 
int ds_hel_buflen = 32768 * 2
 
int ds_snd_queue_max = 10
 
int ds_snd_queue_min = 6
 
int ds_snd_shadow_maxsize = 2
 
int ds_hw_accel = DS_HW_ACCEL_FULL
 
int ds_default_sample_rate = 44100
 
int ds_default_bits_per_sample = 16
 
static int ds_default_playback
 
static int ds_default_capture
 
static HINSTANCE instance
 
static const IClassFactoryVtbl DSCF_Vtbl
 
static IClassFactoryImpl DSOUND_CF []
 

Macro Definition Documentation

◆ INIT_GUID

#define INIT_GUID (   guid,
  l,
  w1,
  w2,
  b1,
  b2,
  b3,
  b4,
  b5,
  b6,
  b7,
  b8 
)
Value:
guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
guid.Data4[6] = b7; guid.Data4[7] = b8;
r l[0]
Definition: byte_order.h:168
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
Definition: glext.h:8308
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1
Definition: glext.h:8308
const GUID * guid
static CRYPT_DATA_BLOB b4
Definition: msg.c:2284
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:592
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573

Definition at line 611 of file dsound_main.c.

Typedef Documentation

◆ FnCreateInstance

typedef HRESULT(* FnCreateInstance) (REFIID riid, LPVOID *ppobj)

Definition at line 461 of file dsound_main.c.

Function Documentation

◆ a_to_w_callback()

static BOOL CALLBACK a_to_w_callback ( LPGUID  guid,
LPCWSTR  descW,
LPCWSTR  modW,
LPVOID  data 
)
static

Definition at line 263 of file dsound_main.c.

264{
265 struct morecontext *context = data;
266 char descA[MAXPNAMELEN], modA[MAXPNAMELEN];
267
268 WideCharToMultiByte(CP_ACP, 0, descW, -1, descA, sizeof(descA), NULL, NULL);
269 WideCharToMultiByte(CP_ACP, 0, modW, -1, modA, sizeof(modA), NULL, NULL);
270
271 return context->callA(guid, descA, modA, context->data);
272}
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define MAXPNAMELEN
Definition: mmsystem.h:24
Definition: http.c:7252
static const WCHAR modW[]
Definition: lex.c:66

Referenced by DirectSoundCaptureEnumerateA(), and DirectSoundEnumerateA().

◆ DirectSoundCaptureEnumerateA()

HRESULT WINAPI DirectSoundCaptureEnumerateA ( LPDSENUMCALLBACKA  lpDSEnumCallback,
LPVOID  lpContext 
)

Definition at line 378 of file dsound_main.c.

381{
382 struct morecontext context;
383
384 if (lpDSEnumCallback == NULL) {
385 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
386 return DSERR_INVALIDPARAM;
387 }
388
389 context.callA = lpDSEnumCallback;
390 context.data = lpContext;
391
393}
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
static BOOL CALLBACK a_to_w_callback(LPGUID guid, LPCWSTR descW, LPCWSTR modW, LPVOID data)
Definition: dsound_main.c:263
HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
Definition: dsound_main.c:409

◆ DirectSoundCaptureEnumerateW()

HRESULT WINAPI DirectSoundCaptureEnumerateW ( LPDSENUMCALLBACKW  lpDSEnumCallback,
LPVOID  lpContext 
)

Definition at line 409 of file dsound_main.c.

412{
413 unsigned devs, wid;
414 WAVEINCAPSW capsW;
415 GUID guid;
416 int err;
417
418 TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext );
419
420 if (lpDSEnumCallback == NULL) {
421 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
422 return DSERR_INVALIDPARAM;
423 }
424
426
427 devs = waveInGetNumDevs();
428 if (devs > 0) {
429 if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) {
430 for (wid = 0; wid < devs; ++wid) {
431 if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) {
432 err = mmErr(waveInGetDevCapsW(wid, &capsW, sizeof(WAVEINCAPSW)));
433 if (err == DS_OK) {
434 TRACE("calling lpDSEnumCallback(NULL,\"%ls\",\"%ls\",%p)\n",
435 capsW.szPname,L"Primary Sound Capture Driver",lpContext);
436 if (lpDSEnumCallback(NULL, capsW.szPname, L"Primary Sound Capture Driver", lpContext) == FALSE)
437 return DS_OK;
438 }
439 }
440 }
441 }
442 }
443
444 for (wid = 0; wid < devs; ++wid) {
445 err = mmErr(waveInGetDevCapsW(wid, &capsW, sizeof(WAVEINCAPSW)));
446 if (err == DS_OK) {
447 TRACE("calling lpDSEnumCallback(%s,\"%ls\",\"%ls\",%p)\n",
448 debugstr_guid(&DSOUND_capture_guids[wid]),capsW.szPname,L"Primary Sound Capture Driver",lpContext);
449 if (lpDSEnumCallback(&DSOUND_capture_guids[wid], capsW.szPname, L"Primary Sound Capture Driver", lpContext) == FALSE)
450 return DS_OK;
451 }
452 }
453
454 return DS_OK;
455}
#define FALSE
Definition: types.h:117
#define DS_OK
Definition: dsound.h:116
GUID DSOUND_capture_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:42
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound_main.c:223
void setup_dsound_options(void)
Definition: dsound_main.c:102
#define debugstr_guid
Definition: kernel32.h:35
#define L(x)
Definition: ntvdm.h:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define err(...)
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2565
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2573

Referenced by DirectSoundCaptureEnumerateA().

◆ DirectSoundEnumerateA()

HRESULT WINAPI DirectSoundEnumerateA ( LPDSENUMCALLBACKA  lpDSEnumCallback,
LPVOID  lpContext 
)

Definition at line 287 of file dsound_main.c.

290{
291 struct morecontext context;
292
293 if (lpDSEnumCallback == NULL) {
294 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
295 return DSERR_INVALIDPARAM;
296 }
297
298 context.callA = lpDSEnumCallback;
299 context.data = lpContext;
300
302}
HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
Definition: dsound_main.c:317

◆ DirectSoundEnumerateW()

HRESULT WINAPI DirectSoundEnumerateW ( LPDSENUMCALLBACKW  lpDSEnumCallback,
LPVOID  lpContext 
)

Definition at line 317 of file dsound_main.c.

320{
321 unsigned devs, wod;
322 WAVEOUTCAPSW capsW;
323 GUID guid;
324 int err;
325
326 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
327 lpDSEnumCallback, lpContext);
328
329 if (lpDSEnumCallback == NULL) {
330 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
331 return DSERR_INVALIDPARAM;
332 }
333
335
336 devs = waveOutGetNumDevs();
337 if (devs > 0) {
338 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
339 for (wod = 0; wod < devs; ++wod) {
340 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
341 err = mmErr(waveOutGetDevCapsW(wod, &capsW, sizeof(WAVEOUTCAPSW)));
342 if (err == DS_OK) {
343 TRACE("calling lpDSEnumCallback(NULL,\"%ls\",\"%ls\",%p)\n",
344 capsW.szPname,L"Primary Sound Driver",lpContext);
345 if (lpDSEnumCallback(NULL, capsW.szPname, L"Primary Sound Driver", lpContext) == FALSE)
346 return DS_OK;
347 }
348 }
349 }
350 }
351 }
352
353 for (wod = 0; wod < devs; ++wod) {
354 err = mmErr(waveOutGetDevCapsW(wod, &capsW, sizeof(WAVEOUTCAPSW)));
355 if (err == DS_OK) {
356 TRACE("calling lpDSEnumCallback(%s,\"%ls\",\"%ls\",%p)\n",
357 debugstr_guid(&DSOUND_renderer_guids[wod]),capsW.szPname,L"Primary Sound Driver",lpContext);
358 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], capsW.szPname, L"Primary Sound Driver", lpContext) == FALSE)
359 return DS_OK;
360 }
361 }
362 return DS_OK;
363}
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:41
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2137
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2173

Referenced by DirectSoundEnumerateA().

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 606 of file dsound_main.c.

607{
608 return S_FALSE;
609}
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 565 of file dsound_main.c.

566{
567 int i = 0;
568 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
569
570 if (ppv == NULL) {
571 WARN("invalid parameter\n");
572 return E_INVALIDARG;
573 }
574
575 *ppv = NULL;
576
579 WARN("no interface for %s\n", debugstr_guid(riid));
580 return E_NOINTERFACE;
581 }
582
583 while (NULL != DSOUND_CF[i].rclsid) {
584 if (IsEqualGUID(rclsid, DSOUND_CF[i].rclsid)) {
585 DSCF_AddRef(&DSOUND_CF[i].IClassFactory_iface);
586 *ppv = &DSOUND_CF[i];
587 return S_OK;
588 }
589 i++;
590 }
591
592 WARN("(%s, %s, %p): no class found.\n", debugstr_guid(rclsid),
595}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define E_INVALIDARG
Definition: ddrawi.h:101
static IClassFactoryImpl DSOUND_CF[]
Definition: dsound_main.c:538
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
Definition: dsound_main.c:492
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 620 of file dsound_main.c.

621{
622 int i;
623 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpvReserved);
624
625 switch (fdwReason) {
627 TRACE("DLL_PROCESS_ATTACH\n");
628 for (i = 0; i < MAXWAVEDRIVERS; i++) {
631 INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
632 INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
633 }
634 instance = hInstDLL;
636 /* Increase refcount on dsound by 1 */
637 GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)hInstDLL, &hInstDLL);
638 break;
640 TRACE("DLL_PROCESS_DETACH\n");
641 break;
642 default:
643 TRACE("UNKNOWN REASON\n");
644 break;
645 }
646 return TRUE;
647}
#define TRUE
Definition: types.h:120
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:971
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
Definition: loader.c:866
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static HINSTANCE instance
Definition: dsound_main.c:83
#define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: dsound_main.c:611
DirectSoundDevice * DSOUND_renderer[MAXWAVEDRIVERS]
Definition: dsound_main.c:40
static IN DWORD IN LPVOID lpvReserved
#define MAXWAVEDRIVERS
Definition: mmddk.h:37
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 652 of file dsound_main.c.

653{
655}
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 660 of file dsound_main.c.

661{
663}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ DSCF_AddRef()

static ULONG WINAPI DSCF_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 492 of file dsound_main.c.

493{
494 return 2;
495}

Referenced by DllGetClassObject().

◆ DSCF_CreateInstance()

static HRESULT WINAPI DSCF_CreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pOuter,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 503 of file dsound_main.c.

508{
510 TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
511
512 if (pOuter)
514
515 if (ppobj == NULL) {
516 WARN("invalid parameter\n");
517 return DSERR_INVALIDPARAM;
518 }
519 *ppobj = NULL;
520 return This->pfnCreateInstance(riid, ppobj);
521}
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dsound_main.c:469
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ DSCF_LockServer()

static HRESULT WINAPI DSCF_LockServer ( LPCLASSFACTORY  iface,
BOOL  dolock 
)
static

Definition at line 523 of file dsound_main.c.

524{
526 FIXME("(%p, %d) stub!\n", This, dolock);
527 return S_OK;
528}
#define FIXME(fmt,...)
Definition: debug.h:111

◆ DSCF_QueryInterface()

static HRESULT WINAPI DSCF_QueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 475 of file dsound_main.c.

476{
478 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
479 if (ppobj == NULL)
480 return E_POINTER;
483 {
484 *ppobj = iface;
485 IUnknown_AddRef(iface);
486 return S_OK;
487 }
488 *ppobj = NULL;
489 return E_NOINTERFACE;
490}
#define E_POINTER
Definition: winerror.h:2365

◆ DSCF_Release()

static ULONG WINAPI DSCF_Release ( LPCLASSFACTORY  iface)
static

Definition at line 497 of file dsound_main.c.

498{
499 /* static class, won't be freed */
500 return 1;
501}

◆ get_config_key()

static DWORD get_config_key ( HKEY  defkey,
HKEY  appkey,
const char name,
char buffer,
DWORD  size 
)
inlinestatic

Definition at line 89 of file dsound_main.c.

91{
92 if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
93 if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
95}
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
Definition: name.c:39
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by setup_dsound_options().

◆ get_device_id()

static const char * get_device_id ( LPCGUID  pGuid)
static

Definition at line 190 of file dsound_main.c.

191{
192 if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
193 return "DSDEVID_DefaultPlayback";
194 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuid))
195 return "DSDEVID_DefaultVoicePlayback";
196 else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuid))
197 return "DSDEVID_DefaultCapture";
198 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuid))
199 return "DSDEVID_DefaultVoiceCapture";
200 return debugstr_guid(pGuid);
201}

Referenced by GetDeviceID().

◆ GetDeviceID()

HRESULT WINAPI GetDeviceID ( LPCGUID  pGuidSrc,
LPGUID  pGuidDest 
)

Definition at line 223 of file dsound_main.c.

224{
225 TRACE("(%s,%p)\n", get_device_id(pGuidSrc),pGuidDest);
226
227 if ( pGuidSrc == NULL) {
228 WARN("invalid parameter: pGuidSrc == NULL\n");
229 return DSERR_INVALIDPARAM;
230 }
231
232 if ( pGuidDest == NULL ) {
233 WARN("invalid parameter: pGuidDest == NULL\n");
234 return DSERR_INVALIDPARAM;
235 }
236
237 if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
238 IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
240 TRACE("returns %s\n", get_device_id(pGuidDest));
241 return DS_OK;
242 }
243
244 if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
245 IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
247 TRACE("returns %s\n", get_device_id(pGuidDest));
248 return DS_OK;
249 }
250
251 *pGuidDest = *pGuidSrc;
252 TRACE("returns %s\n", get_device_id(pGuidDest));
253
254 return DS_OK;
255}
static int ds_default_capture
Definition: dsound_main.c:82
static const char * get_device_id(LPCGUID pGuid)
Definition: dsound_main.c:190
static int ds_default_playback
Definition: dsound_main.c:81

Referenced by DirectSoundCaptureEnumerateW(), and DirectSoundEnumerateW().

◆ impl_from_IClassFactory()

static IClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 469 of file dsound_main.c.

470{
471 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
472}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by DSCF_CreateInstance(), DSCF_LockServer(), and DSCF_QueryInterface().

◆ mmErr()

HRESULT mmErr ( UINT  err)

Definition at line 44 of file dsound_main.c.

45{
46 switch(err) {
48 return DS_OK;
50 return DSERR_ALLOCATED;
51 case MMSYSERR_ERROR:
54 return DSERR_GENERIC; /* FIXME */
57 return DSERR_NODRIVER;
58 case MMSYSERR_NOMEM:
59 return DSERR_OUTOFMEMORY;
63 return DSERR_INVALIDPARAM;
65 return DSERR_UNSUPPORTED;
66 default:
67 FIXME("Unknown MMSYS error %d\n",err);
68 return DSERR_GENERIC;
69 }
70}
#define DSERR_ALLOCATED
Definition: dsound.h:119
#define DSERR_UNSUPPORTED
Definition: dsound.h:127
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define DSERR_GENERIC
Definition: dsound.h:123
#define DSERR_NODRIVER
Definition: dsound.h:128
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define MMSYSERR_NODRIVER
Definition: mmsystem.h:102
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define MMSYSERR_ALLOCATED
Definition: mmsystem.h:100
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define WAVERR_UNPREPARED
Definition: mmsystem.h:178

Referenced by DirectSoundCaptureDevice_Initialize(), DirectSoundCaptureEnumerateW(), DirectSoundDevice_Initialize(), DirectSoundEnumerateW(), DSOUND_PrimaryOpen(), DSOUND_PrimaryPlay(), DSOUND_PrimaryStop(), DSOUND_ReopenDevice(), IDirectSoundCaptureBufferImpl_Create(), IDirectSoundCaptureBufferImpl_Start(), and IDirectSoundCaptureBufferImpl_Stop().

◆ setup_dsound_options()

void setup_dsound_options ( void  )

Definition at line 102 of file dsound_main.c.

103{
104 char buffer[MAX_PATH+16];
105 HKEY hkey, appkey = 0;
106 DWORD len;
107
108 buffer[MAX_PATH]='\0';
109
110 /* @@ Wine registry key: HKCU\Software\Wine\DirectSound */
111 if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\DirectSound", &hkey )) hkey = 0;
112
114 if (len && len < MAX_PATH)
115 {
116 HKEY tmpkey;
117 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectSound */
118 if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey ))
119 {
120 char *p, *appname = buffer;
121 if ((p = strrchr( appname, '/' ))) appname = p + 1;
122 if ((p = strrchr( appname, '\\' ))) appname = p + 1;
123 strcat( appname, "\\DirectSound" );
124 TRACE("appname = [%s]\n", appname);
125 if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
126 RegCloseKey( tmpkey );
127 }
128 }
129
130 /* get options */
131
132 if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
134
135 if (!get_config_key( hkey, appkey, "HelBuflen", buffer, MAX_PATH ))
137
138 if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
140
141 if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
143
144 if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
145 if (strcmp(buffer, "Full") == 0)
147 else if (strcmp(buffer, "Standard") == 0)
149 else if (strcmp(buffer, "Basic") == 0)
151 else if (strcmp(buffer, "Emulation") == 0)
153 }
154
155 if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
157
158 if (!get_config_key( hkey, appkey, "MaxShadowSize", buffer, MAX_PATH ))
160
161 if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
163
164 if (!get_config_key( hkey, appkey, "DefaultSampleRate", buffer, MAX_PATH ))
166
167 if (!get_config_key( hkey, appkey, "DefaultBitsPerSample", buffer, MAX_PATH ))
169
170 if (appkey) RegCloseKey( appkey );
171 if (hkey) RegCloseKey( hkey );
172
173 TRACE("ds_emuldriver = %d\n", ds_emuldriver);
174 TRACE("ds_hel_buflen = %d\n", ds_hel_buflen);
175 TRACE("ds_snd_queue_max = %d\n", ds_snd_queue_max);
176 TRACE("ds_snd_queue_min = %d\n", ds_snd_queue_min);
177 TRACE("ds_hw_accel = %s\n",
178 ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
179 ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
180 ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
181 ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
182 "Unknown");
183 TRACE("ds_default_playback = %d\n", ds_default_playback);
184 TRACE("ds_default_capture = %d\n", ds_default_playback);
185 TRACE("ds_default_sample_rate = %d\n", ds_default_sample_rate);
186 TRACE("ds_default_bits_per_sample = %d\n", ds_default_bits_per_sample);
187 TRACE("ds_snd_shadow_maxsize = %d\n", ds_snd_shadow_maxsize);
188}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
int ds_snd_queue_min
Definition: dsound_main.c:76
int ds_snd_shadow_maxsize
Definition: dsound_main.c:77
int ds_hw_accel
Definition: dsound_main.c:78
int ds_snd_queue_max
Definition: dsound_main.c:75
int ds_hel_buflen
Definition: dsound_main.c:74
int ds_default_sample_rate
Definition: dsound_main.c:79
int ds_default_bits_per_sample
Definition: dsound_main.c:80
static DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
Definition: dsound_main.c:89
int ds_emuldriver
Definition: dsound_main.c:73
#define DS_HW_ACCEL_FULL
#define DS_HW_ACCEL_STANDARD
#define DS_HW_ACCEL_BASIC
#define DS_HW_ACCEL_EMULATION
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by DirectSoundCaptureEnumerateW(), DirectSoundEnumerateW(), DSOUND_CaptureCreate(), DSOUND_CaptureCreate8(), DSOUND_Create(), DSOUND_Create8(), DSOUND_FullDuplexCreate(), and DSPROPERTY_DescriptionW().

Variable Documentation

◆ ds_default_bits_per_sample

int ds_default_bits_per_sample = 16

Definition at line 80 of file dsound_main.c.

Referenced by DirectSoundDevice_Create(), and setup_dsound_options().

◆ ds_default_capture

int ds_default_capture
static

Definition at line 82 of file dsound_main.c.

Referenced by GetDeviceID(), and setup_dsound_options().

◆ ds_default_playback

int ds_default_playback
static

Definition at line 81 of file dsound_main.c.

Referenced by GetDeviceID(), and setup_dsound_options().

◆ ds_default_sample_rate

int ds_default_sample_rate = 44100

Definition at line 79 of file dsound_main.c.

Referenced by DirectSoundDevice_Create(), and setup_dsound_options().

◆ ds_emuldriver

int ds_emuldriver = 0

Definition at line 73 of file dsound_main.c.

Referenced by DirectSoundDevice_Initialize(), and setup_dsound_options().

◆ ds_hel_buflen

int ds_hel_buflen = 32768 * 2

Definition at line 74 of file dsound_main.c.

Referenced by DSOUND_PrimaryCreate(), DSOUND_PrimaryOpen(), and setup_dsound_options().

◆ ds_hw_accel

◆ ds_snd_queue_max

int ds_snd_queue_max = 10

◆ ds_snd_queue_min

int ds_snd_queue_min = 6

Definition at line 76 of file dsound_main.c.

Referenced by DSOUND_PrimaryOpen(), and setup_dsound_options().

◆ ds_snd_shadow_maxsize

int ds_snd_shadow_maxsize = 2

Definition at line 77 of file dsound_main.c.

Referenced by DSOUND_RecalcFormat(), and setup_dsound_options().

◆ DSCF_Vtbl

const IClassFactoryVtbl DSCF_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI DSCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
Definition: dsound_main.c:475
static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: dsound_main.c:503
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
Definition: dsound_main.c:497
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
Definition: dsound_main.c:523

Definition at line 530 of file dsound_main.c.

◆ DSOUND_capture_guids

◆ DSOUND_CF

IClassFactoryImpl DSOUND_CF[]
static
Initial value:
= {
{ { &DSCF_Vtbl }, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
{ { &DSCF_Vtbl }, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
{ { &DSCF_Vtbl }, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
{ { &DSCF_Vtbl }, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
{ { NULL }, NULL, NULL }
}
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8)
Definition: capture.c:1365
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC)
Definition: capture.c:1336
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS)
Definition: dsound.c:963
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS)
Definition: dsound.c:1050
HRESULT(* FnCreateInstance)(REFIID riid, LPVOID *ppobj)
Definition: dsound_main.c:461
static const IClassFactoryVtbl DSCF_Vtbl
Definition: dsound_main.c:530
HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DECLSPEC_HIDDEN
Definition: propset.c:615
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX *ppDSFD) DECLSPEC_HIDDEN
Definition: duplex.c:604

Definition at line 538 of file dsound_main.c.

Referenced by DllGetClassObject().

◆ DSOUND_renderer

DirectSoundDevice * DSOUND_renderer

◆ DSOUND_renderer_guids

◆ instance

HINSTANCE instance
static

Definition at line 83 of file dsound_main.c.

Referenced by DllMain(), DllRegisterServer(), and DllUnregisterServer().