ReactOS  0.4.15-dev-3181-g4acf100
capture.c File Reference
#include "dsound_private.h"
Include dependency graph for capture.c:

Go to the source code of this file.

Classes

struct  IDirectSoundCaptureNotifyImpl
 
struct  IDirectSoundCaptureImpl
 

Functions

static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface (LPDIRECTSOUNDNOTIFY iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef (LPDIRECTSOUNDNOTIFY iface)
 
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release (LPDIRECTSOUNDNOTIFY iface)
 
static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions (LPDIRECTSOUNDNOTIFY iface, DWORD howmuch, LPCDSBPOSITIONNOTIFY notify)
 
static HRESULT IDirectSoundCaptureNotifyImpl_Create (IDirectSoundCaptureBufferImpl *dscb, IDirectSoundCaptureNotifyImpl **pdscn)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface (LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef (LPDIRECTSOUNDCAPTUREBUFFER8 iface)
 
static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release (LPDIRECTSOUNDCAPTUREBUFFER8 iface)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCaps (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDSCBCAPS lpDSCBCaps)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCurrentPosition (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwCapturePosition, LPDWORD lpdwReadPosition)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFormat (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPWAVEFORMATEX lpwfxFormat, DWORD dwSizeAllocated, LPDWORD lpdwSizeWritten)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetStatus (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwStatus)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Initialize (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDIRECTSOUNDCAPTURE lpDSC, LPCDSCBUFFERDESC lpcDSCBDesc)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Lock (LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwReadCusor, DWORD dwReadBytes, LPVOID *lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID *lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start (LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFlags)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop (LPDIRECTSOUNDCAPTUREBUFFER8 iface)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Unlock (LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPVOID lpvAudioPtr1, DWORD dwAudioBytes1, LPVOID lpvAudioPtr2, DWORD dwAudioBytes2)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetObjectInPath (LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject)
 
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFXStatus (LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFXCount, LPDWORD pdwFXStatus)
 
static void capture_CheckNotify (IDirectSoundCaptureBufferImpl *This, DWORD from, DWORD len)
 
static void CALLBACK DSOUND_capture_callback (HWAVEIN hwi, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
 
static HRESULT IDirectSoundCaptureBufferImpl_Create (DirectSoundCaptureDevice *device, IDirectSoundCaptureBufferImpl **ppobj, LPCDSCBUFFERDESC lpcDSCBufferDesc)
 
static HRESULT DirectSoundCaptureDevice_Create (DirectSoundCaptureDevice **ppDevice)
 
static ULONG DirectSoundCaptureDevice_Release (DirectSoundCaptureDevice *device)
 
static HRESULT DirectSoundCaptureDevice_Initialize (DirectSoundCaptureDevice **ppDevice, LPCGUID lpcGUID)
 
static HRESULT WINAPI IDirectSoundCaptureImpl_QueryInterface (LPDIRECTSOUNDCAPTURE iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSoundCaptureImpl_AddRef (LPDIRECTSOUNDCAPTURE iface)
 
static ULONG WINAPI IDirectSoundCaptureImpl_Release (LPDIRECTSOUNDCAPTURE iface)
 
static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer (LPDIRECTSOUNDCAPTURE iface, LPCDSCBUFFERDESC lpcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *lplpDSCaptureBuffer, LPUNKNOWN pUnk)
 
static HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps (LPDIRECTSOUNDCAPTURE iface, LPDSCCAPS lpDSCCaps)
 
static HRESULT WINAPI IDirectSoundCaptureImpl_Initialize (LPDIRECTSOUNDCAPTURE iface, LPCGUID lpcGUID)
 
static HRESULT IDirectSoundCaptureImpl_Create (LPDIRECTSOUNDCAPTURE8 *ppDSC)
 
HRESULT DSOUND_CaptureCreate (REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC)
 
HRESULT DSOUND_CaptureCreate8 (REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8)
 
HRESULT WINAPI DirectSoundCaptureCreate (LPCGUID lpcGUID, LPDIRECTSOUNDCAPTURE *ppDSC, LPUNKNOWN pUnkOuter)
 
HRESULT WINAPI DirectSoundCaptureCreate8 (LPCGUID lpcGUID, LPDIRECTSOUNDCAPTURE8 *ppDSC8, LPUNKNOWN pUnkOuter)
 

Variables

static const IDirectSoundNotifyVtbl dscnvt
 
static const char *const captureStateString []
 
static const IDirectSoundCaptureBuffer8Vtbl dscbvt
 
DirectSoundCaptureDeviceDSOUND_capture [MAXWAVEDRIVERS]
 
static const IDirectSoundCaptureVtbl dscvt
 

Function Documentation

◆ capture_CheckNotify()

static void capture_CheckNotify ( IDirectSoundCaptureBufferImpl This,
DWORD  from,
DWORD  len 
)
static

Definition at line 739 of file capture.c.

740 {
741  int i;
742  for (i = 0; i < This->nrofnotifies; ++i) {
743  LPDSBPOSITIONNOTIFY event = This->notifies + i;
744  DWORD offset = event->dwOffset;
745  TRACE("checking %d, position %d, event = %p\n", i, offset, event->hEventNotify);
746 
747  if (offset == DSBPN_OFFSETSTOP) {
748  if (!from && !len) {
749  SetEvent(event->hEventNotify);
750  TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
751  return;
752  }
753  else return;
754  }
755 
756  if (offset >= from && offset < (from + len))
757  {
758  TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
759  SetEvent(event->hEventNotify);
760  }
761  }
762 }
#define DSBPN_OFFSETSTOP
Definition: dsound.h:876
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define TRACE(s)
Definition: solgame.cpp:4
GLintptr offset
Definition: glext.h:5920
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
struct _cl_event * event
Definition: glext.h:7739
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
CardRegion * from
Definition: spigame.cpp:19

Referenced by DSOUND_capture_callback().

◆ DirectSoundCaptureCreate()

HRESULT WINAPI DirectSoundCaptureCreate ( LPCGUID  lpcGUID,
LPDIRECTSOUNDCAPTURE ppDSC,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1416 of file capture.c.

1420 {
1421  HRESULT hr;
1422  LPDIRECTSOUNDCAPTURE pDSC;
1423  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC, pUnkOuter);
1424 
1425  if (ppDSC == NULL) {
1426  WARN("invalid parameter: ppDSC == NULL\n");
1427  return DSERR_INVALIDPARAM;
1428  }
1429 
1430  if (pUnkOuter) {
1431  WARN("invalid parameter: pUnkOuter != NULL\n");
1432  *ppDSC = NULL;
1433  return DSERR_NOAGGREGATION;
1434  }
1435 
1436  hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
1437  if (hr == DS_OK) {
1438  hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
1439  if (hr != DS_OK) {
1441  pDSC = 0;
1442  }
1443  }
1444 
1445  *ppDSC = pDSC;
1446 
1447  return hr;
1448 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirectSoundCapture_Release(p)
Definition: dsound.h:736
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define debugstr_guid
Definition: kernel32.h:35
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC)
Definition: capture.c:1336
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define IDirectSoundCapture_Initialize(p, a)
Definition: dsound.h:740
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
#define DSERR_NOAGGREGATION
Definition: dsound.h:130
#define NULL
Definition: types.h:112

◆ DirectSoundCaptureCreate8()

HRESULT WINAPI DirectSoundCaptureCreate8 ( LPCGUID  lpcGUID,
LPDIRECTSOUNDCAPTURE8 ppDSC8,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1472 of file capture.c.

1476 {
1477  HRESULT hr;
1478  LPDIRECTSOUNDCAPTURE8 pDSC8;
1479  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter);
1480 
1481  if (ppDSC8 == NULL) {
1482  WARN("invalid parameter: ppDSC8 == NULL\n");
1483  return DSERR_INVALIDPARAM;
1484  }
1485 
1486  if (pUnkOuter) {
1487  WARN("invalid parameter: pUnkOuter != NULL\n");
1488  *ppDSC8 = NULL;
1489  return DSERR_NOAGGREGATION;
1490  }
1491 
1493  if (hr == DS_OK) {
1494  hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
1495  if (hr != DS_OK) {
1497  pDSC8 = 0;
1498  }
1499  }
1500 
1501  *ppDSC8 = pDSC8;
1502 
1503  return hr;
1504 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirectSoundCapture_Release(p)
Definition: dsound.h:736
#define WARN(fmt,...)
Definition: debug.h:112
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8)
Definition: capture.c:1365
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
#define debugstr_guid
Definition: kernel32.h:35
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define IDirectSoundCapture_Initialize(p, a)
Definition: dsound.h:740
#define IID_IDirectSoundCapture8
Definition: dsound.h:93
#define DSERR_NOAGGREGATION
Definition: dsound.h:130
#define NULL
Definition: types.h:112

◆ DirectSoundCaptureDevice_Create()

static HRESULT DirectSoundCaptureDevice_Create ( DirectSoundCaptureDevice **  ppDevice)
static

Definition at line 973 of file capture.c.

975 {
977  TRACE("(%p)\n", ppDevice);
978 
979  /* Allocate memory */
981 
982  if (device == NULL) {
983  WARN("out of memory\n");
984  return DSERR_OUTOFMEMORY;
985  }
986 
987  device->ref = 1;
988  device->state = STATE_STOPPED;
989 
990  InitializeCriticalSection( &(device->lock) );
991  device->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": DirectSoundCaptureDevice.lock");
992 
993  *ppDevice = device;
994 
995  return DS_OK;
996 }
#define DWORD_PTR
Definition: treelist.c:76
#define WARN(fmt,...)
Definition: debug.h:112
FxDevice * device
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
Definition: devices.h:37
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define STATE_STOPPED
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by DirectSoundCaptureDevice_Initialize().

◆ DirectSoundCaptureDevice_Initialize()

static HRESULT DirectSoundCaptureDevice_Initialize ( DirectSoundCaptureDevice **  ppDevice,
LPCGUID  lpcGUID 
)
static

Definition at line 1025 of file capture.c.

1028 {
1030  unsigned wid, widn;
1031  BOOLEAN found = FALSE;
1032  GUID devGUID;
1033  DirectSoundCaptureDevice *device = *ppDevice;
1034  TRACE("(%p, %s)\n", ppDevice, debugstr_guid(lpcGUID));
1035 
1036  /* Default device? */
1037  if ( !lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL) )
1038  lpcGUID = &DSDEVID_DefaultCapture;
1039 
1040  if (GetDeviceID(lpcGUID, &devGUID) != DS_OK) {
1041  WARN("invalid parameter: lpcGUID\n");
1042  return DSERR_INVALIDPARAM;
1043  }
1044 
1045  widn = waveInGetNumDevs();
1046  if (!widn) {
1047  WARN("no audio devices found\n");
1048  return DSERR_NODRIVER;
1049  }
1050 
1051  /* enumerate WINMM audio devices and find the one we want */
1052  for (wid=0; wid<widn; wid++) {
1053  if (IsEqualGUID( &devGUID, &DSOUND_capture_guids[wid]) ) {
1054  found = TRUE;
1055  break;
1056  }
1057  }
1058 
1059  if (found == FALSE) {
1060  WARN("No device found matching given ID!\n");
1061  return DSERR_NODRIVER;
1062  }
1063 
1064  if (DSOUND_capture[wid]) {
1065  WARN("already in use\n");
1066  return DSERR_ALLOCATED;
1067  }
1068 
1070  if (err != DS_OK) {
1071  WARN("DirectSoundCaptureDevice_Create failed\n");
1072  return err;
1073  }
1074 
1075  *ppDevice = device;
1076  device->guid = devGUID;
1077 
1078  /* Disable the direct sound driver to force emulation if requested. */
1079  device->driver = NULL;
1081  {
1082  err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&device->driver,0));
1083  if ( (err != DS_OK) && (err != DSERR_UNSUPPORTED) ) {
1084  WARN("waveInMessage failed; err=%x\n",err);
1085  return err;
1086  }
1087  }
1088  err = DS_OK;
1089 
1090  /* Get driver description */
1091  if (device->driver) {
1092  TRACE("using DirectSound driver\n");
1093  err = IDsCaptureDriver_GetDriverDesc(device->driver, &(device->drvdesc));
1094  if (err != DS_OK) {
1095  WARN("IDsCaptureDriver_GetDriverDesc failed\n");
1096  return err;
1097  }
1098  } else {
1099  TRACE("using WINMM\n");
1100  /* if no DirectSound interface available, use WINMM API instead */
1101  device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN |
1103  }
1104 
1105  device->drvdesc.dnDevNode = wid;
1106 
1107  /* open the DirectSound driver if available */
1108  if (device->driver && (err == DS_OK))
1109  err = IDsCaptureDriver_Open(device->driver);
1110 
1111  if (err == DS_OK) {
1112  *ppDevice = device;
1113 
1114  /* the driver is now open, so it's now allowed to call GetCaps */
1115  if (device->driver) {
1116  device->drvcaps.dwSize = sizeof(device->drvcaps);
1117  err = IDsCaptureDriver_GetCaps(device->driver,&(device->drvcaps));
1118  if (err != DS_OK) {
1119  WARN("IDsCaptureDriver_GetCaps failed\n");
1120  return err;
1121  }
1122  } else /*if (device->hwi)*/ {
1123  WAVEINCAPSA wic;
1124  err = mmErr(waveInGetDevCapsA((UINT)device->drvdesc.dnDevNode, &wic, sizeof(wic)));
1125 
1126  if (err == DS_OK) {
1127  device->drvcaps.dwFlags = 0;
1128  lstrcpynA(device->drvdesc.szDrvname, wic.szPname,
1129  sizeof(device->drvdesc.szDrvname));
1130 
1131  device->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER;
1132  device->drvcaps.dwFormats = wic.dwFormats;
1133  device->drvcaps.dwChannels = wic.wChannels;
1134  }
1135  }
1136  }
1137 
1138  return err;
1139 }
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound.c:53
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1050
#define TRUE
Definition: types.h:120
#define IDsCaptureDriver_Open(p)
Definition: dsdriver.h:320
#define WARN(fmt,...)
Definition: debug.h:112
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2816
FxDevice * device
#define DSDDESC_DOMMSYSTEMSETFORMAT
Definition: dsdriver.h:51
#define DSDDESC_DOMMSYSTEMOPEN
Definition: dsdriver.h:50
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define FALSE
Definition: types.h:117
Definition: devices.h:37
GUID DSOUND_capture_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:42
unsigned char BOOLEAN
#define DSERR_NODRIVER
Definition: dsound.h:128
#define DS_HW_ACCEL_EMULATION
#define debugstr_guid
Definition: kernel32.h:35
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define IDsCaptureDriver_GetCaps(p, a)
Definition: dsdriver.h:322
DWORD dwFormats
Definition: mmsystem.h:1051
#define DSERR_UNSUPPORTED
Definition: dsound.h:127
static HRESULT DirectSoundCaptureDevice_Create(DirectSoundCaptureDevice **ppDevice)
Definition: capture.c:973
#define GUID_NULL
Definition: ks.h:106
#define err(...)
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IDsCaptureDriver_GetDriverDesc(p, a)
Definition: dsdriver.h:319
#define DSCCAPS_EMULDRIVER
Definition: dsound.h:385
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define lstrcpynA
Definition: compat.h:610
UINT WINAPI waveInGetDevCapsA(UINT_PTR uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSize)
Definition: winmm.c:2600
#define DSERR_ALLOCATED
Definition: dsound.h:119
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2568
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:971
int ds_hw_accel
Definition: dsound_main.c:78

Referenced by IDirectSoundCaptureImpl_Initialize().

◆ DirectSoundCaptureDevice_Release()

static ULONG DirectSoundCaptureDevice_Release ( DirectSoundCaptureDevice device)
static

Definition at line 998 of file capture.c.

1000 {
1001  ULONG ref = InterlockedDecrement(&(device->ref));
1002  TRACE("(%p) ref was %d\n", device, ref + 1);
1003 
1004  if (!ref) {
1005  TRACE("deleting object\n");
1006  if (device->capture_buffer)
1008  (LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
1009 
1010  if (device->driver) {
1011  IDsCaptureDriver_Close(device->driver);
1013  }
1014 
1015  HeapFree(GetProcessHeap(), 0, device->pwfx);
1016  device->lock.DebugInfo->Spare[0] = 0;
1017  DeleteCriticalSection( &(device->lock) );
1018  DSOUND_capture[device->drvdesc.dnDevNode] = NULL;
1020  TRACE("(%p) released\n", device);
1021  }
1022  return ref;
1023 }
#define IDsCaptureDriver_Release(p)
Definition: dsdriver.h:317
static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:242
Definition: send.c:48
Definition: devices.h:37
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define IDsCaptureDriver_Close(p)
Definition: dsdriver.h:321
#define InterlockedDecrement
Definition: armddk.h:52
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
struct IDirectSoundCaptureBuffer8 * LPDIRECTSOUNDCAPTUREBUFFER8
Definition: dsound.h:100
#define HeapFree(x, y, z)
Definition: compat.h:594
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:971

Referenced by IDirectSoundCaptureImpl_Release().

◆ DSOUND_capture_callback()

static void CALLBACK DSOUND_capture_callback ( HWAVEIN  hwi,
UINT  msg,
DWORD_PTR  dwUser,
DWORD_PTR  dw1,
DWORD_PTR  dw2 
)
static

Definition at line 765 of file capture.c.

767 {
769  IDirectSoundCaptureBufferImpl * Moi = This->capture_buffer;
770  TRACE("(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %d\n",hwi,msg,
771  msg == MM_WIM_OPEN ? "MM_WIM_OPEN" : msg == MM_WIM_CLOSE ? "MM_WIM_CLOSE" :
772  msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount());
773 
774  if (msg == MM_WIM_DATA) {
775  EnterCriticalSection( &(This->lock) );
776  TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n",
777  captureStateString[This->state],This->index);
778  if (This->state != STATE_STOPPED) {
779  int index = This->index;
780  if (This->state == STATE_STARTING)
781  This->state = STATE_CAPTURING;
782  capture_CheckNotify(Moi, (DWORD_PTR)This->pwave[index].lpData - (DWORD_PTR)This->buffer, This->pwave[index].dwBufferLength);
783  This->index = (This->index + 1) % This->nrofpwaves;
784  if ( (This->index == 0) && !(This->capture_buffer->flags & DSCBSTART_LOOPING) ) {
785  TRACE("end of buffer\n");
786  This->state = STATE_STOPPED;
787  capture_CheckNotify(Moi, 0, 0);
788  } else {
789  if (This->state == STATE_CAPTURING) {
790  waveInUnprepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
791  waveInPrepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
792  waveInAddBuffer(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
793  } else if (This->state == STATE_STOPPING) {
794  TRACE("stopping\n");
795  This->state = STATE_STOPPED;
796  }
797  }
798  }
799  TRACE("DirectSoundCapture new This->state=%s, new This->index=%d\n",
800  captureStateString[This->state],This->index);
801  LeaveCriticalSection( &(This->lock) );
802  }
803 
804  TRACE("completed\n");
805 }
#define MM_WIM_OPEN
Definition: mmsystem.h:59
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define MM_WIM_DATA
Definition: mmsystem.h:61
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2656
UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2687
GLuint index
Definition: glext.h:6031
#define STATE_STOPPED
#define TRACE(s)
Definition: solgame.cpp:4
#define MM_WIM_CLOSE
Definition: mmsystem.h:60
static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from, DWORD len)
Definition: capture.c:739
#define STATE_CAPTURING
#define STATE_STARTING
#define DSCBSTART_LOOPING
Definition: dsound.h:393
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2720
uint32_t DWORD_PTR
Definition: typedefs.h:65
static const char *const captureStateString[]
Definition: capture.c:169
#define msg(x)
Definition: auth_time.c:54
#define STATE_STOPPING
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by IDirectSoundCaptureBufferImpl_Create().

◆ DSOUND_CaptureCreate()

HRESULT DSOUND_CaptureCreate ( REFIID  riid,
LPDIRECTSOUNDCAPTURE ppDSC 
)

Definition at line 1336 of file capture.c.

1339 {
1340  LPDIRECTSOUNDCAPTURE pDSC;
1341  HRESULT hr;
1342  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC);
1343 
1344  if (!IsEqualIID(riid, &IID_IUnknown) &&
1345  !IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1346  *ppDSC = 0;
1347  return E_NOINTERFACE;
1348  }
1349 
1350  /* Get dsound configuration */
1352 
1354  if (hr == DS_OK) {
1356  *ppDSC = pDSC;
1357  } else {
1358  WARN("IDirectSoundCaptureImpl_Create failed\n");
1359  *ppDSC = 0;
1360  }
1361 
1362  return hr;
1363 }
void setup_dsound_options(void)
Definition: dsound_main.c:102
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
#define IDirectSoundCapture_AddRef(p)
Definition: dsound.h:735
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static HRESULT IDirectSoundCaptureImpl_Create(LPDIRECTSOUNDCAPTURE8 *ppDSC)
Definition: capture.c:1313

