ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2004
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
824 discussions
Start a n
N
ew thread
Integrated change by gvg in revision 12511
by gvg@svn.reactos.com
Wine-20041201 vendor drop Added: vendor/wine/dlls/dsound/ Added: vendor/wine/dlls/dsound/current/ Added: vendor/wine/dlls/dsound/current/Makefile.in Added: vendor/wine/dlls/dsound/current/buffer.c Added: vendor/wine/dlls/dsound/current/capture.c Added: vendor/wine/dlls/dsound/current/dsound.c Added: vendor/wine/dlls/dsound/current/dsound.spec Added: vendor/wine/dlls/dsound/current/dsound_main.c Added: vendor/wine/dlls/dsound/current/dsound_private.h Added: vendor/wine/dlls/dsound/current/mixer.c Added: vendor/wine/dlls/dsound/current/primary.c Added: vendor/wine/dlls/dsound/current/propset.c Added: vendor/wine/dlls/dsound/current/regsvr.c Added: vendor/wine/dlls/dsound/current/sound3d.c Added: vendor/wine/dlls/dsound/current/version.rc _____ Added: vendor/wine/dlls/dsound/current/Makefile.in --- vendor/wine/dlls/dsound/current/Makefile.in 2004-12-31 14:53:28 UTC (rev 12510) +++ vendor/wine/dlls/dsound/current/Makefile.in 2004-12-31 14:53:50 UTC (rev 12511) @@ -0,0 +1,26 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = dsound.dll +IMPORTS = winmm ole32 user32 advapi32 kernel32 ntdll +EXTRALIBS = -ldxguid -luuid + +C_SRCS = \ + buffer.c \ + capture.c \ + dsound.c \ + dsound_main.c \ + mixer.c \ + primary.c \ + propset.c \ + regsvr.c \ + sound3d.c + +RC_SRCS = version.rc + +SUBDIRS = tests + +@MAKE_DLL_RULES@ + +### Dependencies: _____ Added: vendor/wine/dlls/dsound/current/buffer.c --- vendor/wine/dlls/dsound/current/buffer.c 2004-12-31 14:53:28 UTC (rev 12510) +++ vendor/wine/dlls/dsound/current/buffer.c 2004-12-31 14:53:50 UTC (rev 12511) @@ -0,0 +1,1567 @@ +/* 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include <assert.h> +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/fcntl.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#define NONAMELESSSTRUCT +#define NONAMELESSUNION +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "mmsystem.h" +#include "winreg.h" +#include "winternl.h" +#include "mmddk.h" +#include "wine/windef16.h" +#include "wine/debug.h" +#include "dsound.h" +#include "dsdriver.h" +#include "dsound_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dsound); + +/********************************************************************** ********* + * IDirectSoundNotify + */ +static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface( + LPDIRECTSOUNDNOTIFY iface,REFIID riid,LPVOID *ppobj +) { + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + + if (This->dsb == NULL) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + + return IDirectSoundBuffer_QueryInterface((LPDIRECTSOUNDBUFFER)This->dsb, riid, ppobj); +} + +static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) +{ + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + return InterlockedIncrement(&(This->ref)); +} + +static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) { + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + ULONG ref; + + TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + + ref = InterlockedDecrement(&(This->ref)); + if (ref == 0) { + IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER)This->dsb); + This->dsb->notify = NULL; + HeapFree(GetProcessHeap(),0,This); + TRACE("(%p) released\n",This); + } + return ref; +} + +static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions( + LPDIRECTSOUNDNOTIFY iface,DWORD howmuch,LPCDSBPOSITIONNOTIFY notify +) { + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + TRACE("(%p,0x%08lx,%p)\n",This,howmuch,notify); + + if (howmuch > 0 && notify == NULL) { + WARN("invalid parameter: notify == NULL\n"); + return DSERR_INVALIDPARAM; + } + + if (TRACE_ON(dsound)) { + unsigned int i; + for (i=0;i<howmuch;i++) + TRACE("notify at %ld to 0x%08lx\n", + notify[i].dwOffset,(DWORD)notify[i].hEventNotify); + } + + if (This->dsb->hwnotify) { + HRESULT hres; + hres = IDsDriverNotify_SetNotificationPositions(This->dsb->hwnotify, howmuch, notify); + if (hres != DS_OK) + WARN("IDsDriverNotify_SetNotificationPositions failed\n"); + return hres; + } else if (howmuch > 0) { + /* Make an internal copy of the caller-supplied array. + * Replace the existing copy if one is already present. */ + if (This->dsb->notifies) + This->dsb->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->dsb->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY)); + else + This->dsb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + howmuch * sizeof(DSBPOSITIONNOTIFY)); + + if (This->dsb->notifies == NULL) { + WARN("out of memory\n"); + return DSERR_OUTOFMEMORY; + } + memcpy(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY)); + This->dsb->nrofnotifies = howmuch; + } else { + if (This->dsb->notifies) { + HeapFree(GetProcessHeap(), 0, This->dsb->notifies); + This->dsb->notifies = NULL; + } + This->dsb->nrofnotifies = 0; + } + + return S_OK; +} + +IDirectSoundNotifyVtbl dsnvt = +{ + IDirectSoundNotifyImpl_QueryInterface, + IDirectSoundNotifyImpl_AddRef, + IDirectSoundNotifyImpl_Release, + IDirectSoundNotifyImpl_SetNotificationPositions, +}; + +HRESULT WINAPI IDirectSoundNotifyImpl_Create( + IDirectSoundBufferImpl * dsb, + IDirectSoundNotifyImpl **pdsn) +{ + IDirectSoundNotifyImpl * dsn; + TRACE("(%p,%p)\n",dsb,pdsn); + + dsn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(dsn)); + + if (dsn == NULL) { + WARN("out of memory\n"); + return DSERR_OUTOFMEMORY; + } + + dsn->ref = 0; + dsn->lpVtbl = &dsnvt; + dsn->dsb = dsb; + dsb->notify = dsn; + IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)dsb); + + *pdsn = dsn; + return DS_OK; +} + +HRESULT WINAPI IDirectSoundNotifyImpl_Destroy( + IDirectSoundNotifyImpl *pdsn) +{ + TRACE("(%p)\n",pdsn); + + while (IDirectSoundNotifyImpl_Release((LPDIRECTSOUNDNOTIFY)pdsn) > 0); + + return DS_OK; +} + +/********************************************************************** ********* + * IDirectSoundBuffer + */ + +static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat( + LPDIRECTSOUNDBUFFER8 iface,LPCWAVEFORMATEX wfex +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + + TRACE("(%p,%p)\n",This,wfex); + /* This method is not available on secondary buffers */ + WARN("invalid call\n"); + return DSERR_INVALIDCALL; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume( + LPDIRECTSOUNDBUFFER8 iface,LONG vol +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + LONG oldVol; + HRESULT hres = DS_OK; + + TRACE("(%p,%ld)\n",This,vol); + + if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) { + WARN("control unavailable: This->dsbd.dwFlags = 0x%08lx\n", This->dsbd.dwFlags); + return DSERR_CONTROLUNAVAIL; + } + + if ((vol > DSBVOLUME_MAX) || (vol < DSBVOLUME_MIN)) { + WARN("invalid parameter: vol = %ld\n", vol); + return DSERR_INVALIDPARAM; + } + + /* **** */ + EnterCriticalSection(&(This->lock)); + + if (This->dsbd.dwFlags & DSBCAPS_CTRL3D) { + oldVol = This->ds3db_lVolume; + This->ds3db_lVolume = vol; + } else { + oldVol = This->volpan.lVolume; + This->volpan.lVolume = vol; + if (vol != oldVol) + DSOUND_RecalcVolPan(&(This->volpan)); + } + + if (vol != oldVol) { + if (This->hwbuf) { + hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan)); + if (hres != DS_OK) + WARN("IDsDriverBuffer_SetVolumePan failed\n"); + } else + DSOUND_ForceRemix(This); + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return hres; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume( + LPDIRECTSOUNDBUFFER8 iface,LPLONG vol +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p)\n",This,vol); + + if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) { + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; + } + + if (vol == NULL) { + WARN("invalid parameter: vol == NULL\n"); + return DSERR_INVALIDPARAM; + } + + *vol = This->volpan.lVolume; + + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency( + LPDIRECTSOUNDBUFFER8 iface,DWORD freq +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + DWORD oldFreq; + + TRACE("(%p,%ld)\n",This,freq); + + if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) { + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; + } + + if (freq == DSBFREQUENCY_ORIGINAL) + freq = This->pwfx->nSamplesPerSec; + + if ((freq < DSBFREQUENCY_MIN) || (freq > DSBFREQUENCY_MAX)) { + WARN("invalid parameter: freq = %ld\n", freq); + return DSERR_INVALIDPARAM; + } + + /* **** */ + EnterCriticalSection(&(This->lock)); + + oldFreq = This->freq; + This->freq = freq; + if (freq != oldFreq) { + This->freqAdjust = (freq << DSOUND_FREQSHIFT) / This->dsound->pwfx->nSamplesPerSec; + This->nAvgBytesPerSec = freq * This->pwfx->nBlockAlign; + DSOUND_RecalcFormat(This); + if (!This->hwbuf) + DSOUND_ForceRemix(This); + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Play( + LPDIRECTSOUNDBUFFER8 iface,DWORD reserved1,DWORD reserved2,DWORD flags +) { + HRESULT hres = DS_OK; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%08lx,%08lx,%08lx)\n",This,reserved1,reserved2,flags); + + /* **** */ + EnterCriticalSection(&(This->lock)); + + This->playflags = flags; + if (This->state == STATE_STOPPED) { + This->leadin = TRUE; + This->startpos = This->buf_mixpos; + This->state = STATE_STARTING; + } else if (This->state == STATE_STOPPING) + This->state = STATE_PLAYING; + if (This->hwbuf) { + hres = IDsDriverBuffer_Play(This->hwbuf, 0, 0, This->playflags); + if (hres != DS_OK) + WARN("IDsDriverBuffer_Play failed\n"); + else + This->state = STATE_PLAYING; + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return hres; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface) +{ + HRESULT hres = DS_OK; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p)\n",This); + + /* **** */ + EnterCriticalSection(&(This->lock)); + + if (This->state == STATE_PLAYING) + This->state = STATE_STOPPING; + else if (This->state == STATE_STARTING) + This->state = STATE_STOPPED; + if (This->hwbuf) { + hres = IDsDriverBuffer_Stop(This->hwbuf); + if (hres != DS_OK) + WARN("IDsDriverBuffer_Stop failed\n"); + else + This->state = STATE_STOPPED; + } + DSOUND_CheckEvent(This, 0); + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return hres; +} + +static ULONG WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) +{ + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + return InterlockedIncrement(&(This->ref)); +} + +static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) +{ + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + ULONG ref; + + TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + + ref = InterlockedDecrement(&(This->ref)); + if (ref) + return ref; + + DSOUND_RemoveBuffer(This->dsound, This); + + This->lock.DebugInfo->Spare[1] = 0; + DeleteCriticalSection(&(This->lock)); + + if (This->hwbuf) { + IDsDriverBuffer_Release(This->hwbuf); + if (This->dsound->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) { + This->buffer->ref--; + if (This->buffer->ref==0) { + HeapFree(GetProcessHeap(),0,This->buffer->memory); + HeapFree(GetProcessHeap(),0,This->buffer); + } + } + } else { + This->buffer->ref--; + if (This->buffer->ref==0) { + HeapFree(GetProcessHeap(),0,This->buffer->memory); + HeapFree(GetProcessHeap(),0,This->buffer); + } + } + + if (This->notifies != NULL) + HeapFree(GetProcessHeap(), 0, This->notifies); + + if (This->pwfx) + HeapFree(GetProcessHeap(), 0, This->pwfx); + + HeapFree(GetProcessHeap(),0,This); + + TRACE("(%p) released\n",This); + return 0; +} + +DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, + DWORD state, DWORD pplay, DWORD pwrite, DWORD pmix, DWORD bmix) +{ + DWORD bplay; + + TRACE("primary playpos=%ld, mixpos=%ld\n", pplay, pmix); + TRACE("this mixpos=%ld, time=%ld\n", bmix, GetTickCount()); + + /* the actual primary play position (pplay) is always behind last mixed (pmix), + * unless the computer is too slow or something */ + /* we need to know how far away we are from there */ +#if 0 /* we'll never fill the primary entirely */ + if (pmix == pplay) { + if ((state == STATE_PLAYING) || (state == STATE_STOPPING)) { + /* wow, the software mixer is really doing well, + * seems the entire primary buffer is filled! */ + pmix += This->dsound->buflen; + } + /* else: the primary buffer is not playing, so probably empty */ + } +#endif + if (pmix < pplay) pmix += This->dsound->buflen; /* wraparound */ + pmix -= pplay; + /* detect buffer underrun */ + if (pwrite < pplay) pwrite += This->dsound->buflen; /* wraparound */ + pwrite -= pplay; + if (pmix > (ds_snd_queue_max * This->dsound->fraglen + pwrite + This->dsound->writelead)) { + WARN("detected an underrun: primary queue was %ld\n",pmix); + pmix = 0; + } + /* divide the offset by its sample size */ + pmix /= This->dsound->pwfx->nBlockAlign; + TRACE("primary back-samples=%ld\n",pmix); + /* adjust for our frequency */ + pmix = (pmix * This->freqAdjust) >> DSOUND_FREQSHIFT; + /* multiply by our own sample size */ + pmix *= This->pwfx->nBlockAlign; + TRACE("this back-offset=%ld\n", pmix); + /* subtract from our last mixed position */ + bplay = bmix; + while (bplay < pmix) bplay += This->buflen; /* wraparound */ + bplay -= pmix; + if (This->leadin && ((bplay < This->startpos) || (bplay > bmix))) { + /* seems we haven't started playing yet */ + TRACE("this still in lead-in phase\n"); + bplay = This->startpos; + } + /* return the result */ + return bplay; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition( + LPDIRECTSOUNDBUFFER8 iface,LPDWORD playpos,LPDWORD writepos +) { + HRESULT hres; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p,%p)\n",This,playpos,writepos); + if (This->hwbuf) { + hres=IDsDriverBuffer_GetPosition(This->hwbuf,playpos,writepos); + if (hres != DS_OK) { + WARN("IDsDriverBuffer_GetPosition failed\n"); + return hres; + } + } else { + if (playpos && (This->state != STATE_PLAYING)) { + /* we haven't been merged into the primary buffer (yet) */ + *playpos = This->buf_mixpos; + } else if (playpos) { + DWORD pplay, pwrite, lplay, splay, pstate; + /* let's get this exact; first, recursively call GetPosition on the primary */ + EnterCriticalSection(&(This->dsound->mixlock)); + if (DSOUND_PrimaryGetPosition(This->dsound, &pplay, &pwrite) != DS_OK) + WARN("DSOUND_PrimaryGetPosition failed\n"); + /* detect HEL mode underrun */ + pstate = This->dsound->state; + if (!(This->dsound->hwbuf || This->dsound->pwqueue)) { + TRACE("detected an underrun\n"); + /* pplay = ? */ + if (pstate == STATE_PLAYING) + pstate = STATE_STARTING; + else if (pstate == STATE_STOPPING) + pstate = STATE_STOPPED; + } + /* get data for ourselves while we still have the lock */ + pstate &= This->state; + lplay = This->primary_mixpos; + splay = This->buf_mixpos; + if ((This->dsbd.dwFlags & DSBCAPS_GETCURRENTPOSITION2) || This->dsound->hwbuf) { + /* calculate play position using this */ + *playpos = DSOUND_CalcPlayPosition(This, pstate, pplay, pwrite, lplay, splay); + } else { + /* (unless the app isn't using GETCURRENTPOSITION2) */ + /* don't know exactly how this should be handled... + * the docs says that play cursor is reported as directly + * behind write cursor, hmm... */ + /* let's just do what might work for Half-Life */ + DWORD wp; + wp = (This->dsound->pwplay + ds_hel_margin) * This->dsound->fraglen; + wp %= This->dsound->buflen; + *playpos = DSOUND_CalcPlayPosition(This, pstate, wp, pwrite, lplay, splay); + } + LeaveCriticalSection(&(This->dsound->mixlock)); + } + if (writepos) + *writepos = This->buf_mixpos; + } + if (writepos) { + if (This->state != STATE_STOPPED) { + /* apply the documented 10ms lead to writepos */ + *writepos += This->writelead; + } + *writepos %= This->buflen; + } + if (playpos) + This->last_playpos = *playpos; + TRACE("playpos = %ld, writepos = %ld (%p, time=%ld)\n", playpos?*playpos:0, writepos?*writepos:0, This, GetTickCount()); + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus( + LPDIRECTSOUNDBUFFER8 iface,LPDWORD status +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p), thread is %04lx\n",This,status,GetCurrentThreadId()); + + if (status == NULL) { + WARN("invalid parameter: status = NULL\n"); + return DSERR_INVALIDPARAM; + } + + *status = 0; + if ((This->state == STATE_STARTING) || (This->state == STATE_PLAYING)) { + *status |= DSBSTATUS_PLAYING; + if (This->playflags & DSBPLAY_LOOPING) + *status |= DSBSTATUS_LOOPING; + } + + TRACE("status=%lx\n", *status); + return DS_OK; +} + + +static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat( + LPDIRECTSOUNDBUFFER8 iface, + LPWAVEFORMATEX lpwf, + DWORD wfsize, + LPDWORD wfwritten) +{ + DWORD size; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p,%ld,%p)\n",This,lpwf,wfsize,wfwritten); + + size = sizeof(WAVEFORMATEX) + This->pwfx->cbSize; + + if (lpwf) { /* NULL is valid */ + if (wfsize >= size) { + memcpy(lpwf,This->pwfx,size); + if (wfwritten) + *wfwritten = size; + } else { + WARN("invalid parameter: wfsize to small\n"); + if (wfwritten) + *wfwritten = 0; + 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; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Lock( + LPDIRECTSOUNDBUFFER8 iface,DWORD writecursor,DWORD writebytes,LPVOID lplpaudioptr1,LPDWORD audiobytes1,LPVOID lplpaudioptr2,LPDWORD audiobytes2,DWORD flags +) { + HRESULT hres = DS_OK; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + + TRACE("(%p,%ld,%ld,%p,%p,%p,%p,0x%08lx) at %ld\n", + This, + writecursor, + writebytes, + lplpaudioptr1, + audiobytes1, + lplpaudioptr2, + audiobytes2, + flags, + GetTickCount() + ); + + if (flags & DSBLOCK_FROMWRITECURSOR) { + DWORD writepos; + /* GetCurrentPosition does too much magic to duplicate here */ + hres = IDirectSoundBufferImpl_GetCurrentPosition(iface, NULL, &writepos); + if (hres != DS_OK) { + WARN("IDirectSoundBufferImpl_GetCurrentPosition failed\n"); + return hres; + } + writecursor += writepos; + } + writecursor %= This->buflen; + if (flags & DSBLOCK_ENTIREBUFFER) + writebytes = This->buflen; + if (writebytes > This->buflen) + writebytes = This->buflen; + + EnterCriticalSection(&(This->lock)); + + if ((writebytes == This->buflen) && + ((This->state == STATE_STARTING) || + (This->state == STATE_PLAYING))) + /* some games, like Half-Life, try to be clever (not) and + * keep one secondary buffer, and mix sounds into it itself, + * locking the entire buffer every time... so we can just forget + * about tracking the last-written-to-position... */ + This->probably_valid_to = (DWORD)-1; + else + This->probably_valid_to = writecursor; + + if (!(This->dsound->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) { + hres = IDsDriverBuffer_Lock(This->hwbuf, + lplpaudioptr1, audiobytes1, + lplpaudioptr2, audiobytes2, + writecursor, writebytes, + 0); + if (hres != DS_OK) { + WARN("IDsDriverBuffer_Lock failed\n"); + LeaveCriticalSection(&(This->lock)); + return hres; + } + } else { + BOOL remix = FALSE; + if (writecursor+writebytes <= This->buflen) { + *(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor; + *audiobytes1 = writebytes; + if (lplpaudioptr2) + *(LPBYTE*)lplpaudioptr2 = NULL; + if (audiobytes2) + *audiobytes2 = 0; + TRACE("->%ld.0\n",writebytes); + } else { + *(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor; + *audiobytes1 = This->buflen-writecursor; + if (lplpaudioptr2) + *(LPBYTE*)lplpaudioptr2 = This->buffer->memory; + if (audiobytes2) + *audiobytes2 = writebytes-(This->buflen-writecursor); + TRACE("->%ld.%ld\n",*audiobytes1,audiobytes2?*audiobytes2:0); + } + if (This->state == STATE_PLAYING) { + /* if the segment between playpos and buf_mixpos is touched, + * we need to cancel some mixing */ + /* we'll assume that the app always calls GetCurrentPosition before + * locking a playing buffer, so that last_playpos is up-to-date */ + if (This->buf_mixpos >= This->last_playpos) { + if (This->buf_mixpos > writecursor && + This->last_playpos < writecursor+writebytes) + remix = TRUE; + } else { + if (This->buf_mixpos > writecursor || + This->last_playpos < writecursor+writebytes) + remix = TRUE; + } + if (remix) { + TRACE("locking prebuffered region, ouch\n"); + DSOUND_MixCancelAt(This, writecursor); + } + } + } + + LeaveCriticalSection(&(This->lock)); + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition( + LPDIRECTSOUNDBUFFER8 iface,DWORD newpos +) { + HRESULT hres = DS_OK; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%ld)\n",This,newpos); + + /* **** */ + EnterCriticalSection(&(This->lock)); + + newpos %= This->buflen; + This->buf_mixpos = newpos; + if (This->hwbuf) { + hres = IDsDriverBuffer_SetPosition(This->hwbuf, This->buf_mixpos); + if (hres != DS_OK) + WARN("IDsDriverBuffer_SetPosition failed\n"); + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return hres; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_SetPan( + LPDIRECTSOUNDBUFFER8 iface,LONG pan +) { + HRESULT hres = DS_OK; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + + TRACE("(%p,%ld)\n",This,pan); + + if ((pan > DSBPAN_RIGHT) || (pan < DSBPAN_LEFT)) { + WARN("invalid parameter: pan = %ld\n", pan); + return DSERR_INVALIDPARAM; + } + + /* You cannot use both pan and 3D controls */ + if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN) || + (This->dsbd.dwFlags & DSBCAPS_CTRL3D)) { + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; + } + + /* **** */ + EnterCriticalSection(&(This->lock)); + + if (This->volpan.lPan != pan) { + This->volpan.lPan = pan; + DSOUND_RecalcVolPan(&(This->volpan)); + + if (This->hwbuf) { + hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan)); + if (hres != DS_OK) + WARN("IDsDriverBuffer_SetVolumePan failed\n"); + } else + DSOUND_ForceRemix(This); + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + return hres; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetPan( + LPDIRECTSOUNDBUFFER8 iface,LPLONG pan +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p)\n",This,pan); + + if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) { + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; + } + + if (pan == NULL) { + WARN("invalid parameter: pan = NULL\n"); + return DSERR_INVALIDPARAM; + } + + *pan = This->volpan.lPan; + + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Unlock( + LPDIRECTSOUNDBUFFER8 iface,LPVOID p1,DWORD x1,LPVOID p2,DWORD x2 +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + DWORD probably_valid_to; + HRESULT hres = DS_OK; + + TRACE("(%p,%p,%ld,%p,%ld)\n", This,p1,x1,p2,x2); + + /* **** */ + EnterCriticalSection(&(This->lock)); + + if (!(This->dsound->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) { + hres = IDsDriverBuffer_Unlock(This->hwbuf, p1, x1, p2, x2); + if (hres != DS_OK) + WARN("IDsDriverBuffer_Unlock failed\n"); + } + + if (hres == DS_OK) { + if (p2) probably_valid_to = (((LPBYTE)p2)-This->buffer->memory) + x2; + else probably_valid_to = (((LPBYTE)p1)-This->buffer->memory) + x1; + probably_valid_to %= This->buflen; + if ((probably_valid_to == 0) && ((x1+x2) == This->buflen) && + ((This->state == STATE_STARTING) || + (This->state == STATE_PLAYING))) + /* see IDirectSoundBufferImpl_Lock */ + probably_valid_to = (DWORD)-1; + This->probably_valid_to = probably_valid_to; + } + + LeaveCriticalSection(&(This->lock)); + /* **** */ + + TRACE("probably_valid_to=%ld\n", This->probably_valid_to); + return hres; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Restore( + LPDIRECTSOUNDBUFFER8 iface +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + FIXME("(%p):stub\n",This); + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency( + LPDIRECTSOUNDBUFFER8 iface,LPDWORD freq +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p,%p)\n",This,freq); + + if (freq == NULL) { + WARN("invalid parameter: freq = NULL\n"); + return DSERR_INVALIDPARAM; + } + + *freq = This->freq; + TRACE("-> %ld\n", *freq); + + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_SetFX( + LPDIRECTSOUNDBUFFER8 iface,DWORD dwEffectsCount,LPDSEFFECTDESC pDSFXDesc,LPDWORD pdwResultCodes +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + DWORD u; + + FIXME("(%p,%lu,%p,%p): stub\n",This,dwEffectsCount,pDSFXDesc,pdwResultCodes); + + if (pdwResultCodes) + for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN; + + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources( + LPDIRECTSOUNDBUFFER8 iface,DWORD dwFlags,DWORD dwEffectsCount,LPDWORD pdwResultCodes +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + DWORD u; + + FIXME("(%p,%08lu,%lu,%p): stub\n",This,dwFlags,dwEffectsCount,pdwResultCodes); + + if (pdwResultCodes) + for (u=0; u<dwEffectsCount; u++) pdwResultCodes[u] = DSFXR_UNKNOWN; + + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath( + LPDIRECTSOUNDBUFFER8 iface,REFGUID rguidObject,DWORD dwIndex,REFGUID rguidInterface,LPVOID* ppObject +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + + FIXME("(%p,%s,%lu,%s,%p): stub\n",This,debugstr_guid(rguidObject),dwIndex,debugstr_guid(rguidInter face),ppObject); + + WARN("control unavailable\n"); + return DSERR_CONTROLUNAVAIL; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_Initialize( + LPDIRECTSOUNDBUFFER8 iface,LPDIRECTSOUND dsound,LPCDSBUFFERDESC dbsd +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + FIXME("(%p,%p,%p):stub\n",This,dsound,dbsd); + DPRINTF("Re-Init!!!\n"); + WARN("already initialized\n"); + return DSERR_ALREADYINITIALIZED; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps( + LPDIRECTSOUNDBUFFER8 iface,LPDSBCAPS caps +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + TRACE("(%p)->(%p)\n",This,caps); + + if (caps == NULL) { + WARN("invalid parameter: caps == NULL\n"); + return DSERR_INVALIDPARAM; + } + + if (caps->dwSize < sizeof(*caps)) { + WARN("invalid parameter: caps->dwSize = %ld < %d\n",caps->dwSize, sizeof(*caps)); + return DSERR_INVALIDPARAM; + } + + caps->dwFlags = This->dsbd.dwFlags; + if (This->hwbuf) caps->dwFlags |= DSBCAPS_LOCHARDWARE; + else caps->dwFlags |= DSBCAPS_LOCSOFTWARE; + + caps->dwBufferBytes = This->buflen; + + /* This value represents the speed of the "unlock" command. + As unlock is quite fast (it does not do anything), I put + 4096 ko/s = 4 Mo / s */ + /* FIXME: hwbuf speed */ + caps->dwUnlockTransferRate = 4096; + caps->dwPlayCpuOverhead = 0; + + return DS_OK; +} + +static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( + LPDIRECTSOUNDBUFFER8 iface,REFIID riid,LPVOID *ppobj +) { + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + + TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + + if (ppobj == NULL) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + + *ppobj = NULL; /* assume failure */ + + if ( IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IDirectSoundBuffer) || + IsEqualGUID(riid, &IID_IDirectSoundBuffer8) ) { + if (!This->dsb) + SecondaryBufferImpl_Create(This, &(This->dsb)); + if (This->dsb) { + IDirectSoundBuffer8_AddRef((LPDIRECTSOUNDBUFFER8)This->dsb); + *ppobj = This->dsb; + return S_OK; + } + WARN("IID_IDirectSoundBuffer\n"); + return E_NOINTERFACE; + } + + if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) { + if (!This->notify) + IDirectSoundNotifyImpl_Create(This, &(This->notify)); + if (This->notify) { + IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify); + *ppobj = This->notify; [truncated at 1000 lines; 10802 more skipped]
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12510
by chorns@svn.reactos.com
Remove merged-into-trunk-1 tag. Deleted: tags/merged-into-trunk-1/
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12509
by chorns@svn.reactos.com
Remove lean-explorer-SDI tag. Deleted: tags/lean-explorer-SDI/
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12508
by chorns@svn.reactos.com
Remove lean-explorer-MDI tag. Deleted: tags/lean-explorer-MDI/
19 years, 12 months
1
0
0
0
Integrated change by gvg in revision 12507
by gvg@svn.reactos.com
Import and merge Wine-20041201 Added: trunk/reactos/lib/dinput8/ Added: trunk/reactos/lib/dinput8/Makefile Added: trunk/reactos/lib/dinput8/Makefile.ros-template Modified: trunk/reactos/lib/dinput8/version.rc _____ Copied: trunk/reactos/lib/dinput8 (from rev 12506, vendor/wine/dlls/dinput8/current) _____ Added: trunk/reactos/lib/dinput8/Makefile --- vendor/wine/dlls/dinput8/current/Makefile 2004-12-31 14:50:49 UTC (rev 12506) +++ trunk/reactos/lib/dinput8/Makefile 2004-12-31 14:52:07 UTC (rev 12507) @@ -0,0 +1,9 @@ +# $Id: makefile 11864 2004-11-29 00:15:23Z greatlrd $ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = winedll + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk _____ Added: trunk/reactos/lib/dinput8/Makefile.ros-template --- vendor/wine/dlls/dinput8/current/Makefile.ros-template 2004-12-31 14:50:49 UTC (rev 12506) +++ trunk/reactos/lib/dinput8/Makefile.ros-template 2004-12-31 14:52:07 UTC (rev 12507) @@ -0,0 +1,30 @@ +# $Id: Makefile.ros-template 12241 2004-12-20 00:57:38Z greatlrd $ + +TARGET_NAME = dinput8 + +TARGET_BASE = $(TARGET_BASE_LIB_DINPUT8) + +TARGET_OBJECTS = @C_SRCS@ + +TARGET_CFLAGS = @EXTRADEFS@ -D__REACTOS__ + +TARGET_SDKLIBS = wine.a @IMPORTS@ ole32.a wine_uuid.a ntdll.a winmm.a dxguid.a + + + +TARGET_RC_SRCS = @RC_SRCS@ +TARGET_RC_BINSRC = @RC_BINSRC@ +TARGET_RC_BINARIES = @RC_BINARIES@ + +default: all + +authors.c: +ifeq ($(HOST),mingw32-linux) + echo 'const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 };' > authors.c +else + echo const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 }; > authors.c +endif + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(TOOLS_PATH)/depend.mk _____ Modified: trunk/reactos/lib/dinput8/version.rc --- vendor/wine/dlls/dinput8/current/version.rc 2004-12-31 14:50:49 UTC (rev 12506) +++ trunk/reactos/lib/dinput8/version.rc 2004-12-31 14:52:07 UTC (rev 12507) @@ -22,5 +22,6 @@ #define WINE_FILEVERSION_STR "5.1.2600.881" #define WINE_PRODUCTVERSION 5,1,2600,881 #define WINE_PRODUCTVERSION_STR "5.1" +#define WINE_PRODUCTNAME_STR "DirectX" #include "wine/wine_common_ver.rc"
19 years, 12 months
1
0
0
0
Integrated change by gvg in revision 12506
by gvg@svn.reactos.com
Need to remove existing files before doing vendor import Deleted: trunk/reactos/lib/dinput8/
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12505
by chorns@svn.reactos.com
Remove freeldr_0_9 tag. Deleted: tags/freeldr_0_9/
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12504
by chorns@svn.reactos.com
Remove floppy-inc tag. Deleted: tags/floppy-inc/
19 years, 12 months
1
0
0
0
Integrated change by gvg in revision 12503
by gvg@svn.reactos.com
Tag Wine-20041201 Added: vendor/wine/dlls/dinput8/Wine-20041201/ _____ Copied: vendor/wine/dlls/dinput8/Wine-20041201 (from rev 12501, vendor/wine/dlls/dinput8/current)
19 years, 12 months
1
0
0
0
Integrated change by chorns in revision 12502
by chorns@svn.reactos.com
Remove before_ddk tag. Deleted: tags/before_ddk/
19 years, 12 months
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
83
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Results per page:
10
25
50
100
200