From c2a516abd4915ed79771a91a262264e6a689ccdf Mon Sep 17 00:00:00 2001 From: holub Date: Mon, 24 Jul 2023 20:38:18 -0400 Subject: js_sound.js: fix sound level default for underrunning case (#11317) --- scripts/src/3rdparty.lua | 8 ++++++++ src/osd/modules/sound/js_sound.js | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 6731f6c8a10..e7a7010acb1 100755 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -1180,6 +1180,14 @@ project "bx" configuration { } + if _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="linux" or _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="asmjs" then + if _OPTIONS["gcc"]~=nil and (string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "asmjs")) then + buildoptions_cpp { + "-Wno-unused-private-field", + } + end + end + includedirs { MAME_DIR .. "3rdparty/bx/include", MAME_DIR .. "3rdparty/bx/3rdparty", diff --git a/src/osd/modules/sound/js_sound.js b/src/osd/modules/sound/js_sound.js index 5cbcc380c1b..571a5227f2b 100644 --- a/src/osd/modules/sound/js_sound.js +++ b/src/osd/modules/sound/js_sound.js @@ -173,10 +173,11 @@ function tick (event) { start = 0; } } - //Pad with silence if we're underrunning: + //Pad with latest if we're underrunning: + var idx = (index == 0 ? bufferSize : index) - 1; while (index < 4096) { - buffers[0][index] = 0; - buffers[1][index++] = 0; + buffers[0][index] = buffers[0][idx]; + buffers[1][index++] = buffers[1][idx]; } //Deep inside the bowels of vendors bugs, //we're using watchdog for a firefox bug, -- cgit v1.2.3