Referenced by DirectSoundCaptureCreate().

◆ DSOUND_CaptureCreate8()

HRESULT DSOUND_CaptureCreate8 ( REFIID  riid,
LPDIRECTSOUNDCAPTURE8 ppDSC8 
)

Definition at line 1365 of file capture.c.

1368 {
1369  LPDIRECTSOUNDCAPTURE8 pDSC8;
1370  HRESULT hr;
1371  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC8);
1372 
1373  if (!IsEqualIID(riid, &IID_IUnknown) &&
1375  *ppDSC8 = 0;
1376  return E_NOINTERFACE;
1377  }
1378 
1379  /* Get dsound configuration */
1381 
1383  if (hr == DS_OK) {
1385  *ppDSC8 = pDSC8;
1386  } else {
1387  WARN("IDirectSoundCaptureImpl_Create failed\n");
1388  *ppDSC8 = 0;
1389  }
1390 
1391  return hr;
1392 }
void setup_dsound_options(void)
Definition: dsound_main.c:102
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
#define debugstr_guid
Definition: kernel32.h:35
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define IID_IDirectSoundCapture8
Definition: dsound.h:93
#define IDirectSoundCapture_AddRef(p)
Definition: dsound.h:735
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static HRESULT IDirectSoundCaptureImpl_Create(LPDIRECTSOUNDCAPTURE8 *ppDSC)
Definition: capture.c:1313

