2002-06-13 21:15:06 +02:00
|
|
|
/* DirectSound
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998 Rob Riggs
|
|
|
|
* Copyright 2000-2002 TransGaming Technologies, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-06-13 21:15:06 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2015-03-03 08:47:36 +01:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2005-10-17 11:24:50 +02:00
|
|
|
#include "winuser.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
#include "mmsystem.h"
|
2009-12-04 14:09:32 +01:00
|
|
|
#include "vfwmsgs.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "dsound.h"
|
|
|
|
#include "dsound_private.h"
|
2009-12-04 14:09:32 +01:00
|
|
|
#include "dsconf.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* IDirectSoundNotify
|
|
|
|
*/
|
2006-08-02 13:26:14 +02:00
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
static inline struct IDirectSoundBufferImpl *impl_from_IDirectSoundNotify(IDirectSoundNotify *iface)
|
2006-08-02 13:26:14 +02:00
|
|
|
{
|
2012-01-20 00:28:16 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct IDirectSoundBufferImpl, IDirectSoundNotify_iface);
|
|
|
|
}
|
2006-08-02 13:26:14 +02:00
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface(IDirectSoundNotify *iface, REFIID riid,
|
|
|
|
void **ppobj)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundNotify(iface);
|
2006-08-02 13:26:14 +02:00
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj);
|
2003-05-02 22:16:48 +02:00
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
return IDirectSoundBuffer8_QueryInterface(&This->IDirectSoundBuffer8_iface, riid, ppobj);
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(IDirectSoundNotify *iface)
|
2004-09-17 20:10:59 +02:00
|
|
|
{
|
2012-01-20 00:28:16 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundNotify(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->refn);
|
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2012-01-20 00:28:16 +01:00
|
|
|
|
|
|
|
if(ref == 1)
|
|
|
|
InterlockedIncrement(&This->numIfaces);
|
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
static ULONG WINAPI IDirectSoundNotifyImpl_Release(IDirectSoundNotify *iface)
|
2005-02-11 12:49:05 +01:00
|
|
|
{
|
2012-01-20 00:28:16 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundNotify(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->refn);
|
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2005-02-11 12:49:05 +01:00
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
|
|
|
secondarybuffer_destroy(This);
|
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2019-08-22 09:56:46 +02:00
|
|
|
static int __cdecl notify_compar(const void *l, const void *r)
|
2014-12-03 21:06:38 +01:00
|
|
|
{
|
|
|
|
const DSBPOSITIONNOTIFY *left = l;
|
|
|
|
const DSBPOSITIONNOTIFY *right = r;
|
|
|
|
|
|
|
|
/* place DSBPN_OFFSETSTOP at the start of the sorted array */
|
|
|
|
if(left->dwOffset == DSBPN_OFFSETSTOP){
|
|
|
|
if(right->dwOffset != DSBPN_OFFSETSTOP)
|
|
|
|
return -1;
|
|
|
|
}else if(right->dwOffset == DSBPN_OFFSETSTOP)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if(left->dwOffset == right->dwOffset)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if(left->dwOffset < right->dwOffset)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSoundNotify *iface,
|
|
|
|
DWORD howmuch, const DSBPOSITIONNOTIFY *notify)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundNotify(iface);
|
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,0x%08x,%p)\n",This,howmuch,notify);
|
2003-05-02 22:16:48 +02:00
|
|
|
|
2004-04-19 04:58:45 +02:00
|
|
|
if (howmuch > 0 && notify == NULL) {
|
2003-05-22 05:39:13 +02:00
|
|
|
WARN("invalid parameter: notify == NULL\n");
|
2003-05-02 22:16:48 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (TRACE_ON(dsound)) {
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2002-06-13 21:15:06 +02:00
|
|
|
for (i=0;i<howmuch;i++)
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("notify at %d to %p\n",
|
2005-09-12 12:30:05 +02:00
|
|
|
notify[i].dwOffset,notify[i].hEventNotify);
|
2003-05-02 22:16:48 +02:00
|
|
|
}
|
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
if (howmuch > 0) {
|
2003-05-02 22:16:48 +02:00
|
|
|
/* Make an internal copy of the caller-supplied array.
|
|
|
|
* Replace the existing copy if one is already present. */
|
2012-01-20 00:28:16 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->notifies);
|
|
|
|
This->notifies = HeapAlloc(GetProcessHeap(), 0,
|
2003-10-14 07:24:20 +02:00
|
|
|
howmuch * sizeof(DSBPOSITIONNOTIFY));
|
|
|
|
|
2012-01-20 00:28:16 +01:00
|
|
|
if (This->notifies == NULL) {
|
2003-05-22 05:39:13 +02:00
|
|
|
WARN("out of memory\n");
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
2012-01-20 00:28:16 +01:00
|
|
|
CopyMemory(This->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
|
|
|
This->nrofnotifies = howmuch;
|
2014-12-03 21:06:38 +01:00
|
|
|
qsort(This->notifies, howmuch, sizeof(DSBPOSITIONNOTIFY), notify_compar);
|
2011-09-24 16:02:52 +02:00
|
|
|
} else {
|
2012-01-20 00:28:16 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->notifies);
|
|
|
|
This->notifies = NULL;
|
|
|
|
This->nrofnotifies = 0;
|
2011-09-24 16:02:52 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectSoundNotifyVtbl dsnvt =
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundNotifyImpl_QueryInterface,
|
|
|
|
IDirectSoundNotifyImpl_AddRef,
|
|
|
|
IDirectSoundNotifyImpl_Release,
|
|
|
|
IDirectSoundNotifyImpl_SetNotificationPositions,
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* IDirectSoundBuffer
|
|
|
|
*/
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static inline IDirectSoundBufferImpl *impl_from_IDirectSoundBuffer8(IDirectSoundBuffer8 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectSoundBufferImpl, IDirectSoundBuffer8_iface);
|
|
|
|
}
|
|
|
|
|
2011-08-31 01:17:04 +02:00
|
|
|
static inline BOOL is_primary_buffer(IDirectSoundBufferImpl *This)
|
|
|
|
{
|
2012-08-13 11:43:59 +02:00
|
|
|
return (This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER) != 0;
|
2011-08-31 01:17:04 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(IDirectSoundBuffer8 *iface,
|
|
|
|
LPCWAVEFORMATEX wfex)
|
|
|
|
{
|
2011-08-31 01:17:04 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", iface, wfex);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2011-08-31 01:17:04 +02:00
|
|
|
if (is_primary_buffer(This))
|
|
|
|
return primarybuffer_SetFormat(This->device, wfex);
|
|
|
|
else {
|
|
|
|
WARN("not available for secondary buffers.\n");
|
|
|
|
return DSERR_INVALIDCALL;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LONG vol)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2002-06-13 21:15:06 +02:00
|
|
|
LONG oldVol;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2004-09-10 21:34:01 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%d)\n",This,vol);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("control unavailable: This->dsbd.dwFlags = 0x%08x\n", This->dsbd.dwFlags);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_CONTROLUNAVAIL;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if ((vol > DSBVOLUME_MAX) || (vol < DSBVOLUME_MIN)) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("invalid parameter: vol = %d\n", vol);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (This->dsbd.dwFlags & DSBCAPS_CTRL3D) {
|
2003-06-28 00:22:15 +02:00
|
|
|
oldVol = This->ds3db_lVolume;
|
|
|
|
This->ds3db_lVolume = vol;
|
2007-05-30 18:31:21 +02:00
|
|
|
if (vol != oldVol)
|
|
|
|
/* recalc 3d volume, which in turn recalcs the pans */
|
|
|
|
DSOUND_Calc3DBuffer(This);
|
2002-06-13 21:15:06 +02:00
|
|
|
} else {
|
|
|
|
oldVol = This->volpan.lVolume;
|
|
|
|
This->volpan.lVolume = vol;
|
2004-07-14 01:35:09 +02:00
|
|
|
if (vol != oldVol)
|
2003-05-22 05:39:13 +02:00
|
|
|
DSOUND_RecalcVolPan(&(This->volpan));
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-09-10 21:34:01 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume(IDirectSoundBuffer8 *iface, LONG *vol)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p,%p)\n",This,vol);
|
|
|
|
|
2003-09-15 22:08:05 +02:00
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
|
|
|
|
WARN("control unavailable\n");
|
|
|
|
return DSERR_CONTROLUNAVAIL;
|
|
|
|
}
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (vol == NULL) {
|
|
|
|
WARN("invalid parameter: vol == NULL\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-09-15 22:08:05 +02:00
|
|
|
*vol = This->volpan.lVolume;
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(IDirectSoundBuffer8 *iface, DWORD freq)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2002-06-13 21:15:06 +02:00
|
|
|
DWORD oldFreq;
|
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%d)\n",This,freq);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2011-08-31 01:19:09 +02:00
|
|
|
if (is_primary_buffer(This)) {
|
|
|
|
WARN("not available for primary buffers.\n");
|
|
|
|
return DSERR_CONTROLUNAVAIL;
|
|
|
|
}
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
|
|
|
|
WARN("control unavailable\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_CONTROLUNAVAIL;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (freq == DSBFREQUENCY_ORIGINAL)
|
2004-08-18 02:30:37 +02:00
|
|
|
freq = This->pwfx->nSamplesPerSec;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if ((freq < DSBFREQUENCY_MIN) || (freq > DSBFREQUENCY_MAX)) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("invalid parameter: freq = %d\n", freq);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
oldFreq = This->freq;
|
|
|
|
This->freq = freq;
|
|
|
|
if (freq != oldFreq) {
|
2014-12-27 23:41:07 +01:00
|
|
|
This->freqAdjustNum = This->freq;
|
|
|
|
This->freqAdjustDen = This->device->pwfx->nSamplesPerSec;
|
2004-08-18 02:30:37 +02:00
|
|
|
This->nAvgBytesPerSec = freq * This->pwfx->nBlockAlign;
|
2002-06-13 21:15:06 +02:00
|
|
|
DSOUND_RecalcFormat(This);
|
|
|
|
}
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Play(IDirectSoundBuffer8 *iface, DWORD reserved1,
|
|
|
|
DWORD reserved2, DWORD flags)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2003-05-22 05:39:13 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2015-03-11 00:51:35 +01:00
|
|
|
int i;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%08x,%08x,%08x)\n",This,reserved1,reserved2,flags);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
This->playflags = flags;
|
2011-09-24 16:02:52 +02:00
|
|
|
if (This->state == STATE_STOPPED) {
|
2002-06-13 21:15:06 +02:00
|
|
|
This->leadin = TRUE;
|
|
|
|
This->state = STATE_STARTING;
|
|
|
|
} else if (This->state == STATE_STOPPING)
|
|
|
|
This->state = STATE_PLAYING;
|
|
|
|
|
2015-03-11 00:51:35 +01:00
|
|
|
for (i = 0; i < This->num_filters; i++) {
|
|
|
|
IMediaObject_Discontinuity(This->filters[i].obj, 0);
|
|
|
|
}
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface)
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
2011-08-24 02:30:37 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2003-05-22 05:39:13 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (This->state == STATE_PLAYING)
|
|
|
|
This->state = STATE_STOPPING;
|
|
|
|
else if (This->state == STATE_STARTING)
|
2007-07-29 23:47:01 +02:00
|
|
|
{
|
2002-06-13 21:15:06 +02:00
|
|
|
This->state = STATE_STOPPED;
|
2007-07-29 23:47:01 +02:00
|
|
|
DSOUND_CheckEvent(This, 0, 0);
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static ULONG WINAPI IDirectSoundBufferImpl_AddRef(IDirectSoundBuffer8 *iface)
|
2004-09-17 20:10:59 +02:00
|
|
|
{
|
2011-08-24 02:30:37 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2011-08-25 23:42:44 +02:00
|
|
|
|
|
|
|
if(ref == 1)
|
|
|
|
InterlockedIncrement(&This->numIfaces);
|
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2003-06-28 00:22:15 +02:00
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static ULONG WINAPI IDirectSoundBufferImpl_Release(IDirectSoundBuffer8 *iface)
|
2004-09-07 21:32:21 +02:00
|
|
|
{
|
2011-08-24 02:30:37 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2012-05-09 15:48:56 +02:00
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
if (is_primary_buffer(This)){
|
|
|
|
ref = capped_refcount_dec(&This->ref);
|
|
|
|
if(!ref)
|
|
|
|
capped_refcount_dec(&This->numIfaces);
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2012-05-09 15:48:56 +02:00
|
|
|
return ref;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2012-05-09 15:48:56 +02:00
|
|
|
ref = InterlockedDecrement(&This->ref);
|
|
|
|
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
2011-08-31 01:19:09 +02:00
|
|
|
secondarybuffer_destroy(This);
|
2012-05-09 15:48:56 +02:00
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2012-05-09 15:48:56 +02:00
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(IDirectSoundBuffer8 *iface,
|
|
|
|
DWORD *playpos, DWORD *writepos)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2011-09-24 16:02:52 +02:00
|
|
|
DWORD pos;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p,%p,%p)\n",This,playpos,writepos);
|
2007-07-29 23:47:01 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockShared(&This->lock);
|
2007-07-29 23:47:01 +02:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
pos = This->sec_mixpos;
|
2007-07-29 23:47:01 +02:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
/* sanity */
|
|
|
|
if (pos >= This->buflen){
|
|
|
|
FIXME("Bad play position. playpos: %d, buflen: %d\n", pos, This->buflen);
|
|
|
|
pos %= This->buflen;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2011-09-24 16:02:52 +02:00
|
|
|
|
|
|
|
if (playpos)
|
|
|
|
*playpos = pos;
|
|
|
|
if (writepos)
|
|
|
|
*writepos = pos;
|
|
|
|
|
|
|
|
if (writepos && This->state != STATE_STOPPED) {
|
2007-07-29 23:47:01 +02:00
|
|
|
/* apply the documented 10ms lead to writepos */
|
|
|
|
*writepos += This->writelead;
|
2004-08-18 02:30:37 +02:00
|
|
|
*writepos %= This->buflen;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2011-09-24 16:02:52 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockShared(&This->lock);
|
2007-06-13 17:05:49 +02:00
|
|
|
|
|
|
|
TRACE("playpos = %d, writepos = %d, buflen=%d (%p, time=%d)\n",
|
2007-07-08 16:36:46 +02:00
|
|
|
playpos?*playpos:-1, writepos?*writepos:-1, This->buflen, This, GetTickCount());
|
2007-06-13 17:05:49 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus(IDirectSoundBuffer8 *iface, DWORD *status)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2018-09-13 05:29:42 +02:00
|
|
|
TRACE("(%p,%p)\n",This,status);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (status == NULL) {
|
|
|
|
WARN("invalid parameter: status = NULL\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
*status = 0;
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockShared(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
if ((This->state == STATE_STARTING) || (This->state == STATE_PLAYING)) {
|
|
|
|
*status |= DSBSTATUS_PLAYING;
|
|
|
|
if (This->playflags & DSBPLAY_LOOPING)
|
|
|
|
*status |= DSBSTATUS_LOOPING;
|
|
|
|
}
|
2021-01-15 08:22:18 +01:00
|
|
|
if (This->dsbd.dwFlags & DSBCAPS_LOCDEFER)
|
|
|
|
*status |= DSBSTATUS_LOCSOFTWARE;
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockShared(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("status=%x\n", *status);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat(IDirectSoundBuffer8 *iface,
|
|
|
|
LPWAVEFORMATEX lpwf, DWORD wfsize, DWORD *wfwritten)
|
2004-08-18 02:30:37 +02:00
|
|
|
{
|
2011-08-24 02:30:37 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2004-08-18 02:30:37 +02:00
|
|
|
DWORD size;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%p,%d,%p)\n",This,lpwf,wfsize,wfwritten);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
size = sizeof(WAVEFORMATEX) + This->pwfx->cbSize;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
if (lpwf) { /* NULL is valid */
|
|
|
|
if (wfsize >= size) {
|
2005-01-24 13:40:45 +01:00
|
|
|
CopyMemory(lpwf,This->pwfx,size);
|
2004-08-18 02:30:37 +02:00
|
|
|
if (wfwritten)
|
|
|
|
*wfwritten = size;
|
|
|
|
} else {
|
2005-05-06 17:44:31 +02:00
|
|
|
WARN("invalid parameter: wfsize too small\n");
|
2007-11-05 23:23:11 +01:00
|
|
|
CopyMemory(lpwf,This->pwfx,wfsize);
|
2004-08-18 02:30:37 +02:00
|
|
|
if (wfwritten)
|
2007-11-05 23:23:11 +01:00
|
|
|
*wfwritten = wfsize;
|
2004-08-18 02:30:37 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (wfwritten)
|
|
|
|
*wfwritten = sizeof(WAVEFORMATEX) + This->pwfx->cbSize;
|
|
|
|
else {
|
|
|
|
WARN("invalid parameter: wfwritten == NULL\n");
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DS_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Lock(IDirectSoundBuffer8 *iface, DWORD writecursor,
|
|
|
|
DWORD writebytes, void **lplpaudioptr1, DWORD *audiobytes1, void **lplpaudioptr2,
|
|
|
|
DWORD *audiobytes2, DWORD flags)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2003-05-22 05:39:13 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%d,%d,%p,%p,%p,%p,0x%08x) at %d\n", This, writecursor, writebytes, lplpaudioptr1,
|
|
|
|
audiobytes1, lplpaudioptr2, audiobytes2, flags, GetTickCount());
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2009-01-02 07:39:10 +01:00
|
|
|
if (!audiobytes1)
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
|
2006-04-29 05:40:09 +02:00
|
|
|
/* when this flag is set, writecursor is meaningless and must be calculated */
|
2002-06-13 21:15:06 +02:00
|
|
|
if (flags & DSBLOCK_FROMWRITECURSOR) {
|
|
|
|
/* GetCurrentPosition does too much magic to duplicate here */
|
2006-04-29 05:40:09 +02:00
|
|
|
hres = IDirectSoundBufferImpl_GetCurrentPosition(iface, NULL, &writecursor);
|
2003-05-22 05:39:13 +02:00
|
|
|
if (hres != DS_OK) {
|
|
|
|
WARN("IDirectSoundBufferImpl_GetCurrentPosition failed\n");
|
|
|
|
return hres;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2006-04-29 05:40:09 +02:00
|
|
|
|
|
|
|
/* when this flag is set, writebytes is meaningless and must be set */
|
2002-06-13 21:15:06 +02:00
|
|
|
if (flags & DSBLOCK_ENTIREBUFFER)
|
|
|
|
writebytes = This->buflen;
|
2006-04-29 05:40:09 +02:00
|
|
|
|
|
|
|
if (writecursor >= This->buflen) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("Invalid parameter, writecursor: %u >= buflen: %u\n",
|
2006-04-29 05:40:09 +02:00
|
|
|
writecursor, This->buflen);
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (writebytes > This->buflen) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("Invalid parameter, writebytes: %u > buflen: %u\n",
|
2006-04-29 05:40:09 +02:00
|
|
|
writebytes, This->buflen);
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockShared(&This->lock);
|
2003-03-15 01:54:11 +01:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
if (writecursor+writebytes <= This->buflen) {
|
|
|
|
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
|
|
|
|
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
|
|
|
|
WARN("Overwriting mixing position, case 1\n");
|
|
|
|
*audiobytes1 = writebytes;
|
|
|
|
if (lplpaudioptr2)
|
|
|
|
*(LPBYTE*)lplpaudioptr2 = NULL;
|
|
|
|
if (audiobytes2)
|
|
|
|
*audiobytes2 = 0;
|
|
|
|
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n",
|
|
|
|
*(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
|
|
|
|
TRACE("->%d.0\n",writebytes);
|
2015-03-03 08:47:27 +01:00
|
|
|
This->buffer->lockedbytes += writebytes;
|
2003-05-22 05:39:13 +02:00
|
|
|
} else {
|
2011-09-24 16:02:52 +02:00
|
|
|
DWORD remainder = writebytes + writecursor - This->buflen;
|
|
|
|
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
|
|
|
|
*audiobytes1 = This->buflen-writecursor;
|
2015-03-03 08:47:27 +01:00
|
|
|
This->buffer->lockedbytes += *audiobytes1;
|
2011-09-24 16:02:52 +02:00
|
|
|
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
|
|
|
|
WARN("Overwriting mixing position, case 2\n");
|
|
|
|
if (lplpaudioptr2)
|
|
|
|
*(LPBYTE*)lplpaudioptr2 = This->buffer->memory;
|
2015-03-03 08:47:27 +01:00
|
|
|
if (audiobytes2) {
|
2011-09-24 16:02:52 +02:00
|
|
|
*audiobytes2 = writebytes-(This->buflen-writecursor);
|
2015-03-03 08:47:27 +01:00
|
|
|
This->buffer->lockedbytes += *audiobytes2;
|
|
|
|
}
|
2011-09-24 16:02:52 +02:00
|
|
|
if (audiobytes2 && This->sec_mixpos < remainder && This->state == STATE_PLAYING)
|
|
|
|
WARN("Overwriting mixing position, case 3\n");
|
|
|
|
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n", *(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2003-03-15 01:54:11 +01:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockShared(&This->lock);
|
2006-04-29 05:40:09 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuffer8 *iface,
|
|
|
|
DWORD newpos)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2003-05-22 05:39:13 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2011-08-24 02:30:37 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%d)\n",This,newpos);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2007-06-13 17:05:49 +02:00
|
|
|
/* start mixing from this new location instead */
|
2004-08-18 02:30:37 +02:00
|
|
|
newpos %= This->buflen;
|
2007-05-24 20:42:14 +02:00
|
|
|
newpos -= newpos%This->pwfx->nBlockAlign;
|
2007-07-29 23:47:01 +02:00
|
|
|
This->sec_mixpos = newpos;
|
2007-06-13 17:05:49 +02:00
|
|
|
|
|
|
|
/* at this point, do not attempt to reset buffers, mess with primary mix position,
|
2011-07-27 13:38:43 +02:00
|
|
|
or anything like that to reduce latency. The data already prebuffered cannot be changed */
|
2007-06-13 17:05:49 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetPan(IDirectSoundBuffer8 *iface, LONG pan)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2003-05-22 05:39:13 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%d)\n",This,pan);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if ((pan > DSBPAN_RIGHT) || (pan < DSBPAN_LEFT)) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("invalid parameter: pan = %d\n", pan);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2015-12-01 14:49:04 +01:00
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
|
2003-05-22 05:39:13 +02:00
|
|
|
WARN("control unavailable\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_CONTROLUNAVAIL;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-07-24 00:58:59 +02:00
|
|
|
if (This->volpan.lPan != pan) {
|
|
|
|
This->volpan.lPan = pan;
|
2002-06-13 21:15:06 +02:00
|
|
|
DSOUND_RecalcVolPan(&(This->volpan));
|
|
|
|
}
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockExclusive(&This->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetPan(IDirectSoundBuffer8 *iface, LONG *pan)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p,%p)\n",This,pan);
|
|
|
|
|
2003-09-15 22:08:05 +02:00
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
|
|
|
|
WARN("control unavailable\n");
|
|
|
|
return DSERR_CONTROLUNAVAIL;
|
|
|
|
}
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (pan == NULL) {
|
|
|
|
WARN("invalid parameter: pan = NULL\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
*pan = This->volpan.lPan;
|
|
|
|
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(IDirectSoundBuffer8 *iface, void *p1, DWORD x1,
|
|
|
|
void *p2, DWORD x2)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface), *iter;
|
2004-09-10 21:34:01 +02:00
|
|
|
HRESULT hres = DS_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%p,%d,%p,%d)\n", This,p1,x1,p2,x2);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2007-07-29 23:47:01 +02:00
|
|
|
if (!p2)
|
|
|
|
x2 = 0;
|
|
|
|
|
2012-12-15 15:43:30 +01:00
|
|
|
if((p1 && ((BYTE*)p1 < This->buffer->memory || (BYTE*)p1 >= This->buffer->memory + This->buflen)) ||
|
|
|
|
(p2 && ((BYTE*)p2 < This->buffer->memory || (BYTE*)p2 >= This->buffer->memory + This->buflen)))
|
|
|
|
return DSERR_INVALIDPARAM;
|
2011-09-24 16:03:06 +02:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
if (x1 || x2)
|
2007-07-29 23:47:01 +02:00
|
|
|
{
|
2020-02-03 16:02:17 +01:00
|
|
|
AcquireSRWLockShared(&This->device->buffer_list_lock);
|
2007-07-29 23:47:01 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(iter, &This->buffer->buffers, IDirectSoundBufferImpl, entry )
|
|
|
|
{
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockShared(&iter->lock);
|
2007-07-29 23:47:01 +02:00
|
|
|
if (x1)
|
2008-09-02 23:08:21 +02:00
|
|
|
{
|
|
|
|
if(x1 + (DWORD_PTR)p1 - (DWORD_PTR)iter->buffer->memory > iter->buflen)
|
|
|
|
hres = DSERR_INVALIDPARAM;
|
2015-03-03 08:47:27 +01:00
|
|
|
else
|
|
|
|
iter->buffer->lockedbytes -= x1;
|
2008-09-02 23:08:21 +02:00
|
|
|
}
|
2015-03-03 08:47:27 +01:00
|
|
|
|
|
|
|
if (x2)
|
|
|
|
{
|
|
|
|
if(x2 + (DWORD_PTR)p2 - (DWORD_PTR)iter->buffer->memory > iter->buflen)
|
|
|
|
hres = DSERR_INVALIDPARAM;
|
|
|
|
else
|
|
|
|
iter->buffer->lockedbytes -= x2;
|
|
|
|
}
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockShared(&iter->lock);
|
2007-07-29 23:47:01 +02:00
|
|
|
}
|
2020-02-03 16:02:17 +01:00
|
|
|
ReleaseSRWLockShared(&This->device->buffer_list_lock);
|
2007-07-29 23:47:01 +02:00
|
|
|
}
|
|
|
|
|
2004-09-10 21:34:01 +02:00
|
|
|
return hres;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Restore(IDirectSoundBuffer8 *iface)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
FIXME("(%p):stub\n",This);
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency(IDirectSoundBuffer8 *iface, DWORD *freq)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p,%p)\n",This,freq);
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (freq == NULL) {
|
|
|
|
WARN("invalid parameter: freq = NULL\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
*freq = This->freq;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("-> %d\n", *freq);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2019-09-05 05:33:49 +02:00
|
|
|
static const char* dump_DSFX_guid(const DSEFFECTDESC *desc)
|
|
|
|
{
|
|
|
|
#define FE(guid) if (IsEqualGUID(&guid, &desc->guidDSFXClass)) return #guid
|
|
|
|
FE(GUID_DSFX_STANDARD_GARGLE);
|
|
|
|
FE(GUID_DSFX_STANDARD_CHORUS);
|
|
|
|
FE(GUID_DSFX_STANDARD_FLANGER);
|
|
|
|
FE(GUID_DSFX_STANDARD_ECHO);
|
|
|
|
FE(GUID_DSFX_STANDARD_DISTORTION);
|
|
|
|
FE(GUID_DSFX_STANDARD_COMPRESSOR);
|
|
|
|
FE(GUID_DSFX_STANDARD_PARAMEQ);
|
|
|
|
FE(GUID_DSFX_STANDARD_I3DL2REVERB);
|
|
|
|
FE(GUID_DSFX_WAVES_REVERB);
|
|
|
|
#undef FE
|
|
|
|
|
|
|
|
return debugstr_guid(&desc->guidDSFXClass);
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetFX(IDirectSoundBuffer8 *iface, DWORD dwEffectsCount,
|
|
|
|
LPDSEFFECTDESC pDSFXDesc, DWORD *pdwResultCodes)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2002-06-13 21:15:06 +02:00
|
|
|
DWORD u;
|
2015-03-03 08:47:36 +01:00
|
|
|
DSFilter *filters;
|
|
|
|
HRESULT hr, hr2;
|
|
|
|
DMO_MEDIA_TYPE dmt;
|
|
|
|
WAVEFORMATEX wfx;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2015-03-03 08:47:36 +01:00
|
|
|
TRACE("(%p,%u,%p,%p)\n", This, dwEffectsCount, pDSFXDesc, pdwResultCodes);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (pdwResultCodes)
|
|
|
|
for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN;
|
|
|
|
|
2015-03-03 08:47:36 +01:00
|
|
|
if ((dwEffectsCount > 0 && !pDSFXDesc) ||
|
|
|
|
(dwEffectsCount == 0 && (pDSFXDesc || pdwResultCodes))
|
|
|
|
)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFX)) {
|
|
|
|
WARN("attempted to call SetFX on buffer without DSBCAPS_CTRLFX\n");
|
|
|
|
return DSERR_CONTROLUNAVAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (This->state != STATE_STOPPED)
|
|
|
|
return DSERR_INVALIDCALL;
|
|
|
|
|
|
|
|
if (This->buffer->lockedbytes > 0)
|
|
|
|
return DSERR_INVALIDCALL;
|
|
|
|
|
|
|
|
if (dwEffectsCount == 0) {
|
|
|
|
if (This->num_filters > 0) {
|
|
|
|
for (u = 0; u < This->num_filters; u++) {
|
|
|
|
IMediaObject_Release(This->filters[u].obj);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->filters);
|
|
|
|
|
|
|
|
This->filters = NULL;
|
|
|
|
This->num_filters = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
filters = HeapAlloc(GetProcessHeap(), 0, dwEffectsCount * sizeof(DSFilter));
|
|
|
|
if (!filters) {
|
|
|
|
WARN("out of memory\n");
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = DS_OK;
|
|
|
|
|
|
|
|
wfx.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
|
|
|
|
wfx.nChannels = This->pwfx->nChannels;
|
|
|
|
wfx.nSamplesPerSec = This->pwfx->nSamplesPerSec;
|
|
|
|
wfx.wBitsPerSample = sizeof(float) * 8;
|
|
|
|
wfx.nBlockAlign = (wfx.nChannels * wfx.wBitsPerSample)/8;
|
|
|
|
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
|
|
|
|
wfx.cbSize = sizeof(wfx);
|
|
|
|
|
|
|
|
dmt.majortype = KSDATAFORMAT_TYPE_AUDIO;
|
|
|
|
dmt.subtype = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
|
|
|
|
dmt.bFixedSizeSamples = TRUE;
|
|
|
|
dmt.bTemporalCompression = FALSE;
|
|
|
|
dmt.lSampleSize = sizeof(float) * This->pwfx->nChannels / 8;
|
|
|
|
dmt.formattype = FORMAT_WaveFormatEx;
|
|
|
|
dmt.pUnk = NULL;
|
|
|
|
dmt.cbFormat = sizeof(WAVEFORMATEX);
|
|
|
|
dmt.pbFormat = (BYTE*)&wfx;
|
|
|
|
|
|
|
|
for (u = 0; u < dwEffectsCount; u++) {
|
2019-09-05 05:33:49 +02:00
|
|
|
TRACE("%d: 0x%08x, %s\n", u, pDSFXDesc[u].dwFlags, dump_DSFX_guid(&pDSFXDesc[u]));
|
|
|
|
|
2015-03-03 08:47:36 +01:00
|
|
|
hr2 = CoCreateInstance(&pDSFXDesc[u].guidDSFXClass, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaObject, (LPVOID*)&filters[u].obj);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr2)) {
|
|
|
|
hr2 = IMediaObject_SetInputType(filters[u].obj, 0, &dmt, 0);
|
|
|
|
if (FAILED(hr2))
|
|
|
|
WARN("Could not set DMO input type\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr2)) {
|
|
|
|
hr2 = IMediaObject_SetOutputType(filters[u].obj, 0, &dmt, 0);
|
|
|
|
if (FAILED(hr2))
|
|
|
|
WARN("Could not set DMO output type\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr2)) {
|
|
|
|
if (hr == DS_OK)
|
|
|
|
hr = hr2;
|
|
|
|
|
|
|
|
if (pdwResultCodes)
|
|
|
|
pdwResultCodes[u] = (hr2 == REGDB_E_CLASSNOTREG) ? DSFXR_UNKNOWN : DSFXR_FAILED;
|
|
|
|
} else {
|
|
|
|
if (pdwResultCodes)
|
|
|
|
pdwResultCodes[u] = DSFXR_LOCSOFTWARE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
for (u = 0; u < dwEffectsCount; u++) {
|
|
|
|
if (pdwResultCodes)
|
|
|
|
pdwResultCodes[u] = (pdwResultCodes[u] != DSFXR_UNKNOWN) ? DSFXR_PRESENT : DSFXR_UNKNOWN;
|
|
|
|
|
|
|
|
if (filters[u].obj)
|
|
|
|
IMediaObject_Release(filters[u].obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, filters);
|
|
|
|
} else {
|
|
|
|
if (This->num_filters > 0) {
|
|
|
|
for (u = 0; u < This->num_filters; u++) {
|
|
|
|
IMediaObject_Release(This->filters[u].obj);
|
|
|
|
if (This->filters[u].inplace) IMediaObjectInPlace_Release(This->filters[u].inplace);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->filters);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (u = 0; u < dwEffectsCount; u++) {
|
|
|
|
memcpy(&filters[u].guid, &pDSFXDesc[u].guidDSFXClass, sizeof(GUID));
|
|
|
|
if (FAILED(IMediaObject_QueryInterface(filters[u].obj, &IID_IMediaObjectInPlace, (void*)&filters[u].inplace)))
|
|
|
|
filters[u].inplace = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->filters = filters;
|
|
|
|
This->num_filters = dwEffectsCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources(IDirectSoundBuffer8 *iface,
|
|
|
|
DWORD dwFlags, DWORD dwEffectsCount, DWORD *pdwResultCodes)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2002-06-13 21:15:06 +02:00
|
|
|
DWORD u;
|
|
|
|
|
2011-05-10 00:59:02 +02:00
|
|
|
FIXME("(%p,%08u,%u,%p): stub, faking success\n",This,dwFlags,dwEffectsCount,pdwResultCodes);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if (pdwResultCodes)
|
|
|
|
for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN;
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
WARN("control unavailable\n");
|
2011-05-10 00:59:02 +02:00
|
|
|
return DS_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath(IDirectSoundBuffer8 *iface,
|
2020-07-29 03:29:42 +02:00
|
|
|
REFGUID clsid, DWORD index, REFGUID iid, void **out)
|
2011-08-24 02:30:37 +02:00
|
|
|
{
|
2020-07-29 03:29:42 +02:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
DWORD i, count = 0;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-07-29 03:29:42 +02:00
|
|
|
TRACE("(%p,%s,%u,%s,%p)\n", This, debugstr_guid(clsid), index, debugstr_guid(iid), out);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2020-07-29 03:29:42 +02:00
|
|
|
if (!out)
|
|
|
|
return E_INVALIDARG;
|
2015-03-03 08:47:52 +01:00
|
|
|
|
2020-07-29 03:29:42 +02:00
|
|
|
for (i = 0; i < This->num_filters; i++)
|
|
|
|
{
|
|
|
|
if (IsEqualGUID(clsid, &This->filters[i].guid) || IsEqualGUID(clsid, &GUID_All_Objects))
|
|
|
|
{
|
|
|
|
if (count++ == index)
|
|
|
|
return IMediaObject_QueryInterface(This->filters[i].obj, iid, out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DSERR_OBJECTNOTFOUND;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_Initialize(IDirectSoundBuffer8 *iface,
|
|
|
|
IDirectSound *dsound, LPCDSBUFFERDESC dbsd)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2007-07-29 21:29:33 +02:00
|
|
|
WARN("(%p) already initialized\n", This);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_ALREADYINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps(IDirectSoundBuffer8 *iface, LPDSBCAPS caps)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
TRACE("(%p)->(%p)\n",This,caps);
|
|
|
|
|
2003-05-22 05:39:13 +02:00
|
|
|
if (caps == NULL) {
|
|
|
|
WARN("invalid parameter: caps == NULL\n");
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
2003-05-22 05:39:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (caps->dwSize < sizeof(*caps)) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("invalid parameter: caps->dwSize = %d\n",caps->dwSize);
|
2003-05-22 05:39:13 +02:00
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
caps->dwFlags = This->dsbd.dwFlags;
|
2011-09-24 16:02:52 +02:00
|
|
|
caps->dwFlags |= DSBCAPS_LOCSOFTWARE;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
caps->dwBufferBytes = This->buflen;
|
|
|
|
|
2007-05-30 18:32:35 +02:00
|
|
|
/* According to windows, this is zero*/
|
|
|
|
caps->dwUnlockTransferRate = 0;
|
2002-06-13 21:15:06 +02:00
|
|
|
caps->dwPlayCpuOverhead = 0;
|
|
|
|
|
|
|
|
return DS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:30:37 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8 *iface, REFIID riid,
|
|
|
|
void **ppobj)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
|
2003-08-07 00:57:24 +02:00
|
|
|
if (ppobj == NULL) {
|
|
|
|
WARN("invalid parameter\n");
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2003-06-28 00:22:15 +02:00
|
|
|
*ppobj = NULL; /* assume failure */
|
|
|
|
|
2004-07-14 01:35:09 +02:00
|
|
|
if ( IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IDirectSoundBuffer) ||
|
2003-06-28 00:22:15 +02:00
|
|
|
IsEqualGUID(riid, &IID_IDirectSoundBuffer8) ) {
|
2011-08-24 02:32:13 +02:00
|
|
|
IDirectSoundBuffer8_AddRef(iface);
|
|
|
|
*ppobj = iface;
|
|
|
|
return S_OK;
|
2003-06-28 00:22:15 +02:00
|
|
|
}
|
|
|
|
|
2019-02-13 02:56:16 +01:00
|
|
|
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
|
|
|
|
if(This->dsbd.dwFlags & DSBCAPS_CTRLPOSITIONNOTIFY) {
|
2012-01-20 00:28:16 +01:00
|
|
|
IDirectSoundNotify_AddRef(&This->IDirectSoundNotify_iface);
|
|
|
|
*ppobj = &This->IDirectSoundNotify_iface;
|
|
|
|
return S_OK;
|
2019-02-13 02:56:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE( "App requested IDirectSoundNotify without DSBCAPS_CTRLPOSITIONNOTIFY flag.\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
|
2012-06-14 16:25:48 +02:00
|
|
|
if(This->dsbd.dwFlags & DSBCAPS_CTRL3D){
|
2012-01-19 01:18:30 +01:00
|
|
|
IDirectSound3DBuffer_AddRef(&This->IDirectSound3DBuffer_iface);
|
|
|
|
*ppobj = &This->IDirectSound3DBuffer_iface;
|
|
|
|
return S_OK;
|
2012-06-14 16:25:48 +02:00
|
|
|
}
|
|
|
|
TRACE("app requested IDirectSound3DBuffer on non-3D secondary buffer\n");
|
|
|
|
return E_NOINTERFACE;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-02-15 01:01:17 +01:00
|
|
|
if ( IsEqualGUID( &IID_IDirectSound3DListener, riid ) ) {
|
2002-06-13 21:15:06 +02:00
|
|
|
ERR("app requested IDirectSound3DListener on secondary buffer\n");
|
2003-06-28 00:22:15 +02:00
|
|
|
return E_NOINTERFACE;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
|
2012-01-17 01:53:10 +01:00
|
|
|
IKsPropertySet_AddRef(&This->IKsPropertySet_iface);
|
|
|
|
*ppobj = &This->IKsPropertySet_iface;
|
|
|
|
return S_OK;
|
2003-03-04 03:12:34 +01:00
|
|
|
}
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
FIXME( "Unknown IID %s\n", debugstr_guid( riid ) );
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectSoundBuffer8Vtbl dsbvt =
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl_QueryInterface,
|
|
|
|
IDirectSoundBufferImpl_AddRef,
|
|
|
|
IDirectSoundBufferImpl_Release,
|
|
|
|
IDirectSoundBufferImpl_GetCaps,
|
|
|
|
IDirectSoundBufferImpl_GetCurrentPosition,
|
|
|
|
IDirectSoundBufferImpl_GetFormat,
|
|
|
|
IDirectSoundBufferImpl_GetVolume,
|
|
|
|
IDirectSoundBufferImpl_GetPan,
|
2003-02-15 01:01:17 +01:00
|
|
|
IDirectSoundBufferImpl_GetFrequency,
|
2002-06-13 21:15:06 +02:00
|
|
|
IDirectSoundBufferImpl_GetStatus,
|
|
|
|
IDirectSoundBufferImpl_Initialize,
|
|
|
|
IDirectSoundBufferImpl_Lock,
|
|
|
|
IDirectSoundBufferImpl_Play,
|
|
|
|
IDirectSoundBufferImpl_SetCurrentPosition,
|
|
|
|
IDirectSoundBufferImpl_SetFormat,
|
|
|
|
IDirectSoundBufferImpl_SetVolume,
|
|
|
|
IDirectSoundBufferImpl_SetPan,
|
|
|
|
IDirectSoundBufferImpl_SetFrequency,
|
|
|
|
IDirectSoundBufferImpl_Stop,
|
|
|
|
IDirectSoundBufferImpl_Unlock,
|
|
|
|
IDirectSoundBufferImpl_Restore,
|
|
|
|
IDirectSoundBufferImpl_SetFX,
|
|
|
|
IDirectSoundBufferImpl_AcquireResources,
|
|
|
|
IDirectSoundBufferImpl_GetObjectInPath
|
|
|
|
};
|
|
|
|
|
2015-12-22 10:50:34 +01:00
|
|
|
HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd,
|
|
|
|
IDirectSoundBuffer **buffer)
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *dsb;
|
|
|
|
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
|
|
|
|
HRESULT err = DS_OK;
|
|
|
|
DWORD capf = 0;
|
2020-03-06 13:52:46 +01:00
|
|
|
size_t bufsize;
|
2015-12-22 10:49:10 +01:00
|
|
|
|
2015-12-22 10:50:34 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", device, dsbd, buffer);
|
2015-12-22 10:49:10 +01:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
|
2006-11-12 14:40:35 +01:00
|
|
|
WARN("invalid parameter: dsbd->dwBufferBytes = %d\n", dsbd->dwBufferBytes);
|
2002-06-13 21:15:06 +02:00
|
|
|
return DSERR_INVALIDPARAM; /* FIXME: which error? */
|
|
|
|
}
|
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
dsb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*dsb));
|
2003-05-22 05:39:13 +02:00
|
|
|
|
2015-12-22 10:49:10 +01:00
|
|
|
if (!dsb)
|
2003-05-22 05:39:13 +02:00
|
|
|
return DSERR_OUTOFMEMORY;
|
2004-08-18 02:30:37 +02:00
|
|
|
|
|
|
|
TRACE("Created buffer at %p\n", dsb);
|
|
|
|
|
2015-12-22 10:49:10 +01:00
|
|
|
dsb->ref = 1;
|
2012-01-20 00:28:16 +01:00
|
|
|
dsb->refn = 0;
|
2012-01-19 01:18:30 +01:00
|
|
|
dsb->ref3D = 0;
|
2012-01-17 01:53:10 +01:00
|
|
|
dsb->refiks = 0;
|
2015-12-22 10:49:10 +01:00
|
|
|
dsb->numIfaces = 1;
|
2006-01-06 12:35:20 +01:00
|
|
|
dsb->device = device;
|
2011-09-24 16:02:52 +02:00
|
|
|
dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
|
2012-01-20 00:28:16 +01:00
|
|
|
dsb->IDirectSoundNotify_iface.lpVtbl = &dsnvt;
|
2012-01-19 01:18:30 +01:00
|
|
|
dsb->IDirectSound3DBuffer_iface.lpVtbl = &ds3dbvt;
|
2012-01-17 01:53:10 +01:00
|
|
|
dsb->IKsPropertySet_iface.lpVtbl = &iksbvt;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
/* size depends on version */
|
2005-01-24 13:40:45 +01:00
|
|
|
CopyMemory(&dsb->dsbd, dsbd, dsbd->dwSize);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2009-10-04 08:05:20 +02:00
|
|
|
dsb->pwfx = DSOUND_CopyFormat(wfex);
|
2015-12-22 10:49:10 +01:00
|
|
|
if (!dsb->pwfx) {
|
|
|
|
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
2004-08-18 02:30:37 +02:00
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2005-02-16 17:09:02 +01:00
|
|
|
if (dsbd->dwBufferBytes % dsbd->lpwfxFormat->nBlockAlign)
|
|
|
|
dsb->buflen = dsbd->dwBufferBytes +
|
|
|
|
(dsbd->lpwfxFormat->nBlockAlign -
|
|
|
|
(dsbd->dwBufferBytes % dsbd->lpwfxFormat->nBlockAlign));
|
|
|
|
else
|
|
|
|
dsb->buflen = dsbd->dwBufferBytes;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2005-02-16 17:09:02 +01:00
|
|
|
dsb->freq = dsbd->lpwfxFormat->nSamplesPerSec;
|
2003-09-02 01:58:43 +02:00
|
|
|
dsb->notifies = NULL;
|
|
|
|
dsb->nrofnotifies = 0;
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* Check necessary hardware mixing capabilities */
|
|
|
|
if (wfex->nChannels==2) capf |= DSCAPS_SECONDARYSTEREO;
|
|
|
|
else capf |= DSCAPS_SECONDARYMONO;
|
|
|
|
if (wfex->wBitsPerSample==16) capf |= DSCAPS_SECONDARY16BIT;
|
|
|
|
else capf |= DSCAPS_SECONDARY8BIT;
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
TRACE("capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", capf, device->drvcaps.dwFlags);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2005-02-10 18:09:20 +01:00
|
|
|
/* Allocate an empty buffer */
|
2020-03-06 13:52:46 +01:00
|
|
|
bufsize = (sizeof(*(dsb->buffer)) + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
|
|
|
dsb->buffer = HeapAlloc(GetProcessHeap(),0,bufsize + dsb->buflen);
|
2015-12-22 10:49:10 +01:00
|
|
|
if (!dsb->buffer) {
|
|
|
|
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
2005-02-10 18:09:20 +01:00
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
2003-06-28 00:22:15 +02:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
/* Allocate system memory for buffer */
|
2020-03-06 13:52:46 +01:00
|
|
|
dsb->buffer->memory = (BYTE *)dsb->buffer + bufsize;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2007-08-26 17:34:45 +02:00
|
|
|
dsb->buffer->ref = 1;
|
2015-03-03 08:47:27 +01:00
|
|
|
dsb->buffer->lockedbytes = 0;
|
2007-08-26 17:34:45 +02:00
|
|
|
list_init(&dsb->buffer->buffers);
|
|
|
|
list_add_head(&dsb->buffer->buffers, &dsb->entry);
|
|
|
|
FillMemory(dsb->buffer->memory, dsb->buflen, dsbd->lpwfxFormat->wBitsPerSample == 8 ? 128 : 0);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* It's not necessary to initialize values to zero since */
|
|
|
|
/* we allocated this structure with HEAP_ZERO_MEMORY... */
|
2012-05-01 22:01:32 +02:00
|
|
|
dsb->sec_mixpos = 0;
|
2002-06-13 21:15:06 +02:00
|
|
|
dsb->state = STATE_STOPPED;
|
|
|
|
|
2014-12-27 23:41:07 +01:00
|
|
|
dsb->freqAdjustNum = dsb->freq;
|
|
|
|
dsb->freqAdjustDen = device->pwfx->nSamplesPerSec;
|
2002-06-13 21:15:06 +02:00
|
|
|
dsb->nAvgBytesPerSec = dsb->freq *
|
|
|
|
dsbd->lpwfxFormat->nBlockAlign;
|
|
|
|
|
2007-07-29 23:47:01 +02:00
|
|
|
/* calculate fragment size and write lead */
|
|
|
|
DSOUND_RecalcFormat(dsb);
|
|
|
|
|
2003-06-28 00:22:15 +02:00
|
|
|
if (dsb->dsbd.dwFlags & DSBCAPS_CTRL3D) {
|
|
|
|
dsb->ds3db_ds3db.dwSize = sizeof(DS3DBUFFER);
|
2003-09-06 01:08:26 +02:00
|
|
|
dsb->ds3db_ds3db.vPosition.x = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vPosition.y = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vPosition.z = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vVelocity.x = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vVelocity.y = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vVelocity.z = 0.0;
|
2003-06-28 00:22:15 +02:00
|
|
|
dsb->ds3db_ds3db.dwInsideConeAngle = DS3D_DEFAULTCONEANGLE;
|
|
|
|
dsb->ds3db_ds3db.dwOutsideConeAngle = DS3D_DEFAULTCONEANGLE;
|
2003-09-06 01:08:26 +02:00
|
|
|
dsb->ds3db_ds3db.vConeOrientation.x = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vConeOrientation.y = 0.0;
|
|
|
|
dsb->ds3db_ds3db.vConeOrientation.z = 0.0;
|
2003-06-28 00:22:15 +02:00
|
|
|
dsb->ds3db_ds3db.lConeOutsideVolume = DS3D_DEFAULTCONEOUTSIDEVOLUME;
|
|
|
|
dsb->ds3db_ds3db.flMinDistance = DS3D_DEFAULTMINDISTANCE;
|
|
|
|
dsb->ds3db_ds3db.flMaxDistance = DS3D_DEFAULTMAXDISTANCE;
|
|
|
|
dsb->ds3db_ds3db.dwMode = DS3DMODE_NORMAL;
|
|
|
|
|
|
|
|
dsb->ds3db_need_recalc = FALSE;
|
|
|
|
DSOUND_Calc3DBuffer(dsb);
|
2003-05-22 05:39:13 +02:00
|
|
|
} else
|
2002-06-13 21:15:06 +02:00
|
|
|
DSOUND_RecalcVolPan(&(dsb->volpan));
|
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
InitializeSRWLock(&dsb->lock);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2015-12-22 10:50:34 +01:00
|
|
|
/* register buffer */
|
|
|
|
err = DirectSoundDevice_AddBuffer(device, dsb);
|
|
|
|
if (err == DS_OK)
|
|
|
|
*buffer = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
|
|
|
|
else
|
|
|
|
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
2004-09-07 21:32:21 +02:00
|
|
|
|
|
|
|
return err;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
2003-09-02 01:58:43 +02:00
|
|
|
|
2011-08-25 23:42:44 +02:00
|
|
|
void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
|
|
|
|
{
|
2012-01-20 00:53:51 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&This->numIfaces);
|
|
|
|
|
|
|
|
if (ref > 1)
|
|
|
|
WARN("Destroying buffer with %u in use interfaces\n", ref - 1);
|
|
|
|
|
2015-01-11 22:42:44 +01:00
|
|
|
if (This->dsbd.dwFlags & DSBCAPS_LOCHARDWARE)
|
|
|
|
This->device->drvcaps.dwFreeHwMixingAllBuffers++;
|
|
|
|
|
2011-08-25 23:42:44 +02:00
|
|
|
DirectSoundDevice_RemoveBuffer(This->device, This);
|
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
This->buffer->ref--;
|
|
|
|
list_remove(&This->entry);
|
2020-03-06 13:52:46 +01:00
|
|
|
if (This->buffer->ref == 0)
|
2011-09-24 16:02:52 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->buffer);
|
2011-08-25 23:42:44 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->notifies);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->pwfx);
|
2015-03-03 08:47:36 +01:00
|
|
|
|
|
|
|
if (This->filters) {
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < This->num_filters; i++) {
|
|
|
|
IMediaObject_Release(This->filters[i].obj);
|
|
|
|
if (This->filters[i].inplace) IMediaObjectInPlace_Release(This->filters[i].inplace);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->filters);
|
|
|
|
}
|
|
|
|
|
2011-08-25 23:42:44 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
TRACE("(%p) released\n", This);
|
|
|
|
}
|
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT IDirectSoundBufferImpl_Duplicate(
|
|
|
|
DirectSoundDevice *device,
|
|
|
|
IDirectSoundBufferImpl **ppdsb,
|
|
|
|
IDirectSoundBufferImpl *pdsb)
|
|
|
|
{
|
|
|
|
IDirectSoundBufferImpl *dsb;
|
|
|
|
HRESULT hres = DS_OK;
|
2011-07-18 08:02:07 +02:00
|
|
|
TRACE("(%p,%p,%p)\n", device, ppdsb, pdsb);
|
2006-01-14 17:06:52 +01:00
|
|
|
|
2009-10-04 09:13:53 +02:00
|
|
|
dsb = HeapAlloc(GetProcessHeap(),0,sizeof(*dsb));
|
2006-01-14 17:06:52 +01:00
|
|
|
if (dsb == NULL) {
|
|
|
|
WARN("out of memory\n");
|
|
|
|
*ppdsb = NULL;
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
2012-01-16 21:02:45 +01:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
AcquireSRWLockShared(&pdsb->lock);
|
2012-01-16 21:02:45 +01:00
|
|
|
|
2009-10-04 09:13:53 +02:00
|
|
|
CopyMemory(dsb, pdsb, sizeof(*dsb));
|
2006-01-14 17:06:52 +01:00
|
|
|
|
2009-10-04 09:13:53 +02:00
|
|
|
dsb->pwfx = DSOUND_CopyFormat(pdsb->pwfx);
|
2012-01-16 21:02:45 +01:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
ReleaseSRWLockShared(&pdsb->lock);
|
2012-01-16 21:02:45 +01:00
|
|
|
|
2009-10-04 09:13:53 +02:00
|
|
|
if (dsb->pwfx == NULL) {
|
|
|
|
HeapFree(GetProcessHeap(),0,dsb);
|
|
|
|
*ppdsb = NULL;
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
2006-01-14 17:06:52 +01:00
|
|
|
|
2007-08-26 17:34:45 +02:00
|
|
|
dsb->buffer->ref++;
|
|
|
|
list_add_head(&dsb->buffer->buffers, &dsb->entry);
|
2012-01-17 01:53:10 +01:00
|
|
|
dsb->ref = 0;
|
2012-01-20 00:28:16 +01:00
|
|
|
dsb->refn = 0;
|
2012-01-19 01:18:30 +01:00
|
|
|
dsb->ref3D = 0;
|
2012-01-17 01:53:10 +01:00
|
|
|
dsb->refiks = 0;
|
|
|
|
dsb->numIfaces = 0;
|
2006-01-14 17:06:52 +01:00
|
|
|
dsb->state = STATE_STOPPED;
|
2012-05-01 22:01:32 +02:00
|
|
|
dsb->sec_mixpos = 0;
|
2011-07-21 14:53:48 +02:00
|
|
|
dsb->notifies = NULL;
|
|
|
|
dsb->nrofnotifies = 0;
|
2006-01-14 17:06:52 +01:00
|
|
|
dsb->device = device;
|
2007-07-29 23:47:01 +02:00
|
|
|
DSOUND_RecalcFormat(dsb);
|
2006-01-14 17:06:52 +01:00
|
|
|
|
2020-02-03 16:02:56 +01:00
|
|
|
InitializeSRWLock(&dsb->lock);
|
2006-01-14 17:06:52 +01:00
|
|
|
|
|
|
|
/* register buffer */
|
|
|
|
hres = DirectSoundDevice_AddBuffer(device, dsb);
|
|
|
|
if (hres != DS_OK) {
|
2009-10-04 09:13:53 +02:00
|
|
|
list_remove(&dsb->entry);
|
|
|
|
dsb->buffer->ref--;
|
2006-01-14 17:06:52 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,dsb->pwfx);
|
|
|
|
HeapFree(GetProcessHeap(),0,dsb);
|
2009-10-04 09:13:53 +02:00
|
|
|
dsb = NULL;
|
2016-02-10 19:54:04 +01:00
|
|
|
}else
|
|
|
|
IDirectSoundBuffer8_AddRef(&dsb->IDirectSoundBuffer8_iface);
|
2006-01-14 17:06:52 +01:00
|
|
|
|
|
|
|
*ppdsb = dsb;
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2009-12-04 14:09:32 +01:00
|
|
|
/*******************************************************************************
|
2012-01-17 01:50:14 +01:00
|
|
|
* IKsPropertySet
|
2009-12-04 14:09:32 +01:00
|
|
|
*/
|
|
|
|
|
2012-01-17 01:53:10 +01:00
|
|
|
static inline IDirectSoundBufferImpl *impl_from_IKsPropertySet(IKsPropertySet *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectSoundBufferImpl, IKsPropertySet_iface);
|
|
|
|
}
|
|
|
|
|
2009-12-04 14:09:32 +01:00
|
|
|
/* IUnknown methods */
|
2012-01-17 01:50:14 +01:00
|
|
|
static HRESULT WINAPI IKsPropertySetImpl_QueryInterface(IKsPropertySet *iface, REFIID riid,
|
|
|
|
void **ppobj)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
|
|
|
|
2009-12-04 14:09:32 +01:00
|
|
|
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
|
2018-03-30 06:04:48 +02:00
|
|
|
return IDirectSoundBuffer8_QueryInterface(&This->IDirectSoundBuffer8_iface, riid, ppobj);
|
2009-12-04 14:09:32 +01:00
|
|
|
}
|
|
|
|
|
2012-01-17 01:50:14 +01:00
|
|
|
static ULONG WINAPI IKsPropertySetImpl_AddRef(IKsPropertySet *iface)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->refiks);
|
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2012-01-17 01:53:10 +01:00
|
|
|
|
|
|
|
if(ref == 1)
|
|
|
|
InterlockedIncrement(&This->numIfaces);
|
|
|
|
|
2009-12-04 14:09:32 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-01-17 01:50:14 +01:00
|
|
|
static ULONG WINAPI IKsPropertySetImpl_Release(IKsPropertySet *iface)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
2012-05-09 15:48:56 +02:00
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
if (is_primary_buffer(This)){
|
|
|
|
ref = capped_refcount_dec(&This->refiks);
|
|
|
|
if(!ref)
|
|
|
|
capped_refcount_dec(&This->numIfaces);
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2012-05-09 15:48:56 +02:00
|
|
|
return ref;
|
|
|
|
}
|
2012-01-17 01:53:10 +01:00
|
|
|
|
2012-05-09 15:48:56 +02:00
|
|
|
ref = InterlockedDecrement(&This->refiks);
|
|
|
|
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
|
|
|
secondarybuffer_destroy(This);
|
|
|
|
|
2019-01-10 23:41:04 +01:00
|
|
|
TRACE("(%p) ref %d\n", This, ref);
|
2009-12-04 14:09:32 +01:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-01-17 01:50:14 +01:00
|
|
|
static HRESULT WINAPI IKsPropertySetImpl_Get(IKsPropertySet *iface, REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID, void *pInstanceData, ULONG cbInstanceData, void *pPropData,
|
|
|
|
ULONG cbPropData, ULONG *pcbReturned)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
2011-09-24 16:02:52 +02:00
|
|
|
|
2009-12-04 14:09:32 +01:00
|
|
|
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
|
|
|
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
|
|
|
|
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2012-01-17 01:50:14 +01:00
|
|
|
static HRESULT WINAPI IKsPropertySetImpl_Set(IKsPropertySet *iface, REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID, void *pInstanceData, ULONG cbInstanceData, void *pPropData,
|
|
|
|
ULONG cbPropData)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
2009-12-04 14:09:32 +01:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
TRACE("(%p,%s,%d,%p,%d,%p,%d)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
|
2009-12-04 14:09:32 +01:00
|
|
|
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2012-01-17 01:50:14 +01:00
|
|
|
static HRESULT WINAPI IKsPropertySetImpl_QuerySupport(IKsPropertySet *iface, REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID, ULONG *pTypeSupport)
|
2009-12-04 14:09:32 +01:00
|
|
|
{
|
2012-01-17 01:53:10 +01:00
|
|
|
IDirectSoundBufferImpl *This = impl_from_IKsPropertySet(iface);
|
2009-12-04 14:09:32 +01:00
|
|
|
|
2011-09-24 16:02:52 +02:00
|
|
|
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
|
2009-12-04 14:09:32 +01:00
|
|
|
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2012-01-17 01:53:10 +01:00
|
|
|
const IKsPropertySetVtbl iksbvt = {
|
2012-01-17 01:50:14 +01:00
|
|
|
IKsPropertySetImpl_QueryInterface,
|
|
|
|
IKsPropertySetImpl_AddRef,
|
|
|
|
IKsPropertySetImpl_Release,
|
|
|
|
IKsPropertySetImpl_Get,
|
|
|
|
IKsPropertySetImpl_Set,
|
|
|
|
IKsPropertySetImpl_QuerySupport
|
2009-12-04 14:09:32 +01:00
|
|
|
};
|