diff options
author | Chris Robinson <[email protected]> | 2008-02-14 22:05:56 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-02-14 22:05:56 -0800 |
commit | 8c3188bc7dc2f47a27398fc61ed2dacd36397190 (patch) | |
tree | 5c46bd2fb13355a1bdb6f6118b86bee9452f2859 /Alc/winmm.c | |
parent | 880196e5a811356c4a6b36798a81429b4a48eb40 (diff) |
Remove FrameSize struct member
Diffstat (limited to 'Alc/winmm.c')
-rw-r--r-- | Alc/winmm.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Alc/winmm.c b/Alc/winmm.c index 118db589..4963597c 100644 --- a/Alc/winmm.c +++ b/Alc/winmm.c @@ -211,10 +211,11 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName wfexCaptureFormat.wFormatTag = WAVE_FORMAT_PCM; wfexCaptureFormat.nChannels = aluChannelsFromFormat(pDevice->Format); wfexCaptureFormat.wBitsPerSample = aluBytesFromFormat(pDevice->Format) * 8; - wfexCaptureFormat.nBlockAlign = pDevice->FrameSize; + wfexCaptureFormat.nBlockAlign = wfexCaptureFormat.wBitsPerSample * + wfexCaptureFormat.nChannels / 8; wfexCaptureFormat.nSamplesPerSec = frequency; wfexCaptureFormat.nAvgBytesPerSec = wfexCaptureFormat.nSamplesPerSec * - pDevice->FrameSize; + wfexCaptureFormat.nBlockAlign; wfexCaptureFormat.cbSize = 0; if (waveInOpen(&pData->hWaveInHandle, lDeviceID, &wfexCaptureFormat, (DWORD_PTR)&WaveInProc, (DWORD_PTR)pDevice, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) @@ -361,16 +362,20 @@ static void WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lS ALuint ulBytes, ulBytesToCopy; ALuint ulCapturedSamples; ALuint ulReadOffset; + ALuint frameSize = aluBytesFromFormat(pDevice->Format) * + aluChannelsFromFormat(pDevice->Format); // Check that we have the requested numbers of Samples - ulCapturedSamples = (pData->ulWriteCapturedDataPos - pData->ulReadCapturedDataPos) / pDevice->FrameSize; + ulCapturedSamples = (pData->ulWriteCapturedDataPos - + pData->ulReadCapturedDataPos) / + frameSize; if(ulSamples > ulCapturedSamples) { SetALCError(ALC_INVALID_VALUE); return; } - ulBytes = ulSamples * pDevice->FrameSize; + ulBytes = ulSamples * frameSize; // Get Read Offset ulReadOffset = (pData->ulReadCapturedDataPos % pData->ulCapturedDataSize); @@ -399,7 +404,8 @@ static ALCuint WinMMAvailableSamples(ALCdevice *pDevice) { WinMMData *pData = (WinMMData*)pDevice->ExtraData; ALCuint lCapturedBytes = (pData->ulWriteCapturedDataPos - pData->ulReadCapturedDataPos); - return lCapturedBytes / pDevice->FrameSize; + return lCapturedBytes / (aluBytesFromFormat(pDevice->Format) * + aluChannelsFromFormat(pDevice->Format)); } |