ReactOS  0.4.14-dev-323-g6fe6a88
buffer.c File Reference
#include "dsound_private.h"
Include dependency graph for buffer.c:

Go to the source code of this file.

Classes

struct  IDirectSoundNotifyImpl
 

Functions

static HRESULT IDirectSoundNotifyImpl_Create (IDirectSoundBufferImpl *dsb, IDirectSoundNotifyImpl **pdsn)
 
static HRESULT IDirectSoundNotifyImpl_Destroy (IDirectSoundNotifyImpl *pdsn)
 
static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface (LPDIRECTSOUNDNOTIFY iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSoundNotifyImpl_AddRef (LPDIRECTSOUNDNOTIFY iface)
 
static ULONG WINAPI IDirectSoundNotifyImpl_Release (LPDIRECTSOUNDNOTIFY iface)
 
static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions (LPDIRECTSOUNDNOTIFY iface, DWORD howmuch, LPCDSBPOSITIONNOTIFY notify)
 
static IDirectSoundBufferImplimpl_from_IDirectSoundBuffer8 (IDirectSoundBuffer8 *iface)
 
static BOOL is_primary_buffer (IDirectSoundBufferImpl *This)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat (IDirectSoundBuffer8 *iface, LPCWAVEFORMATEX wfex)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume (IDirectSoundBuffer8 *iface, LONG vol)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume (IDirectSoundBuffer8 *iface, LONG *vol)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency (IDirectSoundBuffer8 *iface, DWORD freq)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Play (IDirectSoundBuffer8 *iface, DWORD reserved1, DWORD reserved2, DWORD flags)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Stop (IDirectSoundBuffer8 *iface)
 
static ULONG WINAPI IDirectSoundBufferImpl_AddRef (IDirectSoundBuffer8 *iface)
 
static ULONG WINAPI IDirectSoundBufferImpl_Release (IDirectSoundBuffer8 *iface)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition (IDirectSoundBuffer8 *iface, DWORD *playpos, DWORD *writepos)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus (IDirectSoundBuffer8 *iface, DWORD *status)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat (IDirectSoundBuffer8 *iface, LPWAVEFORMATEX lpwf, DWORD wfsize, DWORD *wfwritten)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Lock (IDirectSoundBuffer8 *iface, DWORD writecursor, DWORD writebytes, void **lplpaudioptr1, DWORD *audiobytes1, void **lplpaudioptr2, DWORD *audiobytes2, DWORD flags)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition (IDirectSoundBuffer8 *iface, DWORD newpos)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetPan (IDirectSoundBuffer8 *iface, LONG pan)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetPan (IDirectSoundBuffer8 *iface, LONG *pan)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Unlock (IDirectSoundBuffer8 *iface, void *p1, DWORD x1, void *p2, DWORD x2)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Restore (IDirectSoundBuffer8 *iface)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency (IDirectSoundBuffer8 *iface, DWORD *freq)
 
static HRESULT WINAPI IDirectSoundBufferImpl_SetFX (IDirectSoundBuffer8 *iface, DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, DWORD *pdwResultCodes)
 
static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources (IDirectSoundBuffer8 *iface, DWORD dwFlags, DWORD dwEffectsCount, DWORD *pdwResultCodes)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath (IDirectSoundBuffer8 *iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, void **ppObject)
 
static HRESULT WINAPI IDirectSoundBufferImpl_Initialize (IDirectSoundBuffer8 *iface, IDirectSound *dsound, LPCDSBUFFERDESC dbsd)
 
static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps (IDirectSoundBuffer8 *iface, LPDSBCAPS caps)
 
static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface (IDirectSoundBuffer8 *iface, REFIID riid, void **ppobj)
 
HRESULT IDirectSoundBufferImpl_Create (DirectSoundDevice *device, IDirectSoundBufferImpl **pdsb, LPCDSBUFFERDESC dsbd)
 
void secondarybuffer_destroy (IDirectSoundBufferImpl *This)
 
HRESULT IDirectSoundBufferImpl_Destroy (IDirectSoundBufferImpl *pdsb)
 
HRESULT IDirectSoundBufferImpl_Duplicate (DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, IDirectSoundBufferImpl *pdsb)
 
static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface (LPKSPROPERTYSET iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IKsBufferPropertySetImpl_AddRef (LPKSPROPERTYSET iface)
 
static ULONG WINAPI IKsBufferPropertySetImpl_Release (LPKSPROPERTYSET iface)
 
static HRESULT WINAPI IKsBufferPropertySetImpl_Get (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData, PULONG pcbReturned)
 
static HRESULT WINAPI IKsBufferPropertySetImpl_Set (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData)
 
static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport)
 
HRESULT IKsBufferPropertySetImpl_Create (IDirectSoundBufferImpl *dsb, IKsBufferPropertySetImpl **piks)
 
HRESULT IKsBufferPropertySetImpl_Destroy (IKsBufferPropertySetImpl *piks)
 

Variables

static const IDirectSoundNotifyVtbl dsnvt
 
static const IDirectSoundBuffer8Vtbl dsbvt
 
static const IKsPropertySetVtbl iksbvt
 

Function Documentation

◆ IDirectSoundBufferImpl_AcquireResources()

static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources ( IDirectSoundBuffer8 *  iface,
DWORD  dwFlags,
DWORD  dwEffectsCount,
DWORD pdwResultCodes 
)
static

Definition at line 771 of file buffer.c.

773 {
775  DWORD u;
776 
777  FIXME("(%p,%08u,%u,%p): stub, faking success\n",This,dwFlags,dwEffectsCount,pdwResultCodes);
778 
779  if (pdwResultCodes)
780  for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN;
781 
782  WARN("control unavailable\n");
783  return DS_OK;
784 }
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 * u
Definition: glfuncs.h:240
#define WARN(fmt,...)
Definition: debug.h:111
#define FIXME(fmt,...)
Definition: debug.h:110
#define DS_OK
Definition: dsound.h:116
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_AddRef()

static ULONG WINAPI IDirectSoundBufferImpl_AddRef ( IDirectSoundBuffer8 *  iface)
static

Definition at line 369 of file buffer.c.

370 {
373 
374  TRACE("(%p) ref was %d\n", This, ref - 1);
375 
376  if(ref == 1)
377  InterlockedIncrement(&This->numIfaces);
378 
379  return ref;
380 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSoundBufferImpl_Create()

HRESULT IDirectSoundBufferImpl_Create ( DirectSoundDevice device,
IDirectSoundBufferImpl **  pdsb,
LPCDSBUFFERDESC  dsbd 
)

Definition at line 931 of file buffer.c.

935 {
937  LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
938  HRESULT err = DS_OK;
939  DWORD capf = 0;
940  int use_hw;
941  TRACE("(%p,%p,%p)\n",device,pdsb,dsbd);
942 
943  if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
944  WARN("invalid parameter: dsbd->dwBufferBytes = %d\n", dsbd->dwBufferBytes);
945  *pdsb = NULL;
946  return DSERR_INVALIDPARAM; /* FIXME: which error? */
947  }
948 
949  dsb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*dsb));
950 
951  if (dsb == 0) {
952  WARN("out of memory\n");
953  *pdsb = NULL;
954  return DSERR_OUTOFMEMORY;
955  }
956 
957  TRACE("Created buffer at %p\n", dsb);
958 
959  dsb->ref = 1;
960  dsb->numIfaces = 1;
961  dsb->device = device;
962  dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
963  dsb->iks = NULL;
964 
965  /* size depends on version */
966  CopyMemory(&dsb->dsbd, dsbd, dsbd->dwSize);
967 
968  dsb->pwfx = DSOUND_CopyFormat(wfex);
969  if (dsb->pwfx == NULL) {
970  HeapFree(GetProcessHeap(),0,dsb);
971  *pdsb = NULL;
972  return DSERR_OUTOFMEMORY;
973  }
974 
975  if (dsbd->dwBufferBytes % dsbd->lpwfxFormat->nBlockAlign)
976  dsb->buflen = dsbd->dwBufferBytes +
977  (dsbd->lpwfxFormat->nBlockAlign -
978  (dsbd->dwBufferBytes % dsbd->lpwfxFormat->nBlockAlign));
979  else
980  dsb->buflen = dsbd->dwBufferBytes;
981 
982  dsb->freq = dsbd->lpwfxFormat->nSamplesPerSec;
983  dsb->notify = NULL;
984  dsb->notifies = NULL;
985  dsb->nrofnotifies = 0;
986  dsb->hwnotify = 0;
987 
988  /* Check necessary hardware mixing capabilities */
989  if (wfex->nChannels==2) capf |= DSCAPS_SECONDARYSTEREO;
990  else capf |= DSCAPS_SECONDARYMONO;
991  if (wfex->wBitsPerSample==16) capf |= DSCAPS_SECONDARY16BIT;
992  else capf |= DSCAPS_SECONDARY8BIT;
993 
994  use_hw = !!(dsbd->dwFlags & DSBCAPS_LOCHARDWARE);
995  TRACE("use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", use_hw, capf, device->drvcaps.dwFlags);
996  if (use_hw && ((device->drvcaps.dwFlags & capf) != capf || !device->driver))
997  {
998  if (device->driver)
999  WARN("Format not supported for hardware buffer\n");
1000  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1001  HeapFree(GetProcessHeap(),0,dsb);
1002  *pdsb = NULL;
1003  if ((device->drvcaps.dwFlags & capf) != capf)
1004  return DSERR_BADFORMAT;
1005  return DSERR_GENERIC;
1006  }
1007 
1008  /* FIXME: check hardware sample rate mixing capabilities */
1009  /* FIXME: check app hints for software/hardware buffer (STATIC, LOCHARDWARE, etc) */
1010  /* FIXME: check whether any hardware buffers are left */
1011  /* FIXME: handle DSDHEAP_CREATEHEAP for hardware buffers */
1012 
1013  /* Allocate an empty buffer */
1014  dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
1015  if (dsb->buffer == NULL) {
1016  WARN("out of memory\n");
1017  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1018  HeapFree(GetProcessHeap(),0,dsb);
1019  *pdsb = NULL;
1020  return DSERR_OUTOFMEMORY;
1021  }
1022 
1023  /* Allocate system memory for buffer if applicable */
1024  if ((device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) || !use_hw) {
1025  dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
1026  if (dsb->buffer->memory == NULL) {
1027  WARN("out of memory\n");
1028  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1029  HeapFree(GetProcessHeap(),0,dsb->buffer);
1030  HeapFree(GetProcessHeap(),0,dsb);
1031  *pdsb = NULL;
1032  return DSERR_OUTOFMEMORY;
1033  }
1034  }
1035 
1036  /* Allocate the hardware buffer */
1037  if (use_hw) {
1038  err = IDsDriver_CreateSoundBuffer(device->driver,wfex,dsbd->dwFlags,0,
1039  &(dsb->buflen),&(dsb->buffer->memory),
1040  (LPVOID*)&(dsb->hwbuf));
1041  if (FAILED(err))
1042  {
1043  WARN("Failed to create hardware secondary buffer: %08x\n", err);
1044  if (device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)
1045  HeapFree(GetProcessHeap(),0,dsb->buffer->memory);
1046  HeapFree(GetProcessHeap(),0,dsb->buffer);
1047  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1048  HeapFree(GetProcessHeap(),0,dsb);
1049  *pdsb = NULL;
1050  return DSERR_GENERIC;
1051  }
1052  }
1053 
1054  dsb->buffer->ref = 1;
1055  list_init(&dsb->buffer->buffers);
1056  list_add_head(&dsb->buffer->buffers, &dsb->entry);
1057  FillMemory(dsb->buffer->memory, dsb->buflen, dsbd->lpwfxFormat->wBitsPerSample == 8 ? 128 : 0);
1058 
1059  /* It's not necessary to initialize values to zero since */
1060  /* we allocated this structure with HEAP_ZERO_MEMORY... */
1061  dsb->buf_mixpos = dsb->sec_mixpos = 0;
1062  dsb->state = STATE_STOPPED;
1063 
1064  dsb->freqAdjust = ((DWORD64)dsb->freq << DSOUND_FREQSHIFT) / device->pwfx->nSamplesPerSec;
1065  dsb->nAvgBytesPerSec = dsb->freq *
1066  dsbd->lpwfxFormat->nBlockAlign;
1067 
1068  /* calculate fragment size and write lead */
1069  DSOUND_RecalcFormat(dsb);
1070 
1071  if (dsb->dsbd.dwFlags & DSBCAPS_CTRL3D) {
1072  dsb->ds3db_ds3db.dwSize = sizeof(DS3DBUFFER);
1073  dsb->ds3db_ds3db.vPosition.x = 0.0;
1074  dsb->ds3db_ds3db.vPosition.y = 0.0;
1075  dsb->ds3db_ds3db.vPosition.z = 0.0;
1076  dsb->ds3db_ds3db.vVelocity.x = 0.0;
1077  dsb->ds3db_ds3db.vVelocity.y = 0.0;
1078  dsb->ds3db_ds3db.vVelocity.z = 0.0;
1081  dsb->ds3db_ds3db.vConeOrientation.x = 0.0;
1082  dsb->ds3db_ds3db.vConeOrientation.y = 0.0;
1083  dsb->ds3db_ds3db.vConeOrientation.z = 0.0;
1088 
1089  dsb->ds3db_need_recalc = FALSE;
1090  DSOUND_Calc3DBuffer(dsb);
1091  } else
1092  DSOUND_RecalcVolPan(&(dsb->volpan));
1093 
1094  RtlInitializeResource(&dsb->lock);
1095 
1096  /* register buffer if not primary */
1097  if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) {
1099  if (err != DS_OK) {
1100  HeapFree(GetProcessHeap(),0,dsb->buffer->memory);
1101  HeapFree(GetProcessHeap(),0,dsb->buffer);
1102  RtlDeleteResource(&dsb->lock);
1103  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1104  HeapFree(GetProcessHeap(),0,dsb);
1105  dsb = NULL;
1106  }
1107  }
1108 
1109  *pdsb = dsb;
1110  return err;
1111 }
#define DSERR_GENERIC
Definition: dsound.h:123
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
struct _DS3DBUFFER DS3DBUFFER
#define DSCAPS_SECONDARYSTEREO
Definition: dsound.h:151
IDirectSoundNotifyImpl * notify
#define DS3DMODE_NORMAL
Definition: dsound.h:910
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: sound3d.c:141
WORD nChannels
Definition: mmreg.h:79
#define WARN(fmt,...)
Definition: debug.h:111
D3DVALUE flMaxDistance
Definition: dsound.h:1034
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define IDsDriver_CreateSoundBuffer(p, a, b, c, d, e, f)
Definition: dsdriver.h:163
#define DS3D_DEFAULTMINDISTANCE
Definition: dsound.h:929
HRESULT DirectSoundDevice_AddBuffer(DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB)
Definition: dsound.c:1761
D3DVECTOR vVelocity
Definition: dsound.h:1028
DWORD dwOutsideConeAngle
Definition: dsound.h:1030
#define DSOUND_FREQSHIFT
#define DS3D_DEFAULTMAXDISTANCE
Definition: dsound.h:930
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
LONG lConeOutsideVolume
Definition: dsound.h:1032
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
Definition: devices.h:37
#define DSBSIZE_MAX
Definition: dsound.h:225
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
smooth NULL
Definition: ftsmooth.c:416
#define DSBSIZE_MIN
Definition: dsound.h:224
#define DSCAPS_SECONDARY16BIT
Definition: dsound.h:153
struct list buffers
#define STATE_STOPPED
D3DVECTOR vConeOrientation
Definition: dsound.h:1031
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define DSBCAPS_PRIMARYBUFFER
Definition: dsound.h:206
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD dwSize
Definition: dsound.h:288
LONG HRESULT
Definition: typedefs.h:77
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
#define CopyMemory
Definition: winbase.h:1640
#define DSCAPS_SECONDARYMONO
Definition: dsound.h:150
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:292
#define DSERR_BADFORMAT
Definition: dsound.h:126
IKsBufferPropertySetImpl * iks
DWORD dwInsideConeAngle
Definition: dsound.h:1029
DirectSoundDevice * device
#define err(...)
#define DS3D_DEFAULTCONEANGLE
Definition: dsound.h:934
static const IDirectSoundBuffer8Vtbl dsbvt
Definition: buffer.c:903
D3DVALUE flMinDistance
Definition: dsound.h:1033
uint64_t DWORD64
Definition: typedefs.h:65
#define DS3D_DEFAULTCONEOUTSIDEVOLUME
Definition: dsound.h:936
PIDSDRIVERBUFFER hwbuf
#define DSBCAPS_CTRL3D
Definition: dsound.h:210
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
IDirectSoundBuffer8 IDirectSoundBuffer8_iface
LPDSBPOSITIONNOTIFY notifies
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
PIDSDRIVERNOTIFY hwnotify
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
WORD wBitsPerSample
Definition: mmreg.h:83
DWORD dwBufferBytes
Definition: dsound.h:290
DWORD dwFlags
Definition: dsound.h:289
DWORD dwSize
Definition: dsound.h:1026
DWORD dwMode
Definition: dsound.h:1035
#define HeapFree(x, y, z)
Definition: compat.h:394
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
#define DSBCAPS_LOCHARDWARE
Definition: dsound.h:208
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52
#define DSCAPS_SECONDARY8BIT
Definition: dsound.h:152
D3DVECTOR vPosition
Definition: dsound.h:1027