Referenced by DirectSoundCaptureCreate8(), and IDirectSoundFullDuplexImpl_Initialize().

◆ IDirectSoundCaptureBufferImpl_AddRef()

static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef ( LPDIRECTSOUNDCAPTUREBUFFER8  iface)
static

Definition at line 233 of file capture.c.

234 {
236  ULONG ref = InterlockedIncrement(&(This->ref));
237  TRACE("(%p) ref was %d\n", This, ref - 1);
238  return ref;
239 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSoundCaptureBufferImpl_Create()

static HRESULT IDirectSoundCaptureBufferImpl_Create ( DirectSoundCaptureDevice device,
IDirectSoundCaptureBufferImpl **  ppobj,
LPCDSCBUFFERDESC  lpcDSCBufferDesc 
)
static

Definition at line 807 of file capture.c.

811 {
812  LPWAVEFORMATEX wfex;
813  TRACE( "(%p,%p,%p)\n", device, ppobj, lpcDSCBufferDesc);
814 
815  if (ppobj == NULL) {
816  WARN("invalid parameter: ppobj == NULL\n");
817  return DSERR_INVALIDPARAM;
818  }
819 
820  if (!device) {
821  WARN("not initialized\n");
822  *ppobj = NULL;
823  return DSERR_UNINITIALIZED;
824  }
825 
826  if (lpcDSCBufferDesc == NULL) {
827  WARN("invalid parameter: lpcDSCBufferDesc == NULL\n");
828  *ppobj = NULL;
829  return DSERR_INVALIDPARAM;
830  }
831 
832  if ( ((lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC)) &&
833  (lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC1))) ||
834  (lpcDSCBufferDesc->dwBufferBytes == 0) ||
835  (lpcDSCBufferDesc->lpwfxFormat == NULL) ) { /* FIXME: DSERR_BADFORMAT ? */
836  WARN("invalid lpcDSCBufferDesc\n");
837  *ppobj = NULL;
838  return DSERR_INVALIDPARAM;
839  }
840 
841  wfex = lpcDSCBufferDesc->lpwfxFormat;
842 
843  TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
844  "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
845  wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec,
846  wfex->nAvgBytesPerSec, wfex->nBlockAlign,
847  wfex->wBitsPerSample, wfex->cbSize);
848 
849  /* Do some sanity checks for 'recording' SamplesPerSec value */
850  if (wfex->nSamplesPerSec > 100000)
851  wfex->nSamplesPerSec = 100000;
852  if (wfex->nSamplesPerSec < 5000)
853  wfex->nSamplesPerSec = 5000;
854 
855  device->pwfx = DSOUND_CopyFormat(wfex);
856  if ( device->pwfx == NULL ) {
857  *ppobj = NULL;
858  return DSERR_OUTOFMEMORY;
859  }
860 
863 
864  if ( *ppobj == NULL ) {
865  WARN("out of memory\n");
866  *ppobj = NULL;
867  return DSERR_OUTOFMEMORY;
868  } else {
869  HRESULT err = DS_OK;
870  LPBYTE newbuf;
871  DWORD buflen;
873 
874  This->ref = 1;
875  This->device = device;
876  This->device->capture_buffer = This;
877  This->notify = NULL;
878  This->nrofnotifies = 0;
879  This->hwnotify = NULL;
880 
882  lpcDSCBufferDesc->dwSize);
883  if (This->pdscbd)
884  CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
885  else {
886  WARN("no memory\n");
887  This->device->capture_buffer = 0;
888  HeapFree( GetProcessHeap(), 0, This );
889  *ppobj = NULL;
890  return DSERR_OUTOFMEMORY;
891  }
892 
893  This->lpVtbl = &dscbvt;
894 
895  if (device->driver) {
896  if (This->device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
897  FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
898 
899  if (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
900  /* allocate buffer from system memory */
901  buflen = lpcDSCBufferDesc->dwBufferBytes;
902  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
903  if (device->buffer)
904  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
905  else
906  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
907 
908  if (newbuf == NULL) {
909  WARN("failed to allocate capture buffer\n");
911  /* but the old buffer might still exist and must be re-prepared */
912  } else {
913  device->buffer = newbuf;
914  device->buflen = buflen;
915  }
916  } else {
917  /* let driver allocate memory */
918  device->buflen = lpcDSCBufferDesc->dwBufferBytes;
919  /* FIXME: */
920  HeapFree( GetProcessHeap(), 0, device->buffer);
921  device->buffer = NULL;
922  }
923 
925  device->pwfx,0,0,&(device->buflen),&(device->buffer),(LPVOID*)&(device->hwbuf));
926  if (err != DS_OK) {
927  WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
928  This->device->capture_buffer = 0;
929  HeapFree( GetProcessHeap(), 0, This );
930  *ppobj = NULL;
931  return err;
932  }
933  } else {
935  err = mmErr(waveInOpen(&(device->hwi),
936  device->drvdesc.dnDevNode, device->pwfx,
938  if (err != DS_OK) {
939  WARN("waveInOpen failed\n");
940  This->device->capture_buffer = 0;
941  HeapFree( GetProcessHeap(), 0, This );
942  *ppobj = NULL;
943  return err;
944  }
945 
946  buflen = lpcDSCBufferDesc->dwBufferBytes;
947  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
948  if (device->buffer)
949  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
950  else
951  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
952  if (newbuf == NULL) {
953  WARN("failed to allocate capture buffer\n");
955  /* but the old buffer might still exist and must be re-prepared */
956  } else {
957  device->buffer = newbuf;
958  device->buflen = buflen;
959  }
960  }
961  }
962 
963  TRACE("returning DS_OK\n");
964  return DS_OK;
965 }
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:361
DWORD dwSize
Definition: dsound.h:357
MMRESULT WINAPI waveInOpen(HWAVEIN *lphWaveIn, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2626
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
WORD nChannels
Definition: mmreg.h:79
#define WARN(fmt,...)
Definition: debug.h:112
DWORD dwBufferBytes
Definition: dsound.h:359
FxDevice * device
#define DSDDESC_DOMMSYSTEMOPEN
Definition: dsdriver.h:50
static void CALLBACK DSOUND_capture_callback(HWAVEIN hwi, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
Definition: capture.c:765
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
unsigned char * LPBYTE
Definition: typedefs.h:53
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
Definition: devices.h:37
VOID CALLBACK_FUNCTION(__in PVOID CallbackContext, __in_opt PVOID Argument1, __in_opt PVOID Argument2)
Definition: mxgeneralum.h:58
#define FIXME(fmt,...)
Definition: debug.h:111
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDsCaptureDriver_CreateCaptureBuffer(p, a, b, c, d, e, f)
Definition: dsdriver.h:323
LONG HRESULT
Definition: typedefs.h:79
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
#define CopyMemory
Definition: winbase.h:1662
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
WORD wFormatTag
Definition: mmreg.h:78
static const IDirectSoundCaptureBuffer8Vtbl dscbvt
Definition: capture.c:716
#define err(...)
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HeapReAlloc
Definition: compat.h:593
WORD cbSize
Definition: mmreg.h:84
#define WAVE_MAPPED
Definition: mmsystem.h:190
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
WORD wBitsPerSample
Definition: mmreg.h:83
#define HeapFree(x, y, z)
Definition: compat.h:594
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52

Referenced by IDirectSoundCaptureImpl_CreateCaptureBuffer().

◆ IDirectSoundCaptureBufferImpl_GetCaps()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCaps ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPDSCBCAPS  lpDSCBCaps 
)
static

Definition at line 286 of file capture.c.

289 {
291  TRACE( "(%p,%p)\n", This, lpDSCBCaps );
292 
293  if (lpDSCBCaps == NULL) {
294  WARN("invalid parameter: lpDSCBCaps == NULL\n");
295  return DSERR_INVALIDPARAM;
296  }
297 
298  if (lpDSCBCaps->dwSize < sizeof(DSCBCAPS)) {
299  WARN("invalid parameter: lpDSCBCaps->dwSize = %d\n", lpDSCBCaps->dwSize);
300  return DSERR_INVALIDPARAM;
301  }
302 
303  if (This->device == NULL) {
304  WARN("invalid parameter: This->device == NULL\n");
305  return DSERR_INVALIDPARAM;
306  }
307 
308  lpDSCBCaps->dwSize = sizeof(DSCBCAPS);
309  lpDSCBCaps->dwFlags = This->flags;
310  lpDSCBCaps->dwBufferBytes = This->pdscbd->dwBufferBytes;
311  lpDSCBCaps->dwReserved = 0;
312 
313  TRACE("returning DS_OK\n");
314  return DS_OK;
315 }
#define WARN(fmt,...)
Definition: debug.h:112
DWORD dwBufferBytes
Definition: dsound.h:380
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
DWORD dwSize
Definition: dsound.h:378
DWORD dwFlags
Definition: dsound.h:379
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
struct _DSCBCAPS DSCBCAPS
DWORD dwReserved
Definition: dsound.h:381
#define NULL
Definition: types.h:112

◆ IDirectSoundCaptureBufferImpl_GetCurrentPosition()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCurrentPosition ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPDWORD  lpdwCapturePosition,
LPDWORD  lpdwReadPosition 
)
static

