js_sound.js: fix sound level default for underrunning case (#11317)

This commit is contained in:
holub 2023-07-24 20:38:18 -04:00 committed by GitHub
parent d7551fdb69
commit c2a516abd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -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",

View File

@ -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,