Referenced by DirectSoundDevice_CreateSoundBuffer().

◆ IDirectSoundBufferImpl_Destroy()

HRESULT IDirectSoundBufferImpl_Destroy ( IDirectSoundBufferImpl pdsb)

Definition at line 1137 of file buffer.c.

1139 {
1140  TRACE("(%p)\n",pdsb);
1141 
1142  /* This keeps the *_Destroy functions from possibly deleting
1143  * this object until it is ready to be deleted */
1145 
1146  if (pdsb->iks) {
1147  WARN("iks not NULL\n");
1149  pdsb->iks = NULL;
1150  }
1151 
1152  if (pdsb->ds3db) {
1153  WARN("ds3db not NULL\n");
1155  pdsb->ds3db = NULL;
1156  }
1157 
1158  if (pdsb->notify) {
1159  WARN("notify not NULL\n");
1161  pdsb->notify = NULL;
1162  }
1163 
1165 
1166  return S_OK;
1167 }
IDirectSoundNotifyImpl * notify
HRESULT IKsBufferPropertySetImpl_Destroy(IKsBufferPropertySetImpl *piks)
Definition: buffer.c:1416
#define WARN(fmt,...)
Definition: debug.h:111
IDirectSound3DBufferImpl * ds3db
HRESULT IDirectSound3DBufferImpl_Destroy(IDirectSound3DBufferImpl *pds3db) DECLSPEC_HIDDEN
Definition: sound3d.c:709
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
IKsBufferPropertySetImpl * iks
static HRESULT IDirectSoundNotifyImpl_Destroy(IDirectSoundNotifyImpl *pdsn)
Definition: buffer.c:155
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
Definition: buffer.c:1113