Definition at line 318 of file capture.c.

322 {
324  HRESULT hres = DS_OK;
325  TRACE( "(%p,%p,%p)\n", This, lpdwCapturePosition, lpdwReadPosition );
326 
327  if (This->device == NULL) {
328  WARN("invalid parameter: This->device == NULL\n");
329  return DSERR_INVALIDPARAM;
330  }
331 
332  if (This->device->driver) {
333  hres = IDsCaptureDriverBuffer_GetPosition(This->device->hwbuf, lpdwCapturePosition, lpdwReadPosition );
334  if (hres != DS_OK)
335  WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
336  } else if (This->device->hwi) {
337  DWORD pos;
338 
339  EnterCriticalSection(&This->device->lock);
340  pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer;
341  if (lpdwCapturePosition)
342  *lpdwCapturePosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
343  if (lpdwReadPosition)
344  *lpdwReadPosition = pos;
345  LeaveCriticalSection(&This->device->lock);
346 
347  } else {
348  WARN("no driver\n");
350  }
351 
352  TRACE("cappos=%d readpos=%d\n", (lpdwCapturePosition?*lpdwCapturePosition:-1), (lpdwReadPosition?*lpdwReadPosition:-1));
353  TRACE("returning %08x\n", hres);
354  return hres;
355 }
#define DWORD_PTR
Definition: treelist.c:76
#define IDsCaptureDriverBuffer_GetPosition(p, a, b)
Definition: dsdriver.h:356
#define WARN(fmt,...)
Definition: debug.h:112
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DSERR_NODRIVER
Definition: dsound.h:128
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define NULL
Definition: types.h:112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IDirectSoundCaptureBufferImpl_GetFormat()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFormat ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPWAVEFORMATEX  lpwfxFormat,
DWORD  dwSizeAllocated,
LPDWORD  lpdwSizeWritten 
)
static

Definition at line 358 of file capture.c.

363 {
365  HRESULT hres = DS_OK;
366  TRACE( "(%p,%p,0x%08x,%p)\n", This, lpwfxFormat, dwSizeAllocated,
367  lpdwSizeWritten );
368 
369  if (This->device == NULL) {
370  WARN("invalid parameter: This->device == NULL\n");
371  return DSERR_INVALIDPARAM;
372  }
373 
374  if (dwSizeAllocated > (sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize))
375  dwSizeAllocated = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
376 
377  if (lpwfxFormat) { /* NULL is valid (just want size) */
378  CopyMemory(lpwfxFormat, This->device->pwfx, dwSizeAllocated);
379  if (lpdwSizeWritten)
380  *lpdwSizeWritten = dwSizeAllocated;
381  } else {
382  if (lpdwSizeWritten)
383  *lpdwSizeWritten = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
384  else {
385  TRACE("invalid parameter: lpdwSizeWritten = NULL\n");
387  }
388  }
389 
390  TRACE("returning %08x\n", hres);
391  return hres;
392 }
#define WARN(fmt,...)
Definition: debug.h:112
struct tWAVEFORMATEX WAVEFORMATEX
Definition: austream.idl:23
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define CopyMemory
Definition: winbase.h:1662
#define NULL
Definition: types.h:112

◆ IDirectSoundCaptureBufferImpl_GetFXStatus()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFXStatus ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
DWORD  dwFXCount,
LPDWORD  pdwFXStatus 
)
static

Definition at line 704 of file capture.c.

