diff options
author | Chris Robinson <[email protected]> | 2009-09-15 19:30:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-09-15 19:30:27 -0700 |
commit | 9f037e89802a7b4fc6c287bab97b85050bbd6721 (patch) | |
tree | 8aafaa57a698d0fdcb799766d786cc44625e22ba /Alc/dsound.c | |
parent | 12f81bcbb91f95df8bafdafa29f30adf55701203 (diff) |
Pass the device to aluMixData
Diffstat (limited to 'Alc/dsound.c')
-rw-r--r-- | Alc/dsound.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Alc/dsound.c b/Alc/dsound.c index 16a8dbbe..8501623d 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -84,6 +84,7 @@ static ALuint DSoundProc(ALvoid *ptr) DWORD PlayCursor; VOID *WritePtr1, *WritePtr2; DWORD WriteCnt1, WriteCnt2; + DWORD FrameSize; DWORD FragSize; DWORD avail; HRESULT err; @@ -94,10 +95,14 @@ static ALuint DSoundProc(ALvoid *ptr) if(FAILED(err)) { AL_PRINT("Failed to get buffer caps: 0x%lx\n", err); + aluHandleDisconnect(pDevice); return 1; } FragSize = DSBCaps.dwBufferBytes / num_frags; + FrameSize = aluChannelsFromFormat(pDevice->Format) * + aluBytesFromFormat(pDevice->Format); + IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &LastCursor, NULL); while(!pData->killNow) { @@ -131,10 +136,8 @@ static ALuint DSoundProc(ALvoid *ptr) if(SUCCEEDED(err)) { // If we have an active context, mix data directly into output buffer otherwise fill with silence - SuspendContext(NULL); - aluMixData(pDevice->Context, WritePtr1, WriteCnt1/DSBCaps.nBlockAlign, pDevice->Format); - aluMixData(pDevice->Context, WritePtr2, WriteCnt2/DSBCaps.nBlockAlign, pDevice->Format); - ProcessContext(NULL); + aluMixData(pDevice, WritePtr1, WriteCnt1/FrameSize); + aluMixData(pDevice, WritePtr2, WriteCnt2/FrameSize); // Unlock output buffer only when successfully locked IDirectSoundBuffer_Unlock(pData->DSsbuffer, WritePtr1, WriteCnt1, WritePtr2, WriteCnt2); |