fix audio flush async worker
This commit is contained in:
parent
2c440eb03a
commit
4a27006ce6
|
@ -299,10 +299,21 @@ bool DSStream_Packet_Process(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DSStream_Packet_FlushEx_Reset(
|
||||||
|
XTL::X_CDirectSoundStream* pThis
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Remove flags only (This is the only place it will remove other than FlushEx perform set/remove the flags.)
|
||||||
|
pThis->EmuFlags &= ~(DSE_FLAG_FLUSH_ASYNC | DSE_FLAG_ENVELOPE | DSE_FLAG_ENVELOPE2);
|
||||||
|
pThis->Xb_rtFlushEx = 0LL;
|
||||||
|
}
|
||||||
|
|
||||||
bool DSStream_Packet_Flush(
|
bool DSStream_Packet_Flush(
|
||||||
XTL::X_CDirectSoundStream* pThis
|
XTL::X_CDirectSoundStream* pThis
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
DSStream_Packet_FlushEx_Reset(pThis);
|
||||||
|
|
||||||
// If host's audio is still playing then return busy-state until buffer has stop playing.
|
// If host's audio is still playing then return busy-state until buffer has stop playing.
|
||||||
DWORD dwStatus;
|
DWORD dwStatus;
|
||||||
pThis->EmuDirectSoundBuffer8->GetStatus(&dwStatus);
|
pThis->EmuDirectSoundBuffer8->GetStatus(&dwStatus);
|
||||||
|
|
|
@ -39,4 +39,6 @@ extern void DSStream_Packet_Clear(
|
||||||
|
|
||||||
extern bool DSStream_Packet_Process(XTL::X_CDirectSoundStream* pThis);
|
extern bool DSStream_Packet_Process(XTL::X_CDirectSoundStream* pThis);
|
||||||
|
|
||||||
|
extern void DSStream_Packet_FlushEx_Reset(XTL::X_CDirectSoundStream* pThis);
|
||||||
|
|
||||||
extern bool DSStream_Packet_Flush(XTL::X_CDirectSoundStream* pThis);
|
extern bool DSStream_Packet_Flush(XTL::X_CDirectSoundStream* pThis);
|
||||||
|
|
|
@ -390,15 +390,9 @@ static void dsound_thread_worker(LPVOID nullPtr)
|
||||||
{
|
{
|
||||||
DSoundMutexGuardLock;
|
DSoundMutexGuardLock;
|
||||||
|
|
||||||
vector_ds_stream::iterator ppDSStream = g_pDSoundStreamCache.begin();
|
xboxkrnl::LARGE_INTEGER getTime;
|
||||||
for (; ppDSStream != g_pDSoundStreamCache.end(); ppDSStream++) {
|
xboxkrnl::KeQuerySystemTime(&getTime);
|
||||||
if ((*ppDSStream)->Host_BufferPacketArray.size() == 0) {
|
DirectSoundDoWork_Stream(getTime);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (((*ppDSStream)->EmuFlags & DSE_FLAG_FLUSH_ASYNC) > 0 && (*ppDSStream)->Xb_rtFlushEx == 0LL) {
|
|
||||||
DSStream_Packet_Process((*ppDSStream));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,10 +360,6 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Flush)
|
||||||
|
|
||||||
DSoundBufferSynchPlaybackFlagRemove(pThis->EmuFlags);
|
DSoundBufferSynchPlaybackFlagRemove(pThis->EmuFlags);
|
||||||
|
|
||||||
// Remove flags only (This is the only place it will remove other than FlushEx perform set/remove the flags.)
|
|
||||||
pThis->EmuFlags &= ~(DSE_FLAG_FLUSH_ASYNC | DSE_FLAG_ENVELOPE | DSE_FLAG_ENVELOPE2);
|
|
||||||
pThis->Xb_rtFlushEx = 0LL;
|
|
||||||
|
|
||||||
while (DSStream_Packet_Flush(pThis));
|
while (DSStream_Packet_Flush(pThis));
|
||||||
|
|
||||||
return DS_OK;
|
return DS_OK;
|
||||||
|
@ -387,6 +383,8 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_FlushEx)
|
||||||
LOG_FUNC_END;
|
LOG_FUNC_END;
|
||||||
|
|
||||||
HRESULT hRet = DSERR_INVALIDPARAM;
|
HRESULT hRet = DSERR_INVALIDPARAM;
|
||||||
|
// Reset flags here to reprocess dwFlags request.
|
||||||
|
DSStream_Packet_FlushEx_Reset(pThis);
|
||||||
|
|
||||||
// Cannot use rtTimeStamp here, it must be flush.
|
// Cannot use rtTimeStamp here, it must be flush.
|
||||||
if (dwFlags == X_DSSFLUSHEX_IMMEDIATE) {
|
if (dwFlags == X_DSSFLUSHEX_IMMEDIATE) {
|
||||||
|
|
Loading…
Reference in New Issue