708 {
710 
711  FIXME( "(%p,%u,%p): stub\n", This, dwFXCount, pdwFXStatus );
712 
713  return DS_OK;
714 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define DS_OK
Definition: dsound.h:116

◆ IDirectSoundCaptureBufferImpl_GetObjectInPath()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetObjectInPath ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
REFGUID  rguidObject,
DWORD  dwIndex,
REFGUID  rguidInterface,
LPVOID ppObject 
)
static

Definition at line 688 of file capture.c.

694 {
696 
697  FIXME( "(%p,%s,%u,%s,%p): stub\n", This, debugstr_guid(rguidObject),
698  dwIndex, debugstr_guid(rguidInterface), ppObject );
699 
700  return DS_OK;
701 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define DS_OK
Definition: dsound.h:116

◆ IDirectSoundCaptureBufferImpl_GetStatus()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetStatus ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPDWORD  lpdwStatus 
)
static

Definition at line 395 of file capture.c.

398 {
400  TRACE( "(%p, %p), thread is %04x\n", This, lpdwStatus, GetCurrentThreadId() );
401 
402  if (This->device == NULL) {
403  WARN("invalid parameter: This->device == NULL\n");
404  return DSERR_INVALIDPARAM;
405  }
406 
407  if (lpdwStatus == NULL) {
408  WARN("invalid parameter: lpdwStatus == NULL\n");
409  return DSERR_INVALIDPARAM;
410  }
411 
412  *lpdwStatus = 0;
413  EnterCriticalSection(&(This->device->lock));
414 
415  TRACE("old This->device->state=%s, old lpdwStatus=%08x\n",
416  captureStateString[This->device->state],*lpdwStatus);
417  if ((This->device->state == STATE_STARTING) ||
418  (This->device->state == STATE_CAPTURING)) {
419  *lpdwStatus |= DSCBSTATUS_CAPTURING;
420  if (This->flags & DSCBSTART_LOOPING)
421  *lpdwStatus |= DSCBSTATUS_LOOPING;
422  }
423  TRACE("new This->device->state=%s, new lpdwStatus=%08x\n",
424  captureStateString[This->device->state],*lpdwStatus);
425  LeaveCriticalSection(&(This->device->lock));
426 
427  TRACE("status=%x\n", *lpdwStatus);
428  TRACE("returning DS_OK\n");
429  return DS_OK;
430 }
#define WARN(fmt,...)
Definition: debug.h:112
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define DSCBSTATUS_CAPTURING
Definition: dsound.h:396
#define STATE_CAPTURING
#define STATE_STARTING
#define DSCBSTART_LOOPING
Definition: dsound.h:393
#define NULL
Definition: types.h:112
static const char *const captureStateString[]
Definition: capture.c:169
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define DSCBSTATUS_LOOPING
Definition: dsound.h:397

◆ IDirectSoundCaptureBufferImpl_Initialize()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Initialize ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPDIRECTSOUNDCAPTURE  lpDSC,
LPCDSCBUFFERDESC  lpcDSCBDesc 
)
static

Definition at line 433 of file capture.c.

437 {
439 
440  FIXME( "(%p,%p,%p): stub\n", This, lpDSC, lpcDSCBDesc );
441 
442  return DS_OK;
443 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define DS_OK
Definition: dsound.h:116

◆ IDirectSoundCaptureBufferImpl_Lock()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Lock ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
DWORD  dwReadCusor,
DWORD  dwReadBytes,
LPVOID lplpvAudioPtr1,
LPDWORD  lpdwAudioBytes1,
LPVOID lplpvAudioPtr2,
LPDWORD  lpdwAudioBytes2,
DWORD  dwFlags 
)
static

Definition at line 446 of file capture.c.

455 {
456  HRESULT hres = DS_OK;
458  TRACE( "(%p,%08u,%08u,%p,%p,%p,%p,0x%08x) at %d\n", This, dwReadCusor,
459  dwReadBytes, lplpvAudioPtr1, lpdwAudioBytes1, lplpvAudioPtr2,
460  lpdwAudioBytes2, dwFlags, GetTickCount() );
461 
462  if (This->device == NULL) {
463  WARN("invalid parameter: This->device == NULL\n");
464  return DSERR_INVALIDPARAM;
465  }
466 
467  if (lplpvAudioPtr1 == NULL) {
468  WARN("invalid parameter: lplpvAudioPtr1 == NULL\n");
469  return DSERR_INVALIDPARAM;
470  }
471 
472  if (lpdwAudioBytes1 == NULL) {
473  WARN("invalid parameter: lpdwAudioBytes1 == NULL\n");
474  return DSERR_INVALIDPARAM;
475  }
476 
477  EnterCriticalSection(&(This->device->lock));
478 
479  if (This->device->driver) {
480  hres = IDsCaptureDriverBuffer_Lock(This->device->hwbuf, lplpvAudioPtr1,
481  lpdwAudioBytes1, lplpvAudioPtr2,
482  lpdwAudioBytes2, dwReadCusor,
483  dwReadBytes, dwFlags);
484  if (hres != DS_OK)
485  WARN("IDsCaptureDriverBuffer_Lock failed\n");
486  } else if (This->device->hwi) {
487  *lplpvAudioPtr1 = This->device->buffer + dwReadCusor;
488  if ( (dwReadCusor + dwReadBytes) > This->device->buflen) {
489  *lpdwAudioBytes1 = This->device->buflen - dwReadCusor;
490  if (lplpvAudioPtr2)
491  *lplpvAudioPtr2 = This->device->buffer;
492  if (lpdwAudioBytes2)
493  *lpdwAudioBytes2 = dwReadBytes - *lpdwAudioBytes1;
494  } else {
495  *lpdwAudioBytes1 = dwReadBytes;
496  if (lplpvAudioPtr2)
497  *lplpvAudioPtr2 = 0;
498  if (lpdwAudioBytes2)
499  *lpdwAudioBytes2 = 0;
500  }
501  } else {
502  TRACE("invalid call\n");
503  hres = DSERR_INVALIDCALL; /* DSERR_NODRIVER ? */
504  }
505 
506  LeaveCriticalSection(&(This->device->lock));
507 
508  TRACE("returning %08x\n", hres);
509  return hres;
510 }
#define DSERR_INVALIDCALL
Definition: dsound.h:122
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NULL
Definition: types.h:112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define IDsCaptureDriverBuffer_Lock(p, a, b, c, d, e, f, g)
Definition: dsdriver.h:353

◆ IDirectSoundCaptureBufferImpl_QueryInterface()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 181 of file capture.c.

185 {
187  HRESULT hres;
188  TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
189 
190  if (ppobj == NULL) {
191  WARN("invalid parameter\n");
192  return E_INVALIDARG;
193  }
194 
195  *ppobj = NULL;
196 
197  if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
198  if (!This->notify)
200  if (This->notify) {
202  if (This->device->hwbuf && !This->hwnotify) {
204  &IID_IDsDriverNotify, (LPVOID*)&(This->hwnotify));
205  if (hres != DS_OK) {
206  WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
208  *ppobj = 0;
209  return hres;
210  }
211  }
212 
213  *ppobj = This->notify;
214  return DS_OK;
215  }
216 
217  WARN("IID_IDirectSoundNotify\n");
218  return E_FAIL;
219  }
220 
221  if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
222  IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
224  *ppobj = This;
225  return NO_ERROR;
226  }
227 
228  FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj);
229  return E_NOINTERFACE;
230 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define NO_ERROR
Definition: dderror.h:5
#define E_FAIL
Definition: ddrawi.h:102
#define IDirectSoundCaptureBuffer8_AddRef(p)
Definition: dsound.h:836
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define IDirectSoundNotify_AddRef(p)
Definition: dsound.h:893
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define IDsCaptureDriverBuffer_QueryInterface(p, a, b)
Definition: dsdriver.h:349
static HRESULT IDirectSoundCaptureNotifyImpl_Create(IDirectSoundCaptureBufferImpl *dscb, IDirectSoundCaptureNotifyImpl **pdscn)
Definition: capture.c:144
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
Definition: dsound.h:82
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define IDirectSoundNotify_Release(p)
Definition: dsound.h:894

◆ IDirectSoundCaptureBufferImpl_Release()

static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release ( LPDIRECTSOUNDCAPTUREBUFFER8  iface)
static

Definition at line 242 of file capture.c.

