aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-23 05:08:17 -0700
committerChris Robinson <[email protected]>2014-04-23 05:08:17 -0700
commit0b527621a533c114bd5e0aba041047e4ee0e4b04 (patch)
treeae8611c67cdf982e944c6ab56251843b23dc9e8b
parent8fd224f84191b3d512f9ea0c44aa1104b23959d8 (diff)
Use a RefCount for counting committed winmm buffers
-rw-r--r--Alc/backends/winmm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 96521abe..a5fe193c 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -41,7 +41,7 @@ typedef struct {
volatile ALboolean killNow;
althrd_t thread;
- volatile LONG WaveBuffersCommitted;
+ volatile RefCount WaveBuffersCommitted;
WAVEHDR WaveBuffer[4];
union {
@@ -170,7 +170,7 @@ static void CALLBACK WaveOutProc(HWAVEOUT UNUSED(device), UINT msg, DWORD_PTR in
if(msg != WOM_DONE)
return;
- InterlockedDecrement(&data->WaveBuffersCommitted);
+ DecrementRef(&data->WaveBuffersCommitted);
PostThreadMessage(data->thread, msg, 0, param1);
}
@@ -202,7 +202,7 @@ FORCE_ALIGN static int PlaybackThreadProc(void *arg)
// Send buffer back to play more data
waveOutWrite(data->WaveHandle.Out, WaveHdr, sizeof(WAVEHDR));
- InterlockedIncrement(&data->WaveBuffersCommitted);
+ IncrementRef(&data->WaveBuffersCommitted);
}
return 0;
@@ -222,7 +222,7 @@ static void CALLBACK WaveInProc(HWAVEIN UNUSED(device), UINT msg, DWORD_PTR inst
if(msg != WIM_DATA)
return;
- InterlockedDecrement(&data->WaveBuffersCommitted);
+ DecrementRef(&data->WaveBuffersCommitted);
PostThreadMessage(data->thread, msg, 0, param1);
}
@@ -250,7 +250,7 @@ static int CaptureThreadProc(void *arg)
// Send buffer back to capture more data
waveInAddBuffer(data->WaveHandle.In, WaveHdr, sizeof(WAVEHDR));
- InterlockedIncrement(&data->WaveBuffersCommitted);
+ IncrementRef(&data->WaveBuffersCommitted);
}
return 0;
@@ -425,7 +425,7 @@ static ALCboolean WinMMStartPlayback(ALCdevice *device)
data->WaveBuffer[i-1].dwBufferLength));
waveOutPrepareHeader(data->WaveHandle.Out, &data->WaveBuffer[i], sizeof(WAVEHDR));
waveOutWrite(data->WaveHandle.Out, &data->WaveBuffer[i], sizeof(WAVEHDR));
- InterlockedIncrement(&data->WaveBuffersCommitted);
+ IncrementRef(&data->WaveBuffersCommitted);
}
return ALC_TRUE;
@@ -567,7 +567,7 @@ static ALCenum WinMMOpenCapture(ALCdevice *Device, const ALCchar *deviceName)
data->WaveBuffer[i].dwLoops = 0;
waveInPrepareHeader(data->WaveHandle.In, &data->WaveBuffer[i], sizeof(WAVEHDR));
waveInAddBuffer(data->WaveHandle.In, &data->WaveBuffer[i], sizeof(WAVEHDR));
- InterlockedIncrement(&data->WaveBuffersCommitted);
+ IncrementRef(&data->WaveBuffersCommitted);
}
if(althrd_create(&data->thread, CaptureThreadProc, Device) != althrd_success)