Since apparantly counter strike goes 2 fps or so when alsa is used and capture is enabled, I was looking to see if that can be speed up,.
Since I don't have that game I cannot do it myself, so can someone test attached patch and see if that fixes performance problems?
Maarten
From 7593fcf19ba306d0024048e7a49e87b7c8d5c318 Mon Sep 17 00:00:00 2001
From: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Thu, 5 Jul 2007 00:41:59 +0200 Subject: [PATCH] winealsa: Increase performance of wavein getposition
--- dlls/winealsa.drv/wavein.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/dlls/winealsa.drv/wavein.c b/dlls/winealsa.drv/wavein.c index 5d731eb..412edd2 100644 --- a/dlls/winealsa.drv/wavein.c +++ b/dlls/winealsa.drv/wavein.c @@ -154,7 +154,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt) DWORD frames_per_period;
wwi->state = WINE_WS_STOPPED; - wwi->dwTotalRecorded = 0; + InterlockedExchange((LONG*)&wwi->dwTotalRecorded, 0); wwi->lpQueuePtr = NULL;
SetEvent(wwi->hStartUpEvent); @@ -198,7 +198,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt) { /* update number of bytes recorded in current buffer and by this device */ lpWaveHdr->dwBytesRecorded += bytesRead; - wwi->dwTotalRecorded += bytesRead; + InterlockedExchangeAdd((LONG*)&wwi->dwTotalRecorded, bytesRead);
/* buffer is full. notify client */ if (lpWaveHdr->dwBytesRecorded == lpWaveHdr->dwBufferLength) @@ -247,7 +247,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt)
/* update number of bytes recorded in current buffer and by this device */ lpWaveHdr->dwBytesRecorded += dwToCopy; - wwi->dwTotalRecorded += dwToCopy; + InterlockedExchangeAdd((LONG*)&wwi->dwTotalRecorded, dwToCopy); bytesRead -= dwToCopy; pOffset += dwToCopy;
@@ -385,10 +385,6 @@ static DWORD CALLBACK widRecorder(LPVOID pmt) HeapFree(GetProcessHeap(), 0, buffer); ExitThread(0); /* shouldn't go here */ - case WINE_WM_UPDATE: - SetEvent(ev); - break; - default: FIXME("unknown message %d\n", msg); break; @@ -784,8 +780,6 @@ static DWORD widGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) }
wwi = &WInDev[wDevID]; - ALSA_AddRingMessage(&wwi->msgRing, WINE_WM_UPDATE, 0, TRUE); - return ALSA_bytes_to_mmtime(lpTime, wwi->dwTotalRecorded, &wwi->format); }