Referenced by DirectSoundDevice_Release().

◆ IDirectSoundBufferImpl_Duplicate()

HRESULT IDirectSoundBufferImpl_Duplicate ( DirectSoundDevice device,
IDirectSoundBufferImpl **  ppdsb,
IDirectSoundBufferImpl pdsb 
)

Definition at line 1169 of file buffer.c.

1173 {
1175  HRESULT hres = DS_OK;
1176  TRACE("(%p,%p,%p)\n", device, ppdsb, pdsb);
1177 
1178  dsb = HeapAlloc(GetProcessHeap(),0,sizeof(*dsb));
1179  if (dsb == NULL) {
1180  WARN("out of memory\n");
1181  *ppdsb = NULL;
1182  return DSERR_OUTOFMEMORY;
1183  }
1184  CopyMemory(dsb, pdsb, sizeof(*dsb));
1185 
1186  dsb->pwfx = DSOUND_CopyFormat(pdsb->pwfx);
1187  if (dsb->pwfx == NULL) {
1188  HeapFree(GetProcessHeap(),0,dsb);
1189  *ppdsb = NULL;
1190  return DSERR_OUTOFMEMORY;
1191  }
1192 
1193  if (pdsb->hwbuf) {
1194  TRACE("duplicating hardware buffer\n");
1195 
1197  (LPVOID *)&dsb->hwbuf);
1198  if (FAILED(hres)) {
1199  WARN("IDsDriver_DuplicateSoundBuffer failed (%08x)\n", hres);
1200  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1201  HeapFree(GetProcessHeap(),0,dsb);
1202  *ppdsb = NULL;
1203  return hres;
1204  }
1205  }
1206 
1207  dsb->buffer->ref++;
1208  list_add_head(&dsb->buffer->buffers, &dsb->entry);
1209  dsb->ref = 1;
1210  dsb->numIfaces = 1;
1211  dsb->state = STATE_STOPPED;
1212  dsb->buf_mixpos = dsb->sec_mixpos = 0;
1213  dsb->notify = NULL;
1214  dsb->notifies = NULL;
1215  dsb->nrofnotifies = 0;
1216  dsb->device = device;
1217  dsb->ds3db = NULL;
1218  dsb->iks = NULL; /* FIXME? */
1219  dsb->tmp_buffer = NULL;
1220  DSOUND_RecalcFormat(dsb);
1221  DSOUND_MixToTemporary(dsb, 0, dsb->buflen, FALSE);
1222 
1223  RtlInitializeResource(&dsb->lock);
1224 
1225  /* register buffer */
1227  if (hres != DS_OK) {
1228  RtlDeleteResource(&dsb->lock);
1230  list_remove(&dsb->entry);
1231  dsb->buffer->ref--;
1232  HeapFree(GetProcessHeap(),0,dsb->pwfx);
1233  HeapFree(GetProcessHeap(),0,dsb);
1234  dsb = NULL;
1235  }
1236 
1237  *ppdsb = dsb;
1238  return hres;
1239 }
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
IDirectSoundNotifyImpl * notify
#define WARN(fmt,...)
Definition: debug.h:111
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
HRESULT DirectSoundDevice_AddBuffer(DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB)
Definition: dsound.c:1761
IDirectSound3DBufferImpl * ds3db
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
Definition: devices.h:37
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
smooth NULL
Definition: ftsmooth.c:416
#define IDsDriver_DuplicateSoundBuffer(p, a, b)
Definition: dsdriver.h:164
struct list buffers
#define STATE_STOPPED
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
#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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
#define CopyMemory
Definition: winbase.h:1640
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
IKsBufferPropertySetImpl * iks
DirectSoundDevice * device
PIDSDRIVERBUFFER hwbuf
LPDSBPOSITIONNOTIFY notifies
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DirectSoundDevice_DuplicateSoundBuffer().

◆ IDirectSoundBufferImpl_GetCaps()

static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps ( IDirectSoundBuffer8 *  iface,
LPDSBCAPS  caps 
)
static

Definition at line 806 of file buffer.c.

807 {
809 
810  TRACE("(%p)->(%p)\n",This,caps);
811 
812  if (caps == NULL) {
813  WARN("invalid parameter: caps == NULL\n");
814  return DSERR_INVALIDPARAM;
815  }
816 
817  if (caps->dwSize < sizeof(*caps)) {
818  WARN("invalid parameter: caps->dwSize = %d\n",caps->dwSize);
819  return DSERR_INVALIDPARAM;
820  }
821 
822  caps->dwFlags = This->dsbd.dwFlags;
823  if (This->hwbuf) caps->dwFlags |= DSBCAPS_LOCHARDWARE;
824  else caps->dwFlags |= DSBCAPS_LOCSOFTWARE;
825 
826  caps->dwBufferBytes = This->buflen;
827 
828  /* According to windows, this is zero*/
829  caps->dwUnlockTransferRate = 0;
830  caps->dwPlayCpuOverhead = 0;
831 
832  return DS_OK;
833 }
DWORD dwSize
Definition: dsound.h:239
#define DSBCAPS_LOCSOFTWARE
Definition: dsound.h:209
#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 dwPlayCpuOverhead
Definition: dsound.h:243
DWORD dwFlags
Definition: dsound.h:240
DWORD dwBufferBytes
Definition: dsound.h:241
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
DWORD dwUnlockTransferRate
Definition: dsound.h:242
#define DSBCAPS_LOCHARDWARE
Definition: dsound.h:208

◆ IDirectSoundBufferImpl_GetCurrentPosition()

static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition ( IDirectSoundBuffer8 *  iface,
DWORD playpos,
DWORD writepos 
)
static

Definition at line 398 of file buffer.c.

400 {
402  HRESULT hres;
403 
404  TRACE("(%p,%p,%p)\n",This,playpos,writepos);
405 
407  if (This->hwbuf) {
408  hres=IDsDriverBuffer_GetPosition(This->hwbuf,playpos,writepos);
409  if (hres != DS_OK) {
410  WARN("IDsDriverBuffer_GetPosition failed\n");
411  return hres;
412  }
413  } else {
414  DWORD pos = This->sec_mixpos;
415 
416  /* sanity */
417  if (pos >= This->buflen){
418  FIXME("Bad play position. playpos: %d, buflen: %d\n", pos, This->buflen);
419  pos %= This->buflen;
420  }
421 
422  if (playpos)
423  *playpos = pos;
424  if (writepos)
425  *writepos = pos;
426  }
427  if (writepos && This->state != STATE_STOPPED && (!This->hwbuf || !(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDWRITELEAD))) {
428  /* apply the documented 10ms lead to writepos */
429  *writepos += This->writelead;
430  *writepos %= This->buflen;
431  }
432  RtlReleaseResource(&This->lock);
433 
434  TRACE("playpos = %d, writepos = %d, buflen=%d (%p, time=%d)\n",
435  playpos?*playpos:-1, writepos?*writepos:-1, This->buflen, This, GetTickCount());
436 
437  return DS_OK;
438 }
#define TRUE
Definition: types.h:120
#define DSDDESC_DONTNEEDWRITELEAD
Definition: dsdriver.h:55
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define FIXME(fmt,...)
Definition: debug.h:110
#define STATE_STOPPED
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define IDsDriverBuffer_GetPosition(p, a, b)
Definition: dsdriver.h:202

Referenced by IDirectSoundBufferImpl_Lock().

◆ IDirectSoundBufferImpl_GetFormat()

static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat ( IDirectSoundBuffer8 *  iface,
LPWAVEFORMATEX  lpwf,
DWORD  wfsize,
DWORD wfwritten 
)
static

Definition at line 465 of file buffer.c.

467 {
469  DWORD size;
470 
471  TRACE("(%p,%p,%d,%p)\n",This,lpwf,wfsize,wfwritten);
472 
473  size = sizeof(WAVEFORMATEX) + This->pwfx->cbSize;
474 
475  if (lpwf) { /* NULL is valid */
476  if (wfsize >= size) {
477  CopyMemory(lpwf,This->pwfx,size);
478  if (wfwritten)
479  *wfwritten = size;
480  } else {
481  WARN("invalid parameter: wfsize too small\n");
482  CopyMemory(lpwf,This->pwfx,wfsize);
483  if (wfwritten)
484  *wfwritten = wfsize;
485  return DSERR_INVALIDPARAM;
486  }
487  } else {
488  if (wfwritten)
489  *wfwritten = sizeof(WAVEFORMATEX) + This->pwfx->cbSize;
490  else {
491  WARN("invalid parameter: wfwritten == NULL\n");
492  return DSERR_INVALIDPARAM;
493  }
494  }
495 
496  return DS_OK;
497 }
#define WARN(fmt,...)
Definition: debug.h:111
struct tWAVEFORMATEX WAVEFORMATEX
Definition: austream.idl:23
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_GetFrequency()

