Small fixup for Pause functionality

Plus do set status outside of DS_OK state too.
This commit is contained in:
RadWolfie 2018-04-26 03:09:17 -05:00
parent 0043262818
commit ae3f812347
2 changed files with 11 additions and 12 deletions

View File

@ -1406,7 +1406,7 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_SetPitch)
HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_GetStatus)
(
X_CDirectSoundBuffer* pThis,
OUT LPDWORD pdwStatus)
OUT LPDWORD pdwStatus)
{
FUNC_EXPORTS;
@ -1430,7 +1430,12 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_GetStatus)
if ((dwStatusHost & DSBSTATUS_LOOPING) > 0) {
dwStatusXbox |= X_DSBSTATUS_LOOPING;
}
}
if (pdwStatus != xbnullptr) {
*pdwStatus = dwStatusXbox;
} else {
hRet = DSERR_INVALIDPARAM;
}
leaveCriticalSection;
@ -2239,7 +2244,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Pause)
LOG_FUNC_END;
return HybridDirectSoundBuffer_Pause(pThis->EmuDirectSoundBuffer8, dwPause, pThis->EmuFlags, pThis->EmuPlayFlags,
(pThis->Host_BufferPacketArray.size() > 0), 0LL, pThis->Xb_rtPauseEx);
pThis->Host_isProcessing, 0LL, pThis->Xb_rtPauseEx);
}
// ******************************************************************
@ -4088,7 +4093,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_PauseEx)
// TODO: Implement time stamp feature (a thread maybe?)
HRESULT hRet = HybridDirectSoundBuffer_Pause(pThis->EmuDirectSoundBuffer8, dwPause, pThis->EmuFlags, pThis->EmuPlayFlags,
(pThis->Host_BufferPacketArray.size() > 0), rtTimestamp, pThis->Xb_rtPauseEx);
pThis->Host_isProcessing, rtTimestamp, pThis->Xb_rtPauseEx);
leaveCriticalSection;

View File

@ -819,6 +819,7 @@ inline bool DSoundStreamProcess(XTL::X_CDirectSoundStream* pThis) {
pThis->EmuDirectSoundBuffer8->Play(0, 0, pThis->EmuPlayFlags);
pThis->Host_isProcessing = true;
}
buffer->isWritten = true;
} else {
@ -1030,10 +1031,7 @@ inline HRESULT HybridDirectSoundBuffer_Pause(
Xb_rtTimeStamp = 0;
break;
case X_DSSPAUSE_PAUSE:
hStatus = pDSBuffer->GetStatus(&dwStatus);
if (hStatus == DS_OK && dwStatus & DSBSTATUS_PLAYING) {
pDSBuffer->Stop();
}
pDSBuffer->Stop();
DSoundBufferSynchPlaybackFlagRemove(dwEmuFlags);
dwEmuFlags |= DSE_FLAG_PAUSE;
Xb_rtTimeStamp = rtTimeStamp;
@ -1044,11 +1042,7 @@ inline HRESULT HybridDirectSoundBuffer_Pause(
//SynchPlayback flag append should only occur in HybridDirectSoundBuffer_Pause function, nothing else is able to do this.
hRet = DSoundBufferSynchPlaybackFlagAdd(dwEmuFlags);
if (hRet == DS_OK) {
hRet = pDSBuffer->GetStatus(&dwStatus);
if (hRet == DS_OK && dwStatus & DSBSTATUS_PLAYING) {
pDSBuffer->Stop();
pDSBuffer->SetCurrentPosition(0);
}
pDSBuffer->Stop();
}
break;
// TODO: NOTE: If stream is playing, it perform same behavior as pause flag. If it is not played, it act as a queue until trigger to play it.