Author: janderwald Date: Tue Feb 9 13:03:59 2010 New Revision: 45527
URL: http://svn.reactos.org/svn/reactos?rev=45527&view=rev Log: [DSOUND_NEW] - Implement starting / stopping primary sound buffer - Implement retrieving capabilities for secondary sound buffer - Import sound mixing routines from wine, not yet used
Added: trunk/reactos/dll/directx/dsound_new/dsound_convert.c (props changed) - copied unchanged from r45494, trunk/reactos/dll/directx/dsound/dsound_convert.c Modified: trunk/reactos/dll/directx/dsound_new/primary.c trunk/reactos/dll/directx/dsound_new/secondary.c
Propchange: trunk/reactos/dll/directx/dsound_new/dsound_convert.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/reactos/dll/directx/dsound_new/dsound_convert.c ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Tue Feb 9 13:03:59 2010 @@ -1,0 +1,1 @@ +/branches/ros-amd64-bringup/reactos/dll/directx/dsound/dsound_convert.c:34711-34712,34743,34780-34782,34812,34839,34842,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35683,35739,35746,35762,35771,35777,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36172,36360,36388-36389,36445,36502-36503,36505,36570,36614,36899,36930,36936,36992,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148-38151,38264-38265,38268,38355,39151,39333,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41082-41086,41097-41098,41101,41449,41479,41484-41485,41499,41531,41536,41540,41546-41547,41549,43080,43426,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43838-43840,43857-43858,43860,43905-43907,43969,44002,44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338,44389,44391,44426,44460,44530,44540,44601
Modified: trunk/reactos/dll/directx/dsound_new/primary.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/prim... ============================================================================== --- trunk/reactos/dll/directx/dsound_new/primary.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/dsound_new/primary.c [iso-8859-1] Tue Feb 9 13:03:59 2010 @@ -229,8 +229,37 @@ DWORD dwPriority, DWORD dwFlags) { - UNIMPLEMENTED - return DSERR_INVALIDPARAM; + LPCDirectSoundBuffer This = (LPCDirectSoundBuffer)CONTAINING_RECORD(iface, CDirectSoundBuffer, lpVtbl); + + if (dwReserved1 != 0 || !(dwFlags & DSBPLAY_LOOPING)) + { + /* invalid parameter */ + return DSERR_INVALIDPARAM; + } + + PrimaryDirectSoundBuffer_AcquireLock(iface); + + if (This->State == KSSTATE_STOP) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_ACQUIRE); + ASSERT(This->State == KSSTATE_ACQUIRE); + } + + if (This->State == KSSTATE_ACQUIRE) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_PAUSE); + ASSERT(This->State == KSSTATE_PAUSE); + } + + if (This->State == KSSTATE_PAUSE) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_RUN); + ASSERT(This->State == KSSTATE_RUN); + } + + PrimaryDirectSoundBuffer_ReleaseLock(iface); + + return DS_OK; }
HRESULT @@ -239,8 +268,8 @@ LPDIRECTSOUNDBUFFER8 iface, DWORD dwNewPosition) { - UNIMPLEMENTED - return DSERR_INVALIDPARAM; + /* The position of a primary buffer can't be set */ + return DSERR_INVALIDCALL; }
HRESULT @@ -303,8 +332,31 @@ PrimaryDirectSoundBuffer8Impl_fnStop( LPDIRECTSOUNDBUFFER8 iface) { - UNIMPLEMENTED - return DSERR_INVALIDPARAM; + LPCDirectSoundBuffer This = (LPCDirectSoundBuffer)CONTAINING_RECORD(iface, CDirectSoundBuffer, lpVtbl); + + PrimaryDirectSoundBuffer_AcquireLock(iface); + + if (This->State == KSSTATE_RUN) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_PAUSE); + ASSERT(This->State == KSSTATE_PAUSE); + } + + if (This->State == KSSTATE_PAUSE) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_ACQUIRE); + ASSERT(This->State == KSSTATE_ACQUIRE); + } + + if (This->State == KSSTATE_ACQUIRE) + { + PrimaryDirectSoundBuffer_SetState(iface, KSSTATE_STOP); + ASSERT(This->State == KSSTATE_STOP); + } + + PrimaryDirectSoundBuffer_ReleaseLock(iface); + + return DS_OK; }
Modified: trunk/reactos/dll/directx/dsound_new/secondary.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/seco... ============================================================================== --- trunk/reactos/dll/directx/dsound_new/secondary.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/dsound_new/secondary.c [iso-8859-1] Tue Feb 9 13:03:59 2010 @@ -17,6 +17,7 @@
LPFILTERINFO Filter; DWORD dwLevel; + DWORD dwFlags; LPWAVEFORMATEX Format; PUCHAR Buffer; DWORD BufferSize; @@ -97,8 +98,27 @@ LPDIRECTSOUNDBUFFER8 iface, LPDSBCAPS pDSBufferCaps) { - UNIMPLEMENTED - return DSERR_INVALIDPARAM; + LPCDirectSoundBuffer This = (LPCDirectSoundBuffer)CONTAINING_RECORD(iface, CDirectSoundBuffer, lpVtbl); + + if (!pDSBufferCaps) + { + /* invalid parameter */ + return DSERR_INVALIDPARAM; + } + + if (pDSBufferCaps->dwSize < sizeof(DSBCAPS)) + { + /* invalid buffer size */ + return DSERR_INVALIDPARAM; + } + + /* get buffer details */ + pDSBufferCaps->dwUnlockTransferRate = 0; + pDSBufferCaps->dwPlayCpuOverhead = 0; + pDSBufferCaps->dwSize = This->BufferSize; + pDSBufferCaps->dwFlags = This->dwFlags; + + return DS_OK; }
HRESULT @@ -528,6 +548,7 @@ This->lpVtbl = &vt_DirectSoundBuffer8; This->Filter = Filter; This->dwLevel = dwLevel; + This->dwFlags = lpcDSBufferDesc->dwFlags; This->State = KSSTATE_STOP; This->Flags = 0; This->Position = 0;