static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency ( IDirectSoundBuffer8 *  iface,
DWORD freq 
)
static

Definition at line 739 of file buffer.c.

740 {
742 
743  TRACE("(%p,%p)\n",This,freq);
744 
745  if (freq == NULL) {
746  WARN("invalid parameter: freq = NULL\n");
747  return DSERR_INVALIDPARAM;
748  }
749 
750  *freq = This->freq;
751  TRACE("-> %d\n", *freq);
752 
753  return DS_OK;
754 }
#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
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_GetObjectInPath()

static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath ( IDirectSoundBuffer8 *  iface,
REFGUID  rguidObject,
DWORD  dwIndex,
REFGUID  rguidInterface,
void **  ppObject 
)
static

Definition at line 786 of file buffer.c.

788 {
790 
791  FIXME("(%p,%s,%u,%s,%p): stub\n",This,debugstr_guid(rguidObject),dwIndex,debugstr_guid(rguidInterface),ppObject);
792 
793  WARN("control unavailable\n");
794  return DSERR_CONTROLUNAVAIL;
795 }
#define WARN(fmt,...)
Definition: debug.h:111
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_GetPan()

static HRESULT WINAPI IDirectSoundBufferImpl_GetPan ( IDirectSoundBuffer8 *  iface,
LONG pan 
)
static

Definition at line 664 of file buffer.c.

665 {
667 
668  TRACE("(%p,%p)\n",This,pan);
669 
670  if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
671  WARN("control unavailable\n");
672  return DSERR_CONTROLUNAVAIL;
673  }
674 
675  if (pan == NULL) {
676  WARN("invalid parameter: pan = NULL\n");
677  return DSERR_INVALIDPARAM;
678  }
679 
680  *pan = This->volpan.lPan;
681 
682  return DS_OK;
683 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSBCAPS_CTRLPAN
Definition: dsound.h:212
#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
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_GetStatus()

static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus ( IDirectSoundBuffer8 *  iface,
DWORD status 
)
static

Definition at line 440 of file buffer.c.

441 {
443 
444  TRACE("(%p,%p), thread is %04x\n",This,status,GetCurrentThreadId());
445 
446  if (status == NULL) {
447  WARN("invalid parameter: status = NULL\n");
448  return DSERR_INVALIDPARAM;
449  }
450 
451  *status = 0;
453  if ((This->state == STATE_STARTING) || (This->state == STATE_PLAYING)) {
455  if (This->playflags & DSBPLAY_LOOPING)
457  }
458  RtlReleaseResource(&This->lock);
459 
460  TRACE("status=%x\n", *status);
461  return DS_OK;
462 }
#define TRUE
Definition: types.h:120
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
#define WARN(fmt,...)
Definition: debug.h:111
#define STATE_PLAYING
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#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 DSBSTATUS_LOOPING
Definition: dsound.h:198
#define DSBPLAY_LOOPING
Definition: dsound.h:189
#define STATE_STARTING
#define DSBSTATUS_PLAYING
Definition: dsound.h:196
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
Definition: ps.c:97

◆ IDirectSoundBufferImpl_GetVolume()

static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume ( IDirectSoundBuffer8 *  iface,
LONG vol 
)
static

Definition at line 243 of file buffer.c.

244 {
246 
247  TRACE("(%p,%p)\n",This,vol);
248 
249  if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
250  WARN("control unavailable\n");
251  return DSERR_CONTROLUNAVAIL;
252  }
253 
254  if (vol == NULL) {
255  WARN("invalid parameter: vol == NULL\n");
256  return DSERR_INVALIDPARAM;
257  }
258 
259  *vol = This->volpan.lVolume;
260 
261  return DS_OK;
262 }
#define DSBCAPS_CTRLVOLUME
Definition: dsound.h:213
#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
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_Initialize()

static HRESULT WINAPI IDirectSoundBufferImpl_Initialize ( IDirectSoundBuffer8 *  iface,
IDirectSound *  dsound,
LPCDSBUFFERDESC  dbsd 
)
static

Definition at line 797 of file buffer.c.

