From dbe0897c7fc8dc6e3445cecb26a21230e2f808d6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 20 Apr 2014 22:29:54 -0700 Subject: Use the stored format block align instead of calculating it --- Alc/backends/winmm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Alc/backends') diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c index e5b18372..e0ff88af 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -186,11 +186,8 @@ FORCE_ALIGN static DWORD WINAPI PlaybackThreadProc(LPVOID param) ALCdevice *Device = (ALCdevice*)param; WinMMData *data = Device->ExtraData; LPWAVEHDR WaveHdr; - ALuint FrameSize; MSG msg; - FrameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); - SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); @@ -207,7 +204,8 @@ FORCE_ALIGN static DWORD WINAPI PlaybackThreadProc(LPVOID param) } WaveHdr = ((LPWAVEHDR)msg.lParam); - aluMixData(Device, WaveHdr->lpData, WaveHdr->dwBufferLength/FrameSize); + aluMixData(Device, WaveHdr->lpData, WaveHdr->dwBufferLength / + data->Format.nBlockAlign); // Send buffer back to play more data waveOutWrite(data->WaveHandle.Out, WaveHdr, sizeof(WAVEHDR)); @@ -251,10 +249,8 @@ static DWORD WINAPI CaptureThreadProc(LPVOID param) ALCdevice *Device = (ALCdevice*)param; WinMMData *data = Device->ExtraData; LPWAVEHDR WaveHdr; - ALuint FrameSize; MSG msg; - FrameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); althrd_setname(althrd_current(), "alsoft-record"); while(GetMessage(&msg, NULL, 0, 0)) @@ -267,7 +263,8 @@ static DWORD WINAPI CaptureThreadProc(LPVOID param) break; WaveHdr = ((LPWAVEHDR)msg.lParam); - WriteRingBuffer(data->Ring, (ALubyte*)WaveHdr->lpData, WaveHdr->dwBytesRecorded/FrameSize); + WriteRingBuffer(data->Ring, (ALubyte*)WaveHdr->lpData, + WaveHdr->dwBytesRecorded/data->Format.nBlockAlign); // Send buffer back to capture more data waveInAddBuffer(data->WaveHandle.In, WaveHdr, sizeof(WAVEHDR)); -- cgit v1.2.3