243 {
245  ULONG ref = InterlockedDecrement(&(This->ref));
246  TRACE("(%p) ref was %d\n", This, ref + 1);
247 
248  if (!ref) {
249  TRACE("deleting object\n");
250  if (This->device->state == STATE_CAPTURING)
251  This->device->state = STATE_STOPPING;
252 
253  HeapFree(GetProcessHeap(),0, This->pdscbd);
254 
255  if (This->device->hwi) {
256  waveInReset(This->device->hwi);
257  waveInClose(This->device->hwi);
258  HeapFree(GetProcessHeap(),0, This->device->pwave);
259  This->device->pwave = 0;
260  This->device->hwi = 0;
261  }
262 
263  if (This->device->hwbuf)
264  IDsCaptureDriverBuffer_Release(This->device->hwbuf);
265 
266  /* remove from DirectSoundCaptureDevice */
267  This->device->capture_buffer = NULL;
268 
269  if (This->notify)
271 
272  /* If driver manages its own buffer, IDsCaptureDriverBuffer_Release
273  should have freed the buffer. Prevent freeing it again in
274  IDirectSoundCaptureBufferImpl_Create */
275  if (!(This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY))
276  This->device->buffer = NULL;
277 
278  HeapFree(GetProcessHeap(), 0, This->notifies);
279  HeapFree( GetProcessHeap(), 0, This );
280  TRACE("(%p) released\n", This);
281  }
282  return ref;
283 }
UINT WINAPI waveInClose(HWAVEIN hWaveIn)
Definition: winmm.c:2637
Definition: send.c:48
#define IDsCaptureDriverBuffer_Release(p)
Definition: dsdriver.h:351
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
#define STATE_CAPTURING
#define InterlockedDecrement
Definition: armddk.h:52
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
Definition: dsound.h:82
UINT WINAPI waveInReset(HWAVEIN hWaveIn)
Definition: winmm.c:2737
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define IDirectSoundNotify_Release(p)
Definition: dsound.h:894
#define STATE_STOPPING
#define HeapFree(x, y, z)
Definition: compat.h:594
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52

Referenced by DirectSoundCaptureDevice_Release().

◆ IDirectSoundCaptureBufferImpl_Start()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
DWORD  dwFlags 
)
static

Definition at line 513 of file capture.c.

516 {
517  HRESULT hres = DS_OK;
519  TRACE( "(%p,0x%08x)\n", This, dwFlags );
520 
521  if (This->device == NULL) {
522  WARN("invalid parameter: This->device == NULL\n");
523  return DSERR_INVALIDPARAM;
524  }
525 
526  if ( (This->device->driver == 0) && (This->device->hwi == 0) ) {
527  WARN("no driver\n");
528  return DSERR_NODRIVER;
529  }
530 
531  EnterCriticalSection(&(This->device->lock));
532 
533  This->flags = dwFlags;
534  TRACE("old This->state=%s\n",captureStateString[This->device->state]);
535  if (This->device->state == STATE_STOPPED)
536  This->device->state = STATE_STARTING;
537  else if (This->device->state == STATE_STOPPING)
538  This->device->state = STATE_CAPTURING;
539  TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
540 
541  LeaveCriticalSection(&(This->device->lock));
542 
543  if (This->device->driver) {
544  hres = IDsCaptureDriverBuffer_Start(This->device->hwbuf, dwFlags);
545  if (hres != DS_OK)
546  WARN("IDsCaptureDriverBuffer_Start failed\n");
547  } else if (This->device->hwi) {
549 
550  if (device->buffer) {
551  int c;
552  DWORD blocksize = DSOUND_fraglen(device->pwfx->nSamplesPerSec, device->pwfx->nBlockAlign);
553  device->nrofpwaves = device->buflen / blocksize + !!(device->buflen % blocksize);
554  TRACE("nrofpwaves=%d\n", device->nrofpwaves);
555 
556  /* prepare headers */
557  if (device->pwave)
558  device->pwave = HeapReAlloc(GetProcessHeap(), 0,device->pwave, device->nrofpwaves*sizeof(WAVEHDR));
559  else
560  device->pwave = HeapAlloc(GetProcessHeap(), 0, device->nrofpwaves*sizeof(WAVEHDR));
561 
562  for (c = 0; c < device->nrofpwaves; ++c) {
563  device->pwave[c].lpData = (char *)device->buffer + c * blocksize;
564  if (c + 1 == device->nrofpwaves)
565  device->pwave[c].dwBufferLength = device->buflen - c * blocksize;
566  else
567  device->pwave[c].dwBufferLength = blocksize;
568  device->pwave[c].dwBytesRecorded = 0;
569  device->pwave[c].dwUser = (DWORD_PTR)device;
570  device->pwave[c].dwFlags = 0;
571  device->pwave[c].dwLoops = 0;
572  hres = mmErr(waveInPrepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR)));
573  if (hres != DS_OK) {
574  WARN("waveInPrepareHeader failed\n");
575  while (c--)
576  waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
577  break;
578  }
579 
580  hres = mmErr(waveInAddBuffer(device->hwi, &(device->pwave[c]), sizeof(WAVEHDR)));
581  if (hres != DS_OK) {
582  WARN("waveInAddBuffer failed\n");
583  while (c--)
584  waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
585  break;
586  }
587  }
588 
589  FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
590  }
591 
592  device->index = 0;
593 
594  if (hres == DS_OK) {
595  /* start filling the first buffer */
596  hres = mmErr(waveInStart(device->hwi));
597  if (hres != DS_OK)
598  WARN("waveInStart failed\n");
599  }
600 
601  if (hres != DS_OK) {
602  WARN("calling waveInClose because of error\n");
603  waveInClose(device->hwi);
604  device->hwi = 0;
605  }
606  } else {
607  WARN("no driver\n");
609  }
610 
611  TRACE("returning %08x\n", hres);
612  return hres;
613 }
UINT WINAPI waveInClose(HWAVEIN hWaveIn)
Definition: winmm.c:2637
#define DWORD_PTR
Definition: treelist.c:76
#define WARN(fmt,...)
Definition: debug.h:112
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
if(dx==0 &&dy==0)
Definition: linetemp.h:174
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2656
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
Definition: devices.h:37
UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2687
#define DSERR_NODRIVER
Definition: dsound.h:128
#define STATE_STOPPED
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
#define STATE_CAPTURING
const GLubyte * c
Definition: glext.h:8905
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
#define STATE_STARTING
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2720
#define IDsCaptureDriverBuffer_Start(p, a)
Definition: dsdriver.h:358
UINT WINAPI waveInStart(HWAVEIN hWaveIn)
Definition: winmm.c:2752
DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign) DECLSPEC_HIDDEN
Definition: primary.c:36
#define HeapReAlloc
Definition: compat.h:593
#define NULL
Definition: types.h:112
static const char *const captureStateString[]
Definition: capture.c:169
#define c
Definition: ke_i.h:80
#define STATE_STOPPING
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IDirectSoundCaptureBufferImpl_Stop()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop ( LPDIRECTSOUNDCAPTUREBUFFER8  iface)
static

Definition at line 616 of file capture.c.

617 {
618  HRESULT hres = DS_OK;
620  TRACE( "(%p)\n", This );
621 
622  if (This->device == NULL) {
623  WARN("invalid parameter: This->device == NULL\n");
624  return DSERR_INVALIDPARAM;
625  }
626 
627  EnterCriticalSection(&(This->device->lock));
628 
629  TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
630  if (This->device->state == STATE_CAPTURING)
631  This->device->state = STATE_STOPPING;
632  else if (This->device->state == STATE_STARTING)
633  This->device->state = STATE_STOPPED;
634  TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
635 
636  LeaveCriticalSection(&(This->device->lock));
637 
638  if (This->device->driver) {
639  hres = IDsCaptureDriverBuffer_Stop(This->device->hwbuf);
640  if (hres != DS_OK)
641  WARN("IDsCaptureDriverBuffer_Stop() failed\n");
642  } else if (This->device->hwi) {
643  hres = mmErr(waveInReset(This->device->hwi));
644  if (hres != DS_OK)
645  WARN("waveInReset() failed\n");
646  } else {
647  WARN("no driver\n");
649  }
650 
651  TRACE("returning %08x\n", hres);
652  return hres;
653 }
#define WARN(fmt,...)
Definition: debug.h:112
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define IDsCaptureDriverBuffer_Stop(p)
Definition: dsdriver.h:359
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DSERR_NODRIVER
Definition: dsound.h:128
#define STATE_STOPPED
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define STATE_CAPTURING
#define STATE_STARTING
UINT WINAPI waveInReset(HWAVEIN hWaveIn)
Definition: winmm.c:2737
#define NULL
Definition: types.h:112
static const char *const captureStateString[]
Definition: capture.c:169
#define STATE_STOPPING
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IDirectSoundCaptureBufferImpl_Unlock()

static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Unlock ( LPDIRECTSOUNDCAPTUREBUFFER8  iface,
LPVOID  lpvAudioPtr1,
DWORD  dwAudioBytes1,
LPVOID  lpvAudioPtr2,
DWORD  dwAudioBytes2 
)
static

Definition at line 656 of file capture.c.

