ReactOS  0.4.14-dev-337-gf981a68
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 }
GLintptr offset
Definition: glext.h:5920
#define DSBPN_OFFSETSTOP
Definition: dsound.h:876
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
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 TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
struct _cl_event * event
Definition: glext.h:7739
CardRegion * from
Definition: spigame.cpp:19

Referenced by DSOUND_capture_callback().

◆ DirectSoundCaptureCreate()

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

Definition at line 1410 of file capture.c.

1414 {
1415  HRESULT hr;
1416  LPDIRECTSOUNDCAPTURE pDSC;
1417  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC, pUnkOuter);
1418 
1419  if (ppDSC == NULL) {
1420  WARN("invalid parameter: ppDSC == NULL\n");
1421  return DSERR_INVALIDPARAM;
1422  }
1423 
1424  if (pUnkOuter) {
1425  WARN("invalid parameter: pUnkOuter != NULL\n");
1426  *ppDSC = NULL;
1427  return DSERR_NOAGGREGATION;
1428  }
1429 
1430  hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
1431  if (hr == DS_OK) {
1432  hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
1433  if (hr != DS_OK) {
1435  pDSC = 0;
1436  }
1437  }
1438 
1439  *ppDSC = pDSC;
1440 
1441  return hr;
1442 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirectSoundCapture_Release(p)
Definition: dsound.h:736
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC)
Definition: capture.c:1330
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define IDirectSoundCapture_Initialize(p, a)
Definition: dsound.h:740
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
#define DSERR_NOAGGREGATION
Definition: dsound.h:130

◆ DirectSoundCaptureCreate8()

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

Definition at line 1466 of file capture.c.

1470 {
1471  HRESULT hr;
1472  LPDIRECTSOUNDCAPTURE8 pDSC8;
1473  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter);
1474 
1475  if (ppDSC8 == NULL) {
1476  WARN("invalid parameter: ppDSC8 == NULL\n");
1477  return DSERR_INVALIDPARAM;
1478  }
1479 
1480  if (pUnkOuter) {
1481  WARN("invalid parameter: pUnkOuter != NULL\n");
1482  *ppDSC8 = NULL;
1483  return DSERR_NOAGGREGATION;
1484  }
1485 
1487  if (hr == DS_OK) {
1488  hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
1489  if (hr != DS_OK) {
1491  pDSC8 = 0;
1492  }
1493  }
1494 
1495  *ppDSC8 = pDSC8;
1496 
1497  return hr;
1498 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirectSoundCapture_Release(p)
Definition: dsound.h:736
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8)
Definition: capture.c:1359
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
smooth NULL
Definition: ftsmooth.c:416
#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:77
#define IDirectSoundCapture_Initialize(p, a)
Definition: dsound.h:740
#define IID_IDirectSoundCapture8
Definition: dsound.h:93
#define DSERR_NOAGGREGATION
Definition: dsound.h:130

◆ DirectSoundCaptureDevice_Create()

static HRESULT DirectSoundCaptureDevice_Create ( DirectSoundCaptureDevice **  ppDevice)
static

Definition at line 967 of file capture.c.

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

Referenced by DirectSoundCaptureDevice_Initialize().

◆ DirectSoundCaptureDevice_Initialize()

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

Definition at line 1019 of file capture.c.

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

Referenced by IDirectSoundCaptureImpl_Initialize().

◆ DirectSoundCaptureDevice_Release()

static ULONG DirectSoundCaptureDevice_Release ( DirectSoundCaptureDevice device)
static

Definition at line 992 of file capture.c.

994 {
996  TRACE("(%p) ref was %d\n", device, ref + 1);
997 
998  if (!ref) {
999  TRACE("deleting object\n");
1000  if (device->capture_buffer)
1002  (LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
1003 
1004  if (device->driver) {
1005  IDsCaptureDriver_Close(device->driver);
1007  }
1008 
1009  HeapFree(GetProcessHeap(), 0, device->pwfx);
1010  device->lock.DebugInfo->Spare[0] = 0;
1011  DeleteCriticalSection( &(device->lock) );
1012  DSOUND_capture[device->drvdesc.dnDevNode] = NULL;
1014  TRACE("(%p) released\n", device);
1015  }
1016  return ref;
1017 }
#define IDsCaptureDriver_Release(p)
Definition: dsdriver.h:317
static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:242
Definition: send.c:47
Definition: devices.h:37
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define IDsCaptureDriver_Close(p)
Definition: dsdriver.h:321
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
struct IDirectSoundCaptureBuffer8 * LPDIRECTSOUNDCAPTUREBUFFER8
Definition: dsound.h:100
#define HeapFree(x, y, z)
Definition: compat.h:402
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:965

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:445
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#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
if(!(yy_init))
Definition: macro.lex.yy.c:714
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:63
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 1330 of file capture.c.

1333 {
1334  LPDIRECTSOUNDCAPTURE pDSC;
1335  HRESULT hr;
1336  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC);
1337 
1338  if (!IsEqualIID(riid, &IID_IUnknown) &&
1339  !IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1340  *ppDSC = 0;
1341  return E_NOINTERFACE;
1342  }
1343 
1344  /* Get dsound configuration */
1346 
1348  if (hr == DS_OK) {
1350  *ppDSC = pDSC;
1351  } else {
1352  WARN("IDirectSoundCaptureImpl_Create failed\n");
1353  *ppDSC = 0;
1354  }
1355 
1356  return hr;
1357 }
void setup_dsound_options(void)
Definition: dsound_main.c:101
#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:111
#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:77
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:1307

