mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
SDL2: Improve Emscripten support by limiting the period size.
Setting the period size to something too small results in glitching so this commit will clamp it to a minimum size on the Emscripten build.
This commit is contained in:
@@ -506,6 +506,18 @@ static ma_result ma_device_init_internal__sdl2(ma_device* pDevice, ma_context_st
|
|||||||
pDescriptor->periodSizeInFrames = ma_next_power_of_2(pDescriptor->periodSizeInFrames);
|
pDescriptor->periodSizeInFrames = ma_next_power_of_2(pDescriptor->periodSizeInFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
In my experience there is glitching with a period size of anything <= 512. To make this "Just Work" on
|
||||||
|
the Emscripten build we'll set this to 1024.
|
||||||
|
*/
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
{
|
||||||
|
if (pDescriptor->periodSizeInFrames < 1024) {
|
||||||
|
pDescriptor->periodSizeInFrames = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* We now have enough information to set up the device. */
|
/* We now have enough information to set up the device. */
|
||||||
memset(&desiredSpec, 0, sizeof(desiredSpec));
|
memset(&desiredSpec, 0, sizeof(desiredSpec));
|
||||||
|
|||||||
Reference in New Issue
Block a user