aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-20 22:29:54 -0700
committerChris Robinson <[email protected]>2014-04-20 22:29:54 -0700
commitdbe0897c7fc8dc6e3445cecb26a21230e2f808d6 (patch)
tree7990a4fc053a0c9590cd29e5b2a428d8a5b48d73 /Alc/backends
parent5215b9cad254591accce704a0fbd2ec4df9acc68 (diff)
Use the stored format block align instead of calculating it
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/winmm.c11
1 files changed, 4 insertions, 7 deletions
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));