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:
@@ -3787,8 +3787,6 @@ static mal_result mal_device_init__winmm(mal_context* pContext, mal_device_type
|
||||
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;
|
||||
|
||||
if (wf.nChannels > 2) {
|
||||
wf.nChannels = 2;
|
||||
@@ -4025,6 +4023,8 @@ static mal_result mal_device_init__winmm(mal_context* pContext, mal_device_type
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user