662 {
663  HRESULT hres = DS_OK;
665  TRACE( "(%p,%p,%08u,%p,%08u)\n", This, lpvAudioPtr1, dwAudioBytes1,
666  lpvAudioPtr2, dwAudioBytes2 );
667 
668  if (lpvAudioPtr1 == NULL) {
669  WARN("invalid parameter: lpvAudioPtr1 == NULL\n");
670  return DSERR_INVALIDPARAM;
671  }
672 
673  if (This->device->driver) {
674  hres = IDsCaptureDriverBuffer_Unlock(This->device->hwbuf, lpvAudioPtr1,
675  dwAudioBytes1, lpvAudioPtr2, dwAudioBytes2);
676  if (hres != DS_OK)
677  WARN("IDsCaptureDriverBuffer_Unlock failed\n");
678  } else if (!This->device->hwi) {
679  WARN("invalid call\n");
681  }
682 
683  TRACE("returning %08x\n", hres);
684  return hres;
685 }
#define DSERR_INVALIDCALL
Definition: dsound.h:122
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define NULL
Definition: types.h:112
#define IDsCaptureDriverBuffer_Unlock(p, a, b, c, d)
Definition: dsdriver.h:354

◆ IDirectSoundCaptureImpl_AddRef()

static ULONG WINAPI IDirectSoundCaptureImpl_AddRef ( LPDIRECTSOUNDCAPTURE  iface)
static

Definition at line 1188 of file capture.c.