Referenced by DirectSoundCaptureCreate().

◆ DSOUND_CaptureCreate8()

HRESULT DSOUND_CaptureCreate8 ( REFIID  riid,
LPDIRECTSOUNDCAPTURE8 ppDSC8 
)

Definition at line 1359 of file capture.c.

1362 {
1363  LPDIRECTSOUNDCAPTURE8 pDSC8;
1364  HRESULT hr;
1365  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC8);
1366 
1367  if (!IsEqualIID(riid, &IID_IUnknown) &&
1369  *ppDSC8 = 0;
1370  return E_NOINTERFACE;
1371  }
1372 
1373  /* Get dsound configuration */
1375 
1377  if (hr == DS_OK) {
1379  *ppDSC8 = pDSC8;
1380  } else {
1381  WARN("IDirectSoundCaptureImpl_Create failed\n");
1382  *ppDSC8 = 0;
1383  }
1384 
1385  return hr;
1386 }
void setup_dsound_options(void)
Definition: dsound_main.c:101
#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:111
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:77
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:1307

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:47
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  device->pwfx = DSOUND_CopyFormat(wfex);
850  if ( device->pwfx == NULL ) {
851  *ppobj = NULL;
852  return DSERR_OUTOFMEMORY;
853  }
854 
857 
858  if ( *ppobj == NULL ) {
859  WARN("out of memory\n");
860  *ppobj = NULL;
861  return DSERR_OUTOFMEMORY;
862  } else {
863  HRESULT err = DS_OK;
864  LPBYTE newbuf;
865  DWORD buflen;
867 
868  This->ref = 1;
869  This->device = device;
870  This->device->capture_buffer = This;
871  This->notify = NULL;
872  This->nrofnotifies = 0;
873  This->hwnotify = NULL;
874 
876  lpcDSCBufferDesc->dwSize);
877  if (This->pdscbd)
878  CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
879  else {
880  WARN("no memory\n");
881  This->device->capture_buffer = 0;
882  HeapFree( GetProcessHeap(), 0, This );
883  *ppobj = NULL;
884  return DSERR_OUTOFMEMORY;
885  }
886 
887  This->lpVtbl = &dscbvt;
888 
889  if (device->driver) {
890  if (This->device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
891  FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
892 
893  if (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
894  /* allocate buffer from system memory */
895  buflen = lpcDSCBufferDesc->dwBufferBytes;
896  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
897  if (device->buffer)
898  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
899  else
900  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
901 
902  if (newbuf == NULL) {
903  WARN("failed to allocate capture buffer\n");
905  /* but the old buffer might still exist and must be re-prepared */
906  } else {
907  device->buffer = newbuf;
908  device->buflen = buflen;
909  }
910  } else {
911  /* let driver allocate memory */
912  device->buflen = lpcDSCBufferDesc->dwBufferBytes;
913  /* FIXME: */
914  HeapFree( GetProcessHeap(), 0, device->buffer);
915  device->buffer = NULL;
916  }
917 
919  device->pwfx,0,0,&(device->buflen),&(device->buffer),(LPVOID*)&(device->hwbuf));
920  if (err != DS_OK) {
921  WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
922  This->device->capture_buffer = 0;
923  HeapFree( GetProcessHeap(), 0, This );
924  *ppobj = NULL;
925  return err;
926  }
927  } else {
929  err = mmErr(waveInOpen(&(device->hwi),
930  device->drvdesc.dnDevNode, device->pwfx,
932  if (err != DS_OK) {
933  WARN("waveInOpen failed\n");
934  This->device->capture_buffer = 0;
935  HeapFree( GetProcessHeap(), 0, This );
936  *ppobj = NULL;
937  return err;
938  }
939 
940  buflen = lpcDSCBufferDesc->dwBufferBytes;
941  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
942  if (device->buffer)
943  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
944  else
945  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
946  if (newbuf == NULL) {
947  WARN("failed to allocate capture buffer\n");
949  /* but the old buffer might still exist and must be re-prepared */
950  } else {
951  device->buffer = newbuf;
952  device->buflen = buflen;
953  }
954  }
955  }
956 
957  TRACE("returning DS_OK\n");
958  return DS_OK;
959 }
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:111
DWORD dwBufferBytes
Definition: dsound.h:359
#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:52
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
Definition: devices.h:37
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
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:403
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:77
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
#define CopyMemory
Definition: winbase.h:1640
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:63
#define HeapReAlloc
Definition: compat.h:401
WORD cbSize
Definition: mmreg.h:84
#define WAVE_MAPPED
Definition: mmsystem.h:190
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
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:402
#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:111
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
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
struct _DSCBCAPS DSCBCAPS
DWORD dwReserved
Definition: dsound.h:381

