mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix an initialization bug with the WinMM backend.
This commit is contained in:
@@ -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.
|
// that link goes stale, just look up the documentation for WAVEOUTCAPS or WAVEINCAPS.
|
||||||
WAVEFORMATEX wf;
|
WAVEFORMATEX wf;
|
||||||
mal_zero_object(&wf);
|
mal_zero_object(&wf);
|
||||||
wf.cbSize = sizeof(wf);
|
wf.cbSize = sizeof(wf);
|
||||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
wf.nChannels = (WORD)pConfig->channels;
|
wf.nChannels = (WORD)pConfig->channels;
|
||||||
wf.nSamplesPerSec = (DWORD)pConfig->sampleRate;
|
wf.nSamplesPerSec = (DWORD)pConfig->sampleRate;
|
||||||
wf.wBitsPerSample = (WORD)mal_get_sample_size_in_bytes(pConfig->format)*8;
|
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;
|
|
||||||
|
|
||||||
if (wf.nChannels > 2) {
|
if (wf.nChannels > 2) {
|
||||||
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.wBitsPerSample = closestBitsPerSample;
|
||||||
wf.nChannels = closestChannels;
|
wf.nChannels = closestChannels;
|
||||||
wf.nSamplesPerSec = closestSampleRate;
|
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.
|
// We use an event to know when a new fragment needs to be enqueued.
|
||||||
|
|||||||
Reference in New Issue
Block a user