if (!ref)
{
+ if (This->hPin)
+ {
+ /* close pin handle */
+ CloseHandle(This->hPin);
+ }
+ /* free primary buffer */
HeapFree(GetProcessHeap(), 0, This);
}
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
LPDIRECTSOUNDBUFFER8 iface,
DWORD dwNewPosition)
{
- UNIMPLEMENTED
- return DSERR_INVALIDPARAM;
+ /* The position of a primary buffer can't be set */
+ return DSERR_INVALIDCALL;
}
HRESULT
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;
}
if (This->hPin)
{
- /* fixme change format */
- ASSERT(0);
+ // FIXME
+ // check if multiple buffers are active
+ // in that case need mixing
+
+ if (SetPinFormat(This->hPin, pcfxFormat))
+ return DS_OK;
+ else
+ return DSERR_GENERIC;
}
do