◆ 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:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:63
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:111
struct tWAVEFORMATEX WAVEFORMATEX
Definition: austream.idl:23
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
#define CopyMemory
Definition: winbase.h:1640

◆ 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:110
#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:110
#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:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
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
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:110
#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:111
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
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:111
#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:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#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:77
#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
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:47
#define IDsCaptureDriverBuffer_Release(p)
Definition: dsdriver.h:351
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#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
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:402
#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:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
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
smooth NULL
Definition: ftsmooth.c:416
#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:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
#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:401
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:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define IDsCaptureDriverBuffer_Stop(p)
Definition: dsdriver.h:359
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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:77
#define STATE_CAPTURING
#define STATE_STARTING
UINT WINAPI waveInReset(HWAVEIN hWaveIn)
Definition: winmm.c:2737
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:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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:77
#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 1182 of file capture.c.

1183 {
1185  ULONG ref = InterlockedIncrement(&(This->ref));
1186  TRACE("(%p) ref was %d\n", This, ref - 1);
1187  return ref;
1188 }
Definition: send.c:47
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 1307 of file capture.c.

1309 {
1311  TRACE("(%p)\n", ppDSC);
1312 
1313  /* Allocate memory */
1315  if (pDSC == NULL) {
1316  WARN("out of memory\n");
1317  *ppDSC = NULL;
1318  return DSERR_OUTOFMEMORY;
1319  }
1320 
1321  pDSC->lpVtbl = &dscvt;
1322  pDSC->ref = 0;
1323  pDSC->device = NULL;
1324 
1325  *ppDSC = (LPDIRECTSOUNDCAPTURE8)pDSC;
1326 
1327  return DS_OK;
1328 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const IDirectSoundCaptureVtbl * lpVtbl
Definition: capture.c:1142
static const IDirectSoundCaptureVtbl dscvt
Definition: capture.c:1294
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DirectSoundCaptureDevice * device
Definition: capture.c:1145

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 1207 of file capture.c.

1212 {
1213  HRESULT hr;
1215 
1216  TRACE( "(%p,%p,%p,%p)\n",iface,lpcDSCBufferDesc,lplpDSCaptureBuffer,pUnk);
1217 
1218  if (lpcDSCBufferDesc == NULL) {
1219  WARN("invalid parameter: lpcDSCBufferDesc == NULL)\n");
1220  return DSERR_INVALIDPARAM;
1221  }
1222 
1223  if (lplpDSCaptureBuffer == NULL) {
1224  WARN("invalid parameter: lplpDSCaptureBuffer == NULL\n");
1225  return DSERR_INVALIDPARAM;
1226  }
1227 
1228  if (pUnk != NULL) {
1229  WARN("invalid parameter: pUnk != NULL\n");
1230  return DSERR_INVALIDPARAM;
1231  }
1232 
1233  /* FIXME: We can only have one buffer so what do we do here? */
1234  if (This->device->capture_buffer) {
1235  WARN("invalid parameter: already has buffer\n");
1236  return DSERR_INVALIDPARAM; /* DSERR_GENERIC ? */
1237  }
1238 
1240  (IDirectSoundCaptureBufferImpl **)lplpDSCaptureBuffer, lpcDSCBufferDesc);
1241 
1242  if (hr != DS_OK)
1243  WARN("IDirectSoundCaptureBufferImpl_Create failed\n");
1244 
1245  return hr;
1246 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
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:77
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 1248 of file capture.c.

1251 {
1253  TRACE("(%p,%p)\n",This,lpDSCCaps);
1254 
1255  if (This->device == NULL) {
1256  WARN("not initialized\n");
1257  return DSERR_UNINITIALIZED;
1258  }
1259 
1260  if (lpDSCCaps== NULL) {
1261  WARN("invalid parameter: lpDSCCaps== NULL\n");
1262  return DSERR_INVALIDPARAM;
1263  }
1264 
1265  if (lpDSCCaps->dwSize < sizeof(*lpDSCCaps)) {
1266  WARN("invalid parameter: lpDSCCaps->dwSize = %d\n", lpDSCCaps->dwSize);
1267  return DSERR_INVALIDPARAM;
1268  }
1269 
1270  lpDSCCaps->dwFlags = This->device->drvcaps.dwFlags;
1271  lpDSCCaps->dwFormats = This->device->drvcaps.dwFormats;
1272  lpDSCCaps->dwChannels = This->device->drvcaps.dwChannels;
1273 
1274  TRACE("(flags=0x%08x,format=0x%08x,channels=%d)\n",lpDSCCaps->dwFlags,
1275  lpDSCCaps->dwFormats, lpDSCCaps->dwChannels);
1276 
1277  return DS_OK;
1278 }
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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
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 1280 of file capture.c.

1283 {
1285  TRACE("(%p,%s)\n", This, debugstr_guid(lpcGUID));
1286 
1287  if (This->device != NULL) {
1288  WARN("already initialized\n");
1289  return DSERR_ALREADYINITIALIZED;
1290  }
1291  return DirectSoundCaptureDevice_Initialize(&This->device, lpcGUID);
1292 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
smooth NULL
Definition: ftsmooth.c:416
#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:1019

◆ IDirectSoundCaptureImpl_QueryInterface()

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

Definition at line 1152 of file capture.c.

1156 {
1158  TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
1159 
1160  if (ppobj == NULL) {
1161  WARN("invalid parameter\n");
1162  return E_INVALIDARG;
1163  }
1164 
1165  *ppobj = NULL;
1166 
1167  if (IsEqualIID(riid, &IID_IUnknown)) {
1169  *ppobj = This;
1170  return DS_OK;
1171  } else if (IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1173  *ppobj = This;
1174  return DS_OK;
1175  }
1176 
1177  WARN("unsupported riid: %s\n", debugstr_guid(riid));
1178  return E_NOINTERFACE;
1179 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#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 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 1191 of file capture.c.

1192 {
1194  ULONG ref = InterlockedDecrement(&(This->ref));
1195  TRACE("(%p) ref was %d\n", This, ref + 1);
1196 
1197  if (!ref) {
1198  if (This->device)
1200 
1201  HeapFree( GetProcessHeap(), 0, This );
1202  TRACE("(%p) released\n", This);
1203  }
1204  return ref;
1205 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static ULONG DirectSoundCaptureDevice_Release(DirectSoundCaptureDevice *device)
Definition: capture.c:992
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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:47
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:111
const IDirectSoundNotifyVtbl * lpVtbl
Definition: capture.c:36
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
smooth NULL
Definition: ftsmooth.c:416
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:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
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:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#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:47
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define IDsDriverNotify_Release(p)
Definition: dsdriver.h:289
#define InterlockedDecrement
Definition: armddk.h:52
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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:111
int notify
Definition: msacm.c:1365
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
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 DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#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:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define CopyMemory
Definition: winbase.h:1640
#define S_OK
Definition: intsafe.h:59
#define HeapReAlloc
Definition: compat.h:401
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define TRACE_ON(x)
Definition: compat.h:65
#define HeapFree(x, y, z)
Definition: compat.h:402
#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:1191
static ULONG WINAPI IDirectSoundCaptureImpl_AddRef(LPDIRECTSOUNDCAPTURE iface)
Definition: capture.c:1182
static HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(LPDIRECTSOUNDCAPTURE iface, LPCGUID lpcGUID)
Definition: capture.c:1280
static HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(LPDIRECTSOUNDCAPTURE iface, LPDSCCAPS lpDSCCaps)
Definition: capture.c:1248
static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(LPDIRECTSOUNDCAPTURE iface, LPCDSCBUFFERDESC lpcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *lplpDSCaptureBuffer, LPUNKNOWN pUnk)
Definition: capture.c:1207
static HRESULT WINAPI IDirectSoundCaptureImpl_QueryInterface(LPDIRECTSOUNDCAPTURE iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:1152

Definition at line 1294 of file capture.c.

Referenced by IDirectSoundCaptureImpl_Create().

◆ DSOUND_capture