799 {
801 
802  WARN("(%p) already initialized\n", This);
804 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_Lock()

static HRESULT WINAPI IDirectSoundBufferImpl_Lock ( IDirectSoundBuffer8 *  iface,
DWORD  writecursor,
DWORD  writebytes,
void **  lplpaudioptr1,
DWORD audiobytes1,
void **  lplpaudioptr2,
DWORD audiobytes2,
DWORD  flags 
)
static

Definition at line 499 of file buffer.c.

502 {
504  HRESULT hres = DS_OK;
505 
506  TRACE("(%p,%d,%d,%p,%p,%p,%p,0x%08x) at %d\n", This, writecursor, writebytes, lplpaudioptr1,
507  audiobytes1, lplpaudioptr2, audiobytes2, flags, GetTickCount());
508 
509  if (!audiobytes1)
510  return DSERR_INVALIDPARAM;
511 
512  /* when this flag is set, writecursor is meaningless and must be calculated */
514  /* GetCurrentPosition does too much magic to duplicate here */
515  hres = IDirectSoundBufferImpl_GetCurrentPosition(iface, NULL, &writecursor);
516  if (hres != DS_OK) {
517  WARN("IDirectSoundBufferImpl_GetCurrentPosition failed\n");
518  return hres;
519  }
520  }
521 
522  /* when this flag is set, writebytes is meaningless and must be set */
524  writebytes = This->buflen;
525 
526  if (writecursor >= This->buflen) {
527  WARN("Invalid parameter, writecursor: %u >= buflen: %u\n",
528  writecursor, This->buflen);
529  return DSERR_INVALIDPARAM;
530  }
531 
532  if (writebytes > This->buflen) {
533  WARN("Invalid parameter, writebytes: %u > buflen: %u\n",
534  writebytes, This->buflen);
535  return DSERR_INVALIDPARAM;
536  }
537 
538  /* **** */
540 
541  if (!(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) {
542  hres = IDsDriverBuffer_Lock(This->hwbuf,
543  lplpaudioptr1, audiobytes1,
544  lplpaudioptr2, audiobytes2,
545  writecursor, writebytes,
546  0);
547  if (hres != DS_OK) {
548  WARN("IDsDriverBuffer_Lock failed\n");
549  RtlReleaseResource(&This->lock);
550  return hres;
551  }
552  } else {
553  if (writecursor+writebytes <= This->buflen) {
554  *(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
555  if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
556  WARN("Overwriting mixing position, case 1\n");
557  *audiobytes1 = writebytes;
558  if (lplpaudioptr2)
559  *(LPBYTE*)lplpaudioptr2 = NULL;
560  if (audiobytes2)
561  *audiobytes2 = 0;
562  TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n",
563  *(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
564  TRACE("->%d.0\n",writebytes);
565  } else {
566  DWORD remainder = writebytes + writecursor - This->buflen;
567  *(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
568  *audiobytes1 = This->buflen-writecursor;
569  if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
570  WARN("Overwriting mixing position, case 2\n");
571  if (lplpaudioptr2)
572  *(LPBYTE*)lplpaudioptr2 = This->buffer->memory;
573  if (audiobytes2)
574  *audiobytes2 = writebytes-(This->buflen-writecursor);
575  if (audiobytes2 && This->sec_mixpos < remainder && This->state == STATE_PLAYING)
576  WARN("Overwriting mixing position, case 3\n");
577  TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n", *(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
578  }
579  }
580 
581  RtlReleaseResource(&This->lock);
582  /* **** */
583 
584  return DS_OK;
585 }
#define TRUE
Definition: types.h:120
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
#define WARN(fmt,...)
Definition: debug.h:111
#define STATE_PLAYING
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#define DSDDESC_DONTNEEDSECONDARYLOCK
Definition: dsdriver.h:54
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(IDirectSoundBuffer8 *iface, DWORD *playpos, DWORD *writepos)
Definition: buffer.c:398
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
unsigned char * LPBYTE
Definition: typedefs.h:52
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
double __cdecl remainder(double, double)
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define DSBLOCK_FROMWRITECURSOR
Definition: dsound.h:203
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define IDsDriverBuffer_Lock(p, a, b, c, d, e, f, g)
Definition: dsdriver.h:196
#define DSBLOCK_ENTIREBUFFER
Definition: dsound.h:204

◆ IDirectSoundBufferImpl_Play()

static HRESULT WINAPI IDirectSoundBufferImpl_Play ( IDirectSoundBuffer8 *  iface,
DWORD  reserved1,
DWORD  reserved2,
DWORD  flags 
)
static

Definition at line 307 of file buffer.c.

309 {
311  HRESULT hres = DS_OK;
312 
313  TRACE("(%p,%08x,%08x,%08x)\n",This,reserved1,reserved2,flags);
314 
315  /* **** */
317 
318  This->playflags = flags;
319  if (This->state == STATE_STOPPED && !This->hwbuf) {
320  This->leadin = TRUE;
321  This->state = STATE_STARTING;
322  } else if (This->state == STATE_STOPPING)
323  This->state = STATE_PLAYING;
324  if (This->hwbuf) {
325  hres = IDsDriverBuffer_Play(This->hwbuf, 0, 0, This->playflags);
326  if (hres != DS_OK)
327  WARN("IDsDriverBuffer_Play failed\n");
328  else
329  This->state = STATE_PLAYING;
330  }
331 
332  RtlReleaseResource(&This->lock);
333  /* **** */
334 
335  return hres;
336 }
#define TRUE
Definition: types.h:120
#define IDsDriverBuffer_Play(p, a, b, c)
Definition: dsdriver.h:203
#define WARN(fmt,...)
Definition: debug.h:111
#define STATE_PLAYING
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define STATE_STOPPED
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
uint8_t reserved2[12]
Definition: fsck.fat.h:58
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define STATE_STARTING
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define STATE_STOPPING
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_QueryInterface()

static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface ( IDirectSoundBuffer8 *  iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 835 of file buffer.c.

837 {
839 
840  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
841 
842  if (ppobj == NULL) {
843  WARN("invalid parameter\n");
844  return E_INVALIDARG;
845  }
846 
847  *ppobj = NULL; /* assume failure */
848 
849  if ( IsEqualGUID(riid, &IID_IUnknown) ||
850  IsEqualGUID(riid, &IID_IDirectSoundBuffer) ||
851  IsEqualGUID(riid, &IID_IDirectSoundBuffer8) ) {
853  *ppobj = iface;
854  return S_OK;
855  }
856 
857  if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
858  if (!This->notify)
860  if (This->notify) {
862  *ppobj = This->notify;
863  return S_OK;
864  }
865  WARN("IID_IDirectSoundNotify\n");
866  return E_NOINTERFACE;
867  }
868 
869  if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
870  if (!This->ds3db)
872  if (This->ds3db) {
874  *ppobj = This->ds3db;
875  return S_OK;
876  }
877  WARN("IID_IDirectSound3DBuffer\n");
878  return E_NOINTERFACE;
879  }
880 
881  if ( IsEqualGUID( &IID_IDirectSound3DListener, riid ) ) {
882  ERR("app requested IDirectSound3DListener on secondary buffer\n");
883  return E_NOINTERFACE;
884  }
885 
886  if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
887  if (!This->iks)
889  if (This->iks) {
891  *ppobj = This->iks;
892  return S_OK;
893  }
894  WARN("IID_IKsPropertySet\n");
895  return E_NOINTERFACE;
896  }
897 
898  FIXME( "Unknown IID %s\n", debugstr_guid( riid ) );
899 
900  return E_NOINTERFACE;
901 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define IDirectSoundBuffer8_AddRef(p)
Definition: dsound.h:659
static HRESULT IDirectSoundNotifyImpl_Create(IDirectSoundBufferImpl *dsb, IDirectSoundNotifyImpl **pdsn)
Definition: buffer.c:131
HRESULT IDirectSound3DBufferImpl_Create(IDirectSoundBufferImpl *dsb, IDirectSound3DBufferImpl **pds3db) DECLSPEC_HIDDEN
Definition: sound3d.c:667
#define FIXME(fmt,...)
Definition: debug.h:110
#define IKsPropertySet_AddRef(p)
Definition: dsound.h:1149
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
HRESULT IKsBufferPropertySetImpl_Create(IDirectSoundBufferImpl *dsb, IKsBufferPropertySetImpl **piks)
Definition: buffer.c:1390
#define IDirectSoundNotify_AddRef(p)
Definition: dsound.h:893
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirectSound3DBuffer_AddRef(p)
Definition: dsound.h:1072
const GUID IID_IUnknown
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
Definition: dsound.h:82
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
struct IDirectSound3DBuffer * LPDIRECTSOUND3DBUFFER
Definition: dsound.h:89
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ IDirectSoundBufferImpl_Release()

static ULONG WINAPI IDirectSoundBufferImpl_Release ( IDirectSoundBuffer8 *  iface)
static

Definition at line 382 of file buffer.c.

383 {
386 
387  TRACE("(%p) ref was %d\n", This, ref + 1);
388 
389  if (!ref && !InterlockedDecrement(&This->numIfaces)) {
390  if (is_primary_buffer(This))
392  else
394  }
395  return ref;
396 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
Definition: buffer.c:1113
void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN
Definition: primary.c:763
unsigned int ULONG
Definition: retypes.h:1
static BOOL is_primary_buffer(IDirectSoundBufferImpl *This)
Definition: buffer.c:174

◆ IDirectSoundBufferImpl_Restore()

static HRESULT WINAPI IDirectSoundBufferImpl_Restore ( IDirectSoundBuffer8 *  iface)
static

Definition at line 731 of file buffer.c.

732 {
734 
735  FIXME("(%p):stub\n",This);
736  return DS_OK;
737 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define DS_OK
Definition: dsound.h:116
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_SetCurrentPosition()

static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition ( IDirectSoundBuffer8 *  iface,
DWORD  newpos 
)
static

Definition at line 587 of file buffer.c.

589 {
591  HRESULT hres = DS_OK;
592  DWORD oldpos;
593 
594  TRACE("(%p,%d)\n",This,newpos);
595 
596  /* **** */
598 
599  oldpos = This->sec_mixpos;
600 
601  /* start mixing from this new location instead */
602  newpos %= This->buflen;
603  newpos -= newpos%This->pwfx->nBlockAlign;
604  This->sec_mixpos = newpos;
605 
606  /* at this point, do not attempt to reset buffers, mess with primary mix position,
607  or anything like that to reduce latency. The data already prebuffered cannot be changed */
608 
609  /* position HW buffer if applicable, else just start mixing from new location instead */
610  if (This->hwbuf) {
611  hres = IDsDriverBuffer_SetPosition(This->hwbuf, This->buf_mixpos);
612  if (hres != DS_OK)
613  WARN("IDsDriverBuffer_SetPosition failed\n");
614  }
615  else if (oldpos != newpos)
616  /* FIXME: Perhaps add a call to DSOUND_MixToTemporary here? Not sure it's needed */
617  This->buf_mixpos = DSOUND_secpos_to_bufpos(This, newpos, 0, NULL);
618 
619  RtlReleaseResource(&This->lock);
620  /* **** */
621 
622  return hres;
623 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
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 IDsDriverBuffer_SetPosition(p, a)
Definition: dsdriver.h:201
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
DWORD DSOUND_secpos_to_bufpos(const IDirectSoundBufferImpl *dsb, DWORD secpos, DWORD secmixpos, DWORD *overshot) DECLSPEC_HIDDEN
Definition: mixer.c:99
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_SetFormat()

static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat ( IDirectSoundBuffer8 *  iface,
LPCWAVEFORMATEX  wfex 
)
static

Definition at line 179 of file buffer.c.

181 {
183 
184  TRACE("(%p,%p)\n", iface, wfex);
185 
186  if (is_primary_buffer(This))
187  return primarybuffer_SetFormat(This->device, wfex);
188  else {
189  WARN("not available for secondary buffers.\n");
190  return DSERR_INVALIDCALL;
191  }
192 }
#define DSERR_INVALIDCALL
Definition: dsound.h:122
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:460
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
static BOOL is_primary_buffer(IDirectSoundBufferImpl *This)
Definition: buffer.c:174

◆ IDirectSoundBufferImpl_SetFrequency()

static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency ( IDirectSoundBuffer8 *  iface,
DWORD  freq 
)
static

Definition at line 264 of file buffer.c.

265 {
267  DWORD oldFreq;
268 
269  TRACE("(%p,%d)\n",This,freq);
270 
271  if (is_primary_buffer(This)) {
272  WARN("not available for primary buffers.\n");
273  return DSERR_CONTROLUNAVAIL;
274  }
275 
276  if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
277  WARN("control unavailable\n");
278  return DSERR_CONTROLUNAVAIL;
279  }
280 
281  if (freq == DSBFREQUENCY_ORIGINAL)
282  freq = This->pwfx->nSamplesPerSec;
283 
284  if ((freq < DSBFREQUENCY_MIN) || (freq > DSBFREQUENCY_MAX)) {
285  WARN("invalid parameter: freq = %d\n", freq);
286  return DSERR_INVALIDPARAM;
287  }
288 
289  /* **** */
291 
292  oldFreq = This->freq;
293  This->freq = freq;
294  if (freq != oldFreq) {
295  This->freqAdjust = ((DWORD64)This->freq << DSOUND_FREQSHIFT) / This->device->pwfx->nSamplesPerSec;
296  This->nAvgBytesPerSec = freq * This->pwfx->nBlockAlign;
298  DSOUND_MixToTemporary(This, 0, This->buflen, FALSE);
299  }
300 
301  RtlReleaseResource(&This->lock);
302  /* **** */
303 
304  return DS_OK;
305 }
#define TRUE
Definition: types.h:120
#define DSBFREQUENCY_MAX
Definition: dsound.h:232
#define WARN(fmt,...)
Definition: debug.h:111
#define DSBFREQUENCY_ORIGINAL
Definition: dsound.h:233
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define DSOUND_FREQSHIFT
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
#define DSBFREQUENCY_MIN
Definition: dsound.h:231
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
unsigned long DWORD
Definition: ntddk_ex.h:95
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
uint64_t DWORD64
Definition: typedefs.h:65
#define DSBCAPS_CTRLFREQUENCY
Definition: dsound.h:211
static BOOL is_primary_buffer(IDirectSoundBufferImpl *This)
Definition: buffer.c:174
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_SetFX()

static HRESULT WINAPI IDirectSoundBufferImpl_SetFX ( IDirectSoundBuffer8 *  iface,
DWORD  dwEffectsCount,
LPDSEFFECTDESC  pDSFXDesc,
DWORD pdwResultCodes 
)
static

Definition at line 756 of file buffer.c.

758 {
760  DWORD u;
761 
762  FIXME("(%p,%u,%p,%p): stub\n",This,dwEffectsCount,pDSFXDesc,pdwResultCodes);
763 
764  if (pdwResultCodes)
765  for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN;
766 
767  WARN("control unavailable\n");
768  return DSERR_CONTROLUNAVAIL;
769 }
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 * u
Definition: glfuncs.h:240
#define WARN(fmt,...)
Definition: debug.h:111
#define FIXME(fmt,...)
Definition: debug.h:110
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
unsigned long DWORD
Definition: ntddk_ex.h:95
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169

◆ IDirectSoundBufferImpl_SetPan()

static HRESULT WINAPI IDirectSoundBufferImpl_SetPan ( IDirectSoundBuffer8 *  iface,
LONG  pan 
)
static

Definition at line 625 of file buffer.c.

626 {
628  HRESULT hres = DS_OK;
629 
630  TRACE("(%p,%d)\n",This,pan);
631 
632  if ((pan > DSBPAN_RIGHT) || (pan < DSBPAN_LEFT)) {
633  WARN("invalid parameter: pan = %d\n", pan);
634  return DSERR_INVALIDPARAM;
635  }
636 
637  /* You cannot use both pan and 3D controls */
638  if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN) ||
639  (This->dsbd.dwFlags & DSBCAPS_CTRL3D)) {
640  WARN("control unavailable\n");
641  return DSERR_CONTROLUNAVAIL;
642  }
643 
644  /* **** */
646 
647  if (This->volpan.lPan != pan) {
648  This->volpan.lPan = pan;
649  DSOUND_RecalcVolPan(&(This->volpan));
650 
651  if (This->hwbuf) {
652  hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan));
653  if (hres != DS_OK)
654  WARN("IDsDriverBuffer_SetVolumePan failed\n");
655  }
656  }
657 
658  RtlReleaseResource(&This->lock);
659  /* **** */
660 
661  return hres;
662 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
#define DSBCAPS_CTRLPAN
Definition: dsound.h:212
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#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:77
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
#define IDsDriverBuffer_SetVolumePan(p, a)
Definition: dsdriver.h:200
#define DSBPAN_RIGHT
Definition: dsound.h:228
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define DSBCAPS_CTRL3D
Definition: dsound.h:210
#define DSBPAN_LEFT
Definition: dsound.h:226
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_SetVolume()

static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume ( IDirectSoundBuffer8 *  iface,
LONG  vol 
)
static

Definition at line 194 of file buffer.c.

195 {
197  LONG oldVol;
198 
199  HRESULT hres = DS_OK;
200 
201  TRACE("(%p,%d)\n",This,vol);
202 
203  if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
204  WARN("control unavailable: This->dsbd.dwFlags = 0x%08x\n", This->dsbd.dwFlags);
205  return DSERR_CONTROLUNAVAIL;
206  }
207 
208  if ((vol > DSBVOLUME_MAX) || (vol < DSBVOLUME_MIN)) {
209  WARN("invalid parameter: vol = %d\n", vol);
210  return DSERR_INVALIDPARAM;
211  }
212 
213  /* **** */
215 
216  if (This->dsbd.dwFlags & DSBCAPS_CTRL3D) {
217  oldVol = This->ds3db_lVolume;
218  This->ds3db_lVolume = vol;
219  if (vol != oldVol)
220  /* recalc 3d volume, which in turn recalcs the pans */
222  } else {
223  oldVol = This->volpan.lVolume;
224  This->volpan.lVolume = vol;
225  if (vol != oldVol)
226  DSOUND_RecalcVolPan(&(This->volpan));
227  }
228 
229  if (vol != oldVol) {
230  if (This->hwbuf) {
231  hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan));
232  if (hres != DS_OK)
233  WARN("IDsDriverBuffer_SetVolumePan failed\n");
234  }
235  }
236 
237  RtlReleaseResource(&This->lock);
238  /* **** */
239 
240  return hres;
241 }
#define TRUE
Definition: types.h:120
#define DSBCAPS_CTRLVOLUME
Definition: dsound.h:213
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: sound3d.c:141
#define WARN(fmt,...)
Definition: debug.h:111
#define DSBVOLUME_MAX
Definition: dsound.h:229
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
long LONG
Definition: pedump.c:60
#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 DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
#define IDsDriverBuffer_SetVolumePan(p, a)
Definition: dsdriver.h:200
#define DSBVOLUME_MIN
Definition: dsound.h:230
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define DSBCAPS_CTRL3D
Definition: dsound.h:210
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_Stop()

