Fix an initialization bug with the WinMM backend.

This commit is contained in:
David Reid
2017-07-22 22:35:13 +10:00
parent 18317050b7
commit d68ed4f887
+10 -10
View File
@@ -3782,13 +3782,11 @@ static mal_result mal_device_init__winmm(mal_context* pContext, mal_device_type
// that link goes stale, just look up the documentation for WAVEOUTCAPS or WAVEINCAPS.
WAVEFORMATEX wf;
mal_zero_object(&wf);
wf.cbSize = sizeof(wf);
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = (WORD)pConfig->channels;
wf.nSamplesPerSec = (DWORD)pConfig->sampleRate;
wf.wBitsPerSample = (WORD)mal_get_sample_size_in_bytes(pConfig->format)*8;
wf.nBlockAlign = (wf.nChannels * wf.wBitsPerSample) / 8;
wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec;
wf.cbSize = sizeof(wf);
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = (WORD)pConfig->channels;
wf.nSamplesPerSec = (DWORD)pConfig->sampleRate;
wf.wBitsPerSample = (WORD)mal_get_sample_size_in_bytes(pConfig->format)*8;
if (wf.nChannels > 2) {
wf.nChannels = 2;
@@ -4022,9 +4020,11 @@ static mal_result mal_device_init__winmm(mal_context* pContext, mal_device_type
}
}
wf.wBitsPerSample = closestBitsPerSample;
wf.nChannels = closestChannels;
wf.nSamplesPerSec = closestSampleRate;
wf.wBitsPerSample = closestBitsPerSample;
wf.nChannels = closestChannels;
wf.nSamplesPerSec = closestSampleRate;
wf.nBlockAlign = (wf.nChannels * wf.wBitsPerSample) / 8;
wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec;
// We use an event to know when a new fragment needs to be enqueued.