1189 {
1191  ULONG ref = InterlockedIncrement(&(This->ref));
1192  TRACE("(%p) ref was %d\n", This, ref - 1);
1193  return ref;
1194 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSoundCaptureImpl_Create()

static HRESULT IDirectSoundCaptureImpl_Create ( LPDIRECTSOUNDCAPTURE8 ppDSC)
static

Definition at line 1313 of file capture.c.

1315 {
1317  TRACE("(%p)\n", ppDSC);
1318 
1319  /* Allocate memory */
1321  if (pDSC == NULL) {
1322  WARN("out of memory\n");
1323  *ppDSC = NULL;
1324  return DSERR_OUTOFMEMORY;
1325  }
1326 
1327  pDSC->lpVtbl = &dscvt;
1328  pDSC->ref = 0;
1329  pDSC->device = NULL;
1330 
1331  *ppDSC = (LPDIRECTSOUNDCAPTURE8)pDSC;
1332 
1333  return DS_OK;
1334 }
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const IDirectSoundCaptureVtbl * lpVtbl
Definition: capture.c:1148
static const IDirectSoundCaptureVtbl dscvt
Definition: capture.c:1300
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DirectSoundCaptureDevice * device
Definition: capture.c:1151

Referenced by DSOUND_CaptureCreate(), and DSOUND_CaptureCreate8().

◆ IDirectSoundCaptureImpl_CreateCaptureBuffer()

static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer ( LPDIRECTSOUNDCAPTURE  iface,
LPCDSCBUFFERDESC  lpcDSCBufferDesc,
LPDIRECTSOUNDCAPTUREBUFFER lplpDSCaptureBuffer,
LPUNKNOWN  pUnk 
)
static

Definition at line 1213 of file capture.c.

1218 {
1219  HRESULT hr;
1221 
1222  TRACE( "(%p,%p,%p,%p)\n",iface,lpcDSCBufferDesc,lplpDSCaptureBuffer,pUnk);
1223 
1224  if (lpcDSCBufferDesc == NULL) {
1225  WARN("invalid parameter: lpcDSCBufferDesc == NULL)\n");
1226  return DSERR_INVALIDPARAM;
1227  }
1228 
1229  if (lplpDSCaptureBuffer == NULL) {
1230  WARN("invalid parameter: lplpDSCaptureBuffer == NULL\n");
1231  return DSERR_INVALIDPARAM;
1232  }
1233 
1234  if (pUnk != NULL) {
1235  WARN("invalid parameter: pUnk != NULL\n");
1236  return DSERR_INVALIDPARAM;
1237  }
1238 
1239  /* FIXME: We can only have one buffer so what do we do here? */
1240  if (This->device->capture_buffer) {
1241  WARN("invalid parameter: already has buffer\n");
1242  return DSERR_INVALIDPARAM; /* DSERR_GENERIC ? */
1243  }
1244 
1246  (IDirectSoundCaptureBufferImpl **)lplpDSCaptureBuffer, lpcDSCBufferDesc);
1247 
1248  if (hr != DS_OK)
1249  WARN("IDirectSoundCaptureBufferImpl_Create failed\n");
1250 
1251  return hr;
1252 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
static HRESULT IDirectSoundCaptureBufferImpl_Create(DirectSoundCaptureDevice *device, IDirectSoundCaptureBufferImpl **ppobj, LPCDSCBUFFERDESC lpcDSCBufferDesc)
Definition: capture.c:807
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define NULL
Definition: types.h:112
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ IDirectSoundCaptureImpl_GetCaps()

static HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps ( LPDIRECTSOUNDCAPTURE  iface,
LPDSCCAPS  lpDSCCaps 
)
static

Definition at line 1254 of file capture.c.

1257 {
1259  TRACE("(%p,%p)\n",This,lpDSCCaps);
1260 
1261  if (This->device == NULL) {
1262  WARN("not initialized\n");
1263  return DSERR_UNINITIALIZED;
1264  }
1265 
1266  if (lpDSCCaps== NULL) {
1267  WARN("invalid parameter: lpDSCCaps== NULL\n");
1268  return DSERR_INVALIDPARAM;
1269  }
1270 
1271  if (lpDSCCaps->dwSize < sizeof(*lpDSCCaps)) {
1272  WARN("invalid parameter: lpDSCCaps->dwSize = %d\n", lpDSCCaps->dwSize);
1273  return DSERR_INVALIDPARAM;
1274  }
1275 
1276  lpDSCCaps->dwFlags = This->device->drvcaps.dwFlags;
1277  lpDSCCaps->dwFormats = This->device->drvcaps.dwFormats;
1278  lpDSCCaps->dwChannels = This->device->drvcaps.dwChannels;
1279 
1280  TRACE("(flags=0x%08x,format=0x%08x,channels=%d)\n",lpDSCCaps->dwFlags,
1281  lpDSCCaps->dwFormats, lpDSCCaps->dwChannels);
1282 
1283  return DS_OK;
1284 }
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwFormats
Definition: dsound.h:371
DWORD dwFlags
Definition: dsound.h:370
#define NULL
Definition: types.h:112
DWORD dwChannels
Definition: dsound.h:372
DWORD dwSize
Definition: dsound.h:369

◆ IDirectSoundCaptureImpl_Initialize()

static HRESULT WINAPI IDirectSoundCaptureImpl_Initialize ( LPDIRECTSOUNDCAPTURE  iface,
LPCGUID  lpcGUID 
)
static

Definition at line 1286 of file capture.c.

1289 {
1291  TRACE("(%p,%s)\n", This, debugstr_guid(lpcGUID));
1292 
1293  if (This->device != NULL) {
1294  WARN("already initialized\n");
1295  return DSERR_ALREADYINITIALIZED;
1296  }
1297  return DirectSoundCaptureDevice_Initialize(&This->device, lpcGUID);
1298 }
#define WARN(fmt,...)
Definition: debug.h:112
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT DirectSoundCaptureDevice_Initialize(DirectSoundCaptureDevice **ppDevice, LPCGUID lpcGUID)
Definition: capture.c:1025
#define NULL
Definition: types.h:112

◆ IDirectSoundCaptureImpl_QueryInterface()

static HRESULT WINAPI IDirectSoundCaptureImpl_QueryInterface ( LPDIRECTSOUNDCAPTURE  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 1158 of file capture.c.

1162 {
1164  TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
1165 
1166  if (ppobj == NULL) {
1167  WARN("invalid parameter\n");
1168  return E_INVALIDARG;
1169  }
1170 
1171  *ppobj = NULL;
1172 
1173  if (IsEqualIID(riid, &IID_IUnknown)) {
1175  *ppobj = This;
1176  return DS_OK;
1177  } else if (IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1179  *ppobj = This;
1180  return DS_OK;
1181  }
1182 
1183  WARN("unsupported riid: %s\n", debugstr_guid(riid));
1184  return E_NOINTERFACE;
1185 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
#define NULL
Definition: types.h:112
#define IDirectSoundCapture_AddRef(p)
Definition: dsound.h:735
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ IDirectSoundCaptureImpl_Release()

static ULONG WINAPI IDirectSoundCaptureImpl_Release ( LPDIRECTSOUNDCAPTURE  iface)
static

Definition at line 1197 of file capture.c.

1198 {
1200  ULONG ref = InterlockedDecrement(&(This->ref));
1201  TRACE("(%p) ref was %d\n", This, ref + 1);
1202 
1203  if (!ref) {
1204  if (This->device)
1206 
1207  HeapFree( GetProcessHeap(), 0, This );
1208  TRACE("(%p) released\n", This);
1209  }
1210  return ref;
1211 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static ULONG DirectSoundCaptureDevice_Release(DirectSoundCaptureDevice *device)
Definition: capture.c:998
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ IDirectSoundCaptureNotifyImpl_AddRef()

static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef ( LPDIRECTSOUNDNOTIFY  iface)
static

Definition at line 60 of file capture.c.

61 {
64  TRACE("(%p) ref was %d\n", This, ref - 1);
65  return ref;
66 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSoundCaptureNotifyImpl_Create()

static HRESULT IDirectSoundCaptureNotifyImpl_Create ( IDirectSoundCaptureBufferImpl dscb,
IDirectSoundCaptureNotifyImpl **  pdscn 
)
static

Definition at line 144 of file capture.c.

147 {
149  TRACE("(%p,%p)\n",dscb,pdscn);
150 
151  dscn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dscn));
152 
153  if (dscn == NULL) {
154  WARN("out of memory\n");
155  return DSERR_OUTOFMEMORY;
156  }
157 
158  dscn->ref = 0;
159  dscn->lpVtbl = &dscnvt;
160  dscn->dscb = dscb;
161  dscb->notify = dscn;
163 
164  *pdscn = dscn;
165  return DS_OK;
166 }
#define IDirectSoundCaptureBuffer_AddRef(p)
Definition: dsound.h:778
IDirectSoundCaptureNotifyImpl * notify
#define WARN(fmt,...)
Definition: debug.h:112
const IDirectSoundNotifyVtbl * lpVtbl
Definition: capture.c:36
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
IDirectSoundCaptureBufferImpl * dscb
Definition: capture.c:38
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static const IDirectSoundNotifyVtbl dscnvt
Definition: capture.c:136

Referenced by IDirectSoundCaptureBufferImpl_QueryInterface().

◆ IDirectSoundCaptureNotifyImpl_QueryInterface()

static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface ( LPDIRECTSOUNDNOTIFY  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 44 of file capture.c.

48 {
50  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
51 
52  if (This->dscb == NULL) {
53  WARN("invalid parameter\n");
54  return E_INVALIDARG;
55  }
56 
58 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#define NULL
Definition: types.h:112
#define IDirectSoundCaptureBuffer_QueryInterface(p, a, b)
Definition: dsound.h:777

◆ IDirectSoundCaptureNotifyImpl_Release()

static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release ( LPDIRECTSOUNDNOTIFY  iface)
static

Definition at line 68 of file capture.c.

69 {
72  TRACE("(%p) ref was %d\n", This, ref + 1);
73 
74  if (!ref) {
75  if (This->dscb->hwnotify)
76  IDsDriverNotify_Release(This->dscb->hwnotify);
77  This->dscb->notify=NULL;
80  TRACE("(%p) released\n", This);
81  }
82  return ref;
83 }
#define IDirectSoundCaptureBuffer_Release(p)
Definition: dsound.h:779
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
#define IDsDriverNotify_Release(p)
Definition: dsdriver.h:289
#define InterlockedDecrement
Definition: armddk.h:52
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ IDirectSoundCaptureNotifyImpl_SetNotificationPositions()

static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions ( LPDIRECTSOUNDNOTIFY  iface,
DWORD  howmuch,
LPCDSBPOSITIONNOTIFY  notify 
)
static

Definition at line 85 of file capture.c.

89 {
91  TRACE("(%p,0x%08x,%p)\n",This,howmuch,notify);
92 
93  if (howmuch > 0 && notify == NULL) {
94  WARN("invalid parameter: notify == NULL\n");
95  return DSERR_INVALIDPARAM;
96  }
97 
98  if (TRACE_ON(dsound)) {
99  unsigned int i;
100  for (i=0;i<howmuch;i++)
101  TRACE("notify at %d to %p\n",
102  notify[i].dwOffset,notify[i].hEventNotify);
103  }
104 
105  if (This->dscb->hwnotify) {
106  HRESULT hres;
107  hres = IDsDriverNotify_SetNotificationPositions(This->dscb->hwnotify, howmuch, notify);
108  if (hres != DS_OK)
109  WARN("IDsDriverNotify_SetNotificationPositions failed\n");
110  return hres;
111  } else if (howmuch > 0) {
112  /* Make an internal copy of the caller-supplied array.
113  * Replace the existing copy if one is already present. */
114  if (This->dscb->notifies)
115  This->dscb->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
116  This->dscb->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
117  else
118  This->dscb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
119  howmuch * sizeof(DSBPOSITIONNOTIFY));
120 
121  if (This->dscb->notifies == NULL) {
122  WARN("out of memory\n");
123  return DSERR_OUTOFMEMORY;
124  }
125  CopyMemory(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
126  This->dscb->nrofnotifies = howmuch;
127  } else {
128  HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
129  This->dscb->notifies = NULL;
130  This->dscb->nrofnotifies = 0;
131  }
132 
133  return S_OK;
134 }
#define WARN(fmt,...)
Definition: debug.h:112
int notify
Definition: msacm.c:1365
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
#define CopyMemory
Definition: winbase.h:1662
#define S_OK
Definition: intsafe.h:52
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
#define HeapReAlloc
Definition: compat.h:593
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define TRACE_ON(x)
Definition: compat.h:75
#define HeapFree(x, y, z)
Definition: compat.h:594
#define IDsDriverNotify_SetNotificationPositions(p, a, b)
Definition: dsdriver.h:291

Variable Documentation

◆ captureStateString

const char* const captureStateString[]
static
Initial value:
= {
"STATE_STOPPED",
"STATE_STARTING",
"STATE_CAPTURING",
"STATE_STOPPING"
}

Definition at line 169 of file capture.c.

Referenced by DSOUND_capture_callback(), IDirectSoundCaptureBufferImpl_GetStatus(), IDirectSoundCaptureBufferImpl_Start(), and IDirectSoundCaptureBufferImpl_Stop().

◆ dscbvt

const IDirectSoundCaptureBuffer8Vtbl dscbvt
static
Initial value:
=
{
}
static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:233
static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:242
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFlags)
Definition: capture.c:513
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:616
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetStatus(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwStatus)
Definition: capture.c:395
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFormat(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPWAVEFORMATEX lpwfxFormat, DWORD dwSizeAllocated, LPDWORD lpdwSizeWritten)
Definition: capture.c:358
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface(LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:181
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFXStatus(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFXCount, LPDWORD pdwFXStatus)
Definition: capture.c:704
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Initialize(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDIRECTSOUNDCAPTURE lpDSC, LPCDSCBUFFERDESC lpcDSCBDesc)
Definition: capture.c:433
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Lock(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwReadCusor, DWORD dwReadBytes, LPVOID *lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID *lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags)
Definition: capture.c:446
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Unlock(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPVOID lpvAudioPtr1, DWORD dwAudioBytes1, LPVOID lpvAudioPtr2, DWORD dwAudioBytes2)
Definition: capture.c:656
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCaps(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDSCBCAPS lpDSCBCaps)
Definition: capture.c:286
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCurrentPosition(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwCapturePosition, LPDWORD lpdwReadPosition)
Definition: capture.c:318
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetObjectInPath(LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject)
Definition: capture.c:688

Definition at line 716 of file capture.c.

Referenced by IDirectSoundCaptureBufferImpl_Create().

◆ dscnvt

const IDirectSoundNotifyVtbl dscnvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(LPDIRECTSOUNDNOTIFY iface, DWORD howmuch, LPCDSBPOSITIONNOTIFY notify)
Definition: capture.c:85
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
Definition: capture.c:68
static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface(LPDIRECTSOUNDNOTIFY iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:44
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
Definition: capture.c:60

Definition at line 136 of file capture.c.

Referenced by IDirectSoundCaptureNotifyImpl_Create().

◆ dscvt

const IDirectSoundCaptureVtbl dscvt
static
Initial value:
=
{
}
static ULONG WINAPI IDirectSoundCaptureImpl_Release(LPDIRECTSOUNDCAPTURE iface)
Definition: capture.c:1197
static ULONG WINAPI IDirectSoundCaptureImpl_AddRef(LPDIRECTSOUNDCAPTURE iface)
Definition: capture.c:1188
static HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(LPDIRECTSOUNDCAPTURE iface, LPCGUID lpcGUID)
Definition: capture.c:1286
static HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(LPDIRECTSOUNDCAPTURE iface, LPDSCCAPS lpDSCCaps)
Definition: capture.c:1254
static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(LPDIRECTSOUNDCAPTURE iface, LPCDSCBUFFERDESC lpcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *lplpDSCaptureBuffer, LPUNKNOWN pUnk)
Definition: capture.c:1213
static HRESULT WINAPI IDirectSoundCaptureImpl_QueryInterface(LPDIRECTSOUNDCAPTURE iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:1158

Definition at line 1300 of file capture.c.

Referenced by IDirectSoundCaptureImpl_Create().

◆ DSOUND_capture