static HRESULT WINAPI IDirectSoundBufferImpl_Stop ( IDirectSoundBuffer8 *  iface)
static

Definition at line 338 of file buffer.c.

339 {
341  HRESULT hres = DS_OK;
342 
343  TRACE("(%p)\n",This);
344 
345  /* **** */
347 
348  if (This->state == STATE_PLAYING)
349  This->state = STATE_STOPPING;
350  else if (This->state == STATE_STARTING)
351  {
352  This->state = STATE_STOPPED;
353  DSOUND_CheckEvent(This, 0, 0);
354  }
355  if (This->hwbuf) {
356  hres = IDsDriverBuffer_Stop(This->hwbuf);
357  if (hres != DS_OK)
358  WARN("IDsDriverBuffer_Stop failed\n");
359  else
360  This->state = STATE_STOPPED;
361  }
362 
363  RtlReleaseResource(&This->lock);
364  /* **** */
365 
366  return hres;
367 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
#define STATE_PLAYING
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define STATE_STOPPED
#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
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len) DECLSPEC_HIDDEN
Definition: mixer.c:221
#define STATE_STARTING
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
#define IDsDriverBuffer_Stop(p)
Definition: dsdriver.h:204
#define STATE_STOPPING
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

◆ IDirectSoundBufferImpl_Unlock()

static HRESULT WINAPI IDirectSoundBufferImpl_Unlock ( IDirectSoundBuffer8 *  iface,
void p1,
DWORD  x1,
void p2,
DWORD  x2 
)
static

Definition at line 685 of file buffer.c.

687 {
689  HRESULT hres = DS_OK;
690 
691  TRACE("(%p,%p,%d,%p,%d)\n", This,p1,x1,p2,x2);
692 
693  /* **** */
695 
696  if (!(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) {
697  hres = IDsDriverBuffer_Unlock(This->hwbuf, p1, x1, p2, x2);
698  if (hres != DS_OK)
699  WARN("IDsDriverBuffer_Unlock failed\n");
700  }
701 
702  RtlReleaseResource(&This->lock);
703  /* **** */
704 
705  if (!p2)
706  x2 = 0;
707 
708  if (!This->hwbuf && (x1 || x2))
709  {
710  RtlAcquireResourceShared(&This->device->buffer_list_lock, TRUE);
711  LIST_FOR_EACH_ENTRY(iter, &This->buffer->buffers, IDirectSoundBufferImpl, entry )
712  {
713  RtlAcquireResourceShared(&iter->lock, TRUE);
714  if (x1)
715  {
716  if(x1 + (DWORD_PTR)p1 - (DWORD_PTR)iter->buffer->memory > iter->buflen)
718  else
719  DSOUND_MixToTemporary(iter, (DWORD_PTR)p1 - (DWORD_PTR)iter->buffer->memory, x1, FALSE);
720  }
721  if (x2)
722  DSOUND_MixToTemporary(iter, 0, x2, FALSE);
723  RtlReleaseResource(&iter->lock);
724  }
725  RtlReleaseResource(&This->device->buffer_list_lock);
726  }
727 
728  return hres;
729 }
#define TRUE
Definition: types.h:120
#define IDsDriverBuffer_Unlock(p, a, b, c, d)
Definition: dsdriver.h:197
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define WARN(fmt,...)
Definition: debug.h:111
#define DSDDESC_DONTNEEDSECONDARYLOCK
Definition: dsdriver.h:54
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#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:77
uint32_t entry
Definition: isohybrid.c:63
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
uint32_t DWORD_PTR
Definition: typedefs.h:63
static IDirectSoundBufferImpl * impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
Definition: buffer.c:169
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706

◆ IDirectSoundNotifyImpl_AddRef()

static ULONG WINAPI IDirectSoundNotifyImpl_AddRef ( LPDIRECTSOUNDNOTIFY  iface)
static

Definition at line 54 of file buffer.c.

55 {
58  TRACE("(%p) ref was %d\n", This, ref - 1);
59  return ref;
60 }
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

◆ IDirectSoundNotifyImpl_Create()

static HRESULT IDirectSoundNotifyImpl_Create ( IDirectSoundBufferImpl dsb,
IDirectSoundNotifyImpl **  pdsn 
)
static

Definition at line 131 of file buffer.c.

134 {
136  TRACE("(%p,%p)\n",dsb,pdsn);
137 
138  dsn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dsn));
139 
140  if (dsn == NULL) {
141  WARN("out of memory\n");
142  return DSERR_OUTOFMEMORY;
143  }
144 
145  dsn->ref = 0;
146  dsn->lpVtbl = &dsnvt;
147  dsn->dsb = dsb;
148  dsb->notify = dsn;
150 
151  *pdsn = dsn;
152  return DS_OK;
153 }
IDirectSoundBufferImpl * dsb
Definition: buffer.c:33
#define IDirectSoundBuffer_AddRef(p)
Definition: dsound.h:573
IDirectSoundNotifyImpl * notify
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
const IDirectSoundNotifyVtbl * lpVtbl
Definition: buffer.c:31
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const IDirectSoundNotifyVtbl dsnvt
Definition: buffer.c:123

