aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/winmm.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
committerChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
commitcc3dd648ace1f1276e909dcb07adf782a39f1cf3 (patch)
treeb23d5bb282553f028d96795320d2f5b5b10de5fe /Alc/backends/winmm.c
parent98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff)
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/backends/winmm.c')
-rw-r--r--Alc/backends/winmm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 1a9f099b..67182950 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -677,20 +677,17 @@ static void WinMMStopCapture(ALCdevice *pDevice)
waveInStop(pData->hWaveHandle.In);
}
-static ALCuint WinMMAvailableSamples(ALCdevice *pDevice)
+static ALCenum WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
- return RingBufferSize(pData->pRing);
+ ReadRingBuffer(pData->pRing, pBuffer, lSamples);
+ return ALC_NO_ERROR;
}
-static ALCenum WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
+static ALCuint WinMMAvailableSamples(ALCdevice *pDevice)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
-
- if(WinMMAvailableSamples(pDevice) < lSamples)
- return ALC_INVALID_VALUE;
- ReadRingBuffer(pData->pRing, pBuffer, lSamples);
- return ALC_NO_ERROR;
+ return RingBufferSize(pData->pRing);
}