Get Status First, Stop Buffer, Then CurrentPosition
Re-arrange order where it should had been in the first place to have seamless audio transfer.
This commit is contained in:
parent
8c0eb97228
commit
095c8402f7
|
@ -465,7 +465,7 @@ inline void DSoundBufferReplace(
|
||||||
DWORD PlayFlags,
|
DWORD PlayFlags,
|
||||||
LPDIRECTSOUND3DBUFFER8 &pDS3DBuffer)
|
LPDIRECTSOUND3DBUFFER8 &pDS3DBuffer)
|
||||||
{
|
{
|
||||||
DWORD refCount, dwPlayCursor, dwWriteCursor, dwStatus;
|
DWORD refCount, dwPlayCursor, dwStatus;
|
||||||
LPDIRECTSOUNDBUFFER8 pDSBufferNew = nullptr;
|
LPDIRECTSOUNDBUFFER8 pDSBufferNew = nullptr;
|
||||||
LPDIRECTSOUND3DBUFFER8 pDS3DBufferNew = nullptr;
|
LPDIRECTSOUND3DBUFFER8 pDS3DBufferNew = nullptr;
|
||||||
|
|
||||||
|
@ -481,20 +481,20 @@ inline void DSoundBufferReplace(
|
||||||
if (pDS3DBuffer != nullptr) {
|
if (pDS3DBuffer != nullptr) {
|
||||||
pDS3DBuffer->Release();
|
pDS3DBuffer->Release();
|
||||||
}
|
}
|
||||||
|
HRESULT hRet = pDSBuffer->GetStatus(&dwStatus);
|
||||||
HRESULT hRet = pDSBuffer->GetCurrentPosition(&dwPlayCursor, &dwWriteCursor);
|
|
||||||
|
|
||||||
if (hRet != DS_OK) {
|
if (hRet != DS_OK) {
|
||||||
CxbxKrnlCleanup("Unable to retrieve current position for resize reallocation!");
|
CxbxKrnlCleanup("Unable to retrieve current status for replace DS buffer!");
|
||||||
}
|
|
||||||
hRet = pDSBuffer->GetStatus(&dwStatus);
|
|
||||||
|
|
||||||
if (hRet != DS_OK) {
|
|
||||||
CxbxKrnlCleanup("Unable to retrieve current status for resize reallocation!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pDSBuffer->Stop();
|
pDSBuffer->Stop();
|
||||||
|
|
||||||
|
hRet = pDSBuffer->GetCurrentPosition(&dwPlayCursor, nullptr);
|
||||||
|
|
||||||
|
if (hRet != DS_OK) {
|
||||||
|
CxbxKrnlCleanup("Unable to retrieve current position for replace DS buffer!");
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Untested if transfer buffer to new audio buffer is necessary.
|
// TODO: Untested if transfer buffer to new audio buffer is necessary.
|
||||||
PVOID pLockPtr1Old, pLockPtr1New;
|
PVOID pLockPtr1Old, pLockPtr1New;
|
||||||
DWORD dwLockBytes1Old, dwLockBytes1New;
|
DWORD dwLockBytes1Old, dwLockBytes1New;
|
||||||
|
|
Loading…
Reference in New Issue