Referenced by IDirectSoundBufferImpl_QueryInterface().

◆ IDirectSoundNotifyImpl_Destroy()

static HRESULT IDirectSoundNotifyImpl_Destroy ( IDirectSoundNotifyImpl pdsn)
static

Definition at line 155 of file buffer.c.

157 {
158  TRACE("(%p)\n",pdsn);
159 
161 
162  return DS_OK;
163 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
Definition: dsound.h:82
static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
Definition: buffer.c:62

Referenced by IDirectSoundBufferImpl_Destroy().

◆ IDirectSoundNotifyImpl_QueryInterface()

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

Definition at line 40 of file buffer.c.

42  {
44  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
45 
46  if (This->dsb == NULL) {
47  WARN("invalid parameter\n");
48  return E_INVALIDARG;
49  }
50 
52 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define IDirectSoundBuffer_QueryInterface(p, a, b)
Definition: dsound.h:572
#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 IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76

◆ IDirectSoundNotifyImpl_Release()

static ULONG WINAPI IDirectSoundNotifyImpl_Release ( LPDIRECTSOUNDNOTIFY  iface)
static

Definition at line 62 of file buffer.c.

63 {
66  TRACE("(%p) ref was %d\n", This, ref + 1);
67 
68  if (!ref) {
69  This->dsb->notify = NULL;
72  TRACE("(%p) released\n", This);
73  }
74  return ref;
75 }
#define IDirectSoundBuffer_Release(p)
Definition: dsound.h:574
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:395
#define InterlockedDecrement
Definition: armddk.h:52
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by IDirectSoundNotifyImpl_Destroy().

◆ IDirectSoundNotifyImpl_SetNotificationPositions()

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

Definition at line 77 of file buffer.c.

79  {
81  TRACE("(%p,0x%08x,%p)\n",This,howmuch,notify);
82 
83  if (howmuch > 0 && notify == NULL) {
84  WARN("invalid parameter: notify == NULL\n");
85  return DSERR_INVALIDPARAM;
86  }
87 
88  if (TRACE_ON(dsound)) {
89  unsigned int i;
90  for (i=0;i<howmuch;i++)
91  TRACE("notify at %d to %p\n",
92  notify[i].dwOffset,notify[i].hEventNotify);
93  }
94 
95  if (This->dsb->hwnotify) {
96  HRESULT hres;
97  hres = IDsDriverNotify_SetNotificationPositions(This->dsb->hwnotify, howmuch, notify);
98  if (hres != DS_OK)
99  WARN("IDsDriverNotify_SetNotificationPositions failed\n");
100  return hres;
101  } else if (howmuch > 0) {
102  /* Make an internal copy of the caller-supplied array.
103  * Replace the existing copy if one is already present. */
104  HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
105  This->dsb->notifies = HeapAlloc(GetProcessHeap(), 0,
106  howmuch * sizeof(DSBPOSITIONNOTIFY));
107 
108  if (This->dsb->notifies == NULL) {
109  WARN("out of memory\n");
110  return DSERR_OUTOFMEMORY;
111  }
112  CopyMemory(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
113  This->dsb->nrofnotifies = howmuch;
114  } else {
115  HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
116  This->dsb->notifies = NULL;
117  This->dsb->nrofnotifies = 0;
118  }
119 
120  return S_OK;
121 }
#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:395
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 TRACE_ON(x)
Definition: compat.h:65
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDsDriverNotify_SetNotificationPositions(p, a, b)
Definition: dsdriver.h:291

◆ IKsBufferPropertySetImpl_AddRef()

static ULONG WINAPI IKsBufferPropertySetImpl_AddRef ( LPKSPROPERTYSET  iface)
static

Definition at line 1257 of file buffer.c.

1258 {
1260  ULONG ref = InterlockedIncrement(&(This->ref));
1261  TRACE("(%p) ref was %d\n", This, ref - 1);
1262  return ref;
1263 }
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

◆ IKsBufferPropertySetImpl_Create()

HRESULT IKsBufferPropertySetImpl_Create ( IDirectSoundBufferImpl dsb,
IKsBufferPropertySetImpl **  piks 
)

Definition at line 1390 of file buffer.c.

1393 {
1395  TRACE("(%p,%p)\n",dsb,piks);
1396  *piks = NULL;
1397 
1398  iks = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*iks));
1399  if (iks == 0) {
1400  WARN("out of memory\n");
1401  *piks = NULL;
1402  return DSERR_OUTOFMEMORY;
1403  }
1404 
1405  iks->ref = 0;
1406  iks->dsb = dsb;
1407  dsb->iks = iks;
1408  iks->lpVtbl = &iksbvt;
1409 
1411 
1412  *piks = iks;
1413  return S_OK;
1414 }
#define IDirectSoundBuffer_AddRef(p)
Definition: dsound.h:573
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
smooth NULL
Definition: ftsmooth.c:416
const IKsPropertySetVtbl * lpVtbl
static const IKsPropertySetVtbl iksbvt
Definition: buffer.c:1381
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
IKsBufferPropertySetImpl * iks
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
#define S_OK
Definition: intsafe.h:59
IDirectSoundBufferImpl * dsb
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by IDirectSoundBufferImpl_QueryInterface().

◆ IKsBufferPropertySetImpl_Destroy()

HRESULT IKsBufferPropertySetImpl_Destroy ( IKsBufferPropertySetImpl piks)

Definition at line 1416 of file buffer.c.

1418 {
1419  TRACE("(%p)\n",piks);
1420 
1422 
1423  return S_OK;
1424 }
static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface)
Definition: buffer.c:1265
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by IDirectSoundBufferImpl_Destroy().

◆ IKsBufferPropertySetImpl_Get()

static HRESULT WINAPI IKsBufferPropertySetImpl_Get ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
LPVOID  pInstanceData,
ULONG  cbInstanceData,
LPVOID  pPropData,
ULONG  cbPropData,
PULONG  pcbReturned 
)
static

Definition at line 1280 of file buffer.c.

1289 {
1292  TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
1293  This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
1294 
1295  if (This->dsb->hwbuf) {
1296  IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
1297 
1298  if (ps) {
1299  DSPROPERTY prop;
1300  HRESULT hres;
1301 
1302  prop.s.Set = *guidPropSet;
1303  prop.s.Id = dwPropID;
1304  prop.s.Flags = 0; /* unused */
1305  prop.s.InstanceId = (ULONG_PTR)This->dsb->device;
1306 
1307 
1308  hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
1309 
1311 
1312  return hres;
1313  }
1314  }
1315 
1316  return E_PROP_ID_UNSUPPORTED;
1317 }
#define IDsDriverPropertySet_Release(p)
Definition: dsdriver.h:228
GUID Set
Definition: dsdriver.h:117
ULONG Flags
Definition: dsdriver.h:119
#define IDsDriver_QueryInterface(p, a, b)
Definition: dsdriver.h:155
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
LONG HRESULT
Definition: typedefs.h:77
ULONG InstanceId
Definition: dsdriver.h:120
struct IDsDriverPropertySet * PIDSDRIVERPROPERTYSET
Definition: dsdriver.h:39
ULONG Id
Definition: dsdriver.h:118
#define ULONG_PTR
Definition: config.h:101
#define IDsDriverPropertySet_Get(p, a, b, c, d, e, f)
Definition: dsdriver.h:230

◆ IKsBufferPropertySetImpl_QueryInterface()

static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface ( LPKSPROPERTYSET  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 1246 of file buffer.c.

1250 {
1252  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
1253 
1255 }
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
REFIID riid
Definition: precomp.h:44
#define IDirectSoundBuffer_QueryInterface(p, a, b)
Definition: dsound.h:572
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ IKsBufferPropertySetImpl_QuerySupport()

static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
PULONG  pTypeSupport 
)
static

Definition at line 1354 of file buffer.c.

1359 {
1362  TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
1363 
1364  if (This->dsb->hwbuf) {
1365  IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
1366 
1367  if (ps) {
1368  HRESULT hres;
1369 
1370  hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport);
1371 
1373 
1374  return hres;
1375  }
1376  }
1377 
1378  return E_PROP_ID_UNSUPPORTED;
1379 }
#define IDsDriverPropertySet_Release(p)
Definition: dsdriver.h:228
#define IDsDriver_QueryInterface(p, a, b)
Definition: dsdriver.h:155
#define debugstr_guid
Definition: kernel32.h:35
#define IDsDriverPropertySet_QuerySupport(p, a, b, c)
Definition: dsdriver.h:232
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
LONG HRESULT
Definition: typedefs.h:77
struct IDsDriverPropertySet * PIDSDRIVERPROPERTYSET
Definition: dsdriver.h:39

◆ IKsBufferPropertySetImpl_Release()

static ULONG WINAPI IKsBufferPropertySetImpl_Release ( LPKSPROPERTYSET  iface)
static

Definition at line 1265 of file buffer.c.

1266 {
1268  ULONG ref = InterlockedDecrement(&(This->ref));
1269  TRACE("(%p) ref was %d\n", This, ref + 1);
1270 
1271  if (!ref) {
1272  This->dsb->iks = 0;
1274  HeapFree(GetProcessHeap(), 0, This);
1275  TRACE("(%p) released\n", This);
1276  }
1277  return ref;
1278 }
#define IDirectSoundBuffer_Release(p)
Definition: dsound.h:574
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
struct IDirectSound3DBuffer * LPDIRECTSOUND3DBUFFER
Definition: dsound.h:89
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by IKsBufferPropertySetImpl_Destroy().

◆ IKsBufferPropertySetImpl_Set()

static HRESULT WINAPI IKsBufferPropertySetImpl_Set ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
LPVOID  pInstanceData,
ULONG  cbInstanceData,
LPVOID  pPropData,
ULONG  cbPropData 
)
static

Definition at line 1319 of file buffer.c.

1327 {
1330  TRACE("(%p,%s,%d,%p,%d,%p,%d)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
1331 
1332  if (This->dsb->hwbuf) {
1333  IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
1334 
1335  if (ps) {
1336  DSPROPERTY prop;
1337  HRESULT hres;
1338 
1339  prop.s.Set = *guidPropSet;
1340  prop.s.Id = dwPropID;
1341  prop.s.Flags = 0; /* unused */
1342  prop.s.InstanceId = (ULONG_PTR)This->dsb->device;
1343  hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData);
1344 
1346 
1347  return hres;
1348  }
1349  }
1350 
1351  return E_PROP_ID_UNSUPPORTED;
1352 }
#define IDsDriverPropertySet_Release(p)
Definition: dsdriver.h:228
GUID Set
Definition: dsdriver.h:117
ULONG Flags
Definition: dsdriver.h:119
#define IDsDriverPropertySet_Set(p, a, b, c, d, e)
Definition: dsdriver.h:231
#define IDsDriver_QueryInterface(p, a, b)
Definition: dsdriver.h:155
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
LONG HRESULT
Definition: typedefs.h:77
ULONG InstanceId
Definition: dsdriver.h:120
struct IDsDriverPropertySet * PIDSDRIVERPROPERTYSET
Definition: dsdriver.h:39
ULONG Id
Definition: dsdriver.h:118
#define ULONG_PTR
Definition: config.h:101

◆ impl_from_IDirectSoundBuffer8()

◆ is_primary_buffer()

static BOOL is_primary_buffer ( IDirectSoundBufferImpl This)
inlinestatic

Definition at line 174 of file buffer.c.

175 {
176  return This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER ? TRUE : FALSE;
177 }
#define TRUE
Definition: types.h:120
#define DSBCAPS_PRIMARYBUFFER
Definition: dsound.h:206

Referenced by IDirectSoundBufferImpl_Release(), IDirectSoundBufferImpl_SetFormat(), and IDirectSoundBufferImpl_SetFrequency().

◆ secondarybuffer_destroy()

void secondarybuffer_destroy ( IDirectSoundBufferImpl This)

Definition at line 1113 of file buffer.c.

1114 {
1116  RtlDeleteResource(&This->lock);
1117 
1118  if (This->hwbuf)
1119  IDsDriverBuffer_Release(This->hwbuf);
1120  if (!This->hwbuf || (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)) {
1121  This->buffer->ref--;
1122  list_remove(&This->entry);
1123  if (This->buffer->ref == 0) {
1124  HeapFree(GetProcessHeap(), 0, This->buffer->memory);
1125  HeapFree(GetProcessHeap(), 0, This->buffer);
1126  }
1127  }
1128 
1129  HeapFree(GetProcessHeap(), 0, This->tmp_buffer);
1130  HeapFree(GetProcessHeap(), 0, This->notifies);
1131  HeapFree(GetProcessHeap(), 0, This->pwfx);
1132  HeapFree(GetProcessHeap(), 0, This);
1133 
1134  TRACE("(%p) released\n", This);
1135 }
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
#define IDsDriverBuffer_Release(p)
Definition: dsdriver.h:194
HRESULT DirectSoundDevice_RemoveBuffer(DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB)
Definition: dsound.c:1796
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52

Referenced by IDirectSound3DBufferImpl_Release(), IDirectSoundBufferImpl_Destroy(), and IDirectSoundBufferImpl_Release().

Variable Documentation

◆ dsbvt

const IDirectSoundBuffer8Vtbl dsbvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSoundBufferImpl_SetFX(IDirectSoundBuffer8 *iface, DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, DWORD *pdwResultCodes)
Definition: buffer.c:756
static ULONG WINAPI IDirectSoundBufferImpl_Release(IDirectSoundBuffer8 *iface)
Definition: buffer.c:382
static HRESULT WINAPI IDirectSoundBufferImpl_Lock(IDirectSoundBuffer8 *iface, DWORD writecursor, DWORD writebytes, void **lplpaudioptr1, DWORD *audiobytes1, void **lplpaudioptr2, DWORD *audiobytes2, DWORD flags)
Definition: buffer.c:499
static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath(IDirectSoundBuffer8 *iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, void **ppObject)
Definition: buffer.c:786
static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuffer8 *iface, DWORD newpos)
Definition: buffer.c:587
static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(IDirectSoundBuffer8 *iface, void *p1, DWORD x1, void *p2, DWORD x2)
Definition: buffer.c:685
static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface)
Definition: buffer.c:338
static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(IDirectSoundBuffer8 *iface, LPCWAVEFORMATEX wfex)
Definition: buffer.c:179
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(IDirectSoundBuffer8 *iface, DWORD *playpos, DWORD *writepos)
Definition: buffer.c:398
static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat(IDirectSoundBuffer8 *iface, LPWAVEFORMATEX lpwf, DWORD wfsize, DWORD *wfwritten)
Definition: buffer.c:465
static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume(IDirectSoundBuffer8 *iface, LONG *vol)
Definition: buffer.c:243
static ULONG WINAPI IDirectSoundBufferImpl_AddRef(IDirectSoundBuffer8 *iface)
Definition: buffer.c:369
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LONG vol)
Definition: buffer.c:194
static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(IDirectSoundBuffer8 *iface, DWORD freq)
Definition: buffer.c:264
static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8 *iface, REFIID riid, void **ppobj)
Definition: buffer.c:835
static HRESULT WINAPI IDirectSoundBufferImpl_Play(IDirectSoundBuffer8 *iface, DWORD reserved1, DWORD reserved2, DWORD flags)
Definition: buffer.c:307
static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources(IDirectSoundBuffer8 *iface, DWORD dwFlags, DWORD dwEffectsCount, DWORD *pdwResultCodes)
Definition: buffer.c:771
static HRESULT WINAPI IDirectSoundBufferImpl_SetPan(IDirectSoundBuffer8 *iface, LONG pan)
Definition: buffer.c:625
static HRESULT WINAPI IDirectSoundBufferImpl_GetPan(IDirectSoundBuffer8 *iface, LONG *pan)
Definition: buffer.c:664
static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency(IDirectSoundBuffer8 *iface, DWORD *freq)
Definition: buffer.c:739
static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus(IDirectSoundBuffer8 *iface, DWORD *status)
Definition: buffer.c:440
static HRESULT WINAPI IDirectSoundBufferImpl_Initialize(IDirectSoundBuffer8 *iface, IDirectSound *dsound, LPCDSBUFFERDESC dbsd)
Definition: buffer.c:797
static HRESULT WINAPI IDirectSoundBufferImpl_Restore(IDirectSoundBuffer8 *iface)
Definition: buffer.c:731
static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps(IDirectSoundBuffer8 *iface, LPDSBCAPS caps)
Definition: buffer.c:806

Definition at line 903 of file buffer.c.

Referenced by IDirectSoundBufferImpl_Create().

◆ dsnvt

const IDirectSoundNotifyVtbl dsnvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(LPDIRECTSOUNDNOTIFY iface, DWORD howmuch, LPCDSBPOSITIONNOTIFY notify)
Definition: buffer.c:77
static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
Definition: buffer.c:62
static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
Definition: buffer.c:54
static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface(LPDIRECTSOUNDNOTIFY iface, REFIID riid, LPVOID *ppobj)
Definition: buffer.c:40

Definition at line 123 of file buffer.c.

Referenced by IDirectSoundNotifyImpl_Create().

◆ iksbvt

const IKsPropertySetVtbl iksbvt
static
Initial value:
= {
}
static HRESULT WINAPI IKsBufferPropertySetImpl_Get(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData, PULONG pcbReturned)
Definition: buffer.c:1280
static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport)
Definition: buffer.c:1354
static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface(LPKSPROPERTYSET iface, REFIID riid, LPVOID *ppobj)
Definition: buffer.c:1246
static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface)
Definition: buffer.c:1265
static HRESULT WINAPI IKsBufferPropertySetImpl_Set(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData)
Definition: buffer.c:1319
static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface)
Definition: buffer.c:1257

Definition at line 1381 of file buffer.c.

Referenced by IKsBufferPropertySetImpl_Create().