diff --git a/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp b/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp index 2e6207909..0c0cd65de 100644 --- a/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp +++ b/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp @@ -253,7 +253,8 @@ bool DSStream_Packet_Process( DWORD writePos = 0; hRet = pThis->EmuDirectSoundBuffer8->GetCurrentPosition(nullptr, &writePos); if (hRet == DS_OK) { - do { + // Disabled do/while loop since xbox thread will be processing as well. + //do { int bufPlayed = writePos - packetCurrent->lastWritePos; // Correct it if buffer was playing and is at beginning. @@ -320,9 +321,9 @@ bool DSStream_Packet_Process( // Otherwise, continue upload partial of the packet's data to host if there are any left. else { DSStream_Packet_UploadPartial(pThis, packetCurrent); - break; // Leave loop since there is more buffer haven't been process in the current packet. + //break; // Leave loop since there is more buffer haven't been process in the current packet. } - } while (true); + //} while (true); DSStream_Packet_Prefill(pThis, packetCurrent); } @@ -333,9 +334,12 @@ bool DSStream_Packet_Process( } } + // The only place when Host_isProcessing is set to true to start play Host's audio buffer. if (pThis->Host_isProcessing == false) { pThis->EmuDirectSoundBuffer8->Play(0, 0, pThis->EmuPlayFlags); pThis->Host_isProcessing = true; + // Add debug log for verify if Host_isProcessing has set to true. + EmuLog(LOG_LEVEL::DEBUG, "pStream = %08X:Host_isProcessing is set to true.", pThis); } return 1; } diff --git a/src/core/hle/DSOUND/DirectSound/DirectSoundStream.cpp b/src/core/hle/DSOUND/DirectSound/DirectSoundStream.cpp index 3e2e91766..d5d60aee6 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSoundStream.cpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSoundStream.cpp @@ -466,8 +466,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_GetStatus) // Convert host to xbox status flag. if (hRet == DS_OK) { - DWORD testSize = pThis->Host_BufferPacketArray.size(); - if ((dwStatusHost & DSBSTATUS_PLAYING) > 0 && !(dwStatusXbox & X_DSSSTATUS_PAUSED)) { + if (pThis->Host_isProcessing && !(dwStatusXbox & X_DSSSTATUS_PAUSED)) { dwStatusXbox |= X_DSSSTATUS_PLAYING; } @@ -548,6 +547,9 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Pause) } } } + else if (!pThis->Host_isProcessing) { + DSStream_Packet_Process(pThis); + } return hRet; } @@ -645,6 +647,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Process) if ((pThis->EmuFlags & DSE_FLAG_IS_ACTIVATED) > 0 && (pThis->EmuFlags & DSE_FLAG_PAUSE) > 0) { pThis->Xb_Status |= X_DSSSTATUS_PAUSED; } + DSStream_Packet_Process(pThis); // Once full it needs to change status to flushed when cannot hold any more packets. } else { if (pInputBuffer->pdwStatus != xbnullptr) {