The splash stops sounding before it ends, so listen earlier
The check asked whether music was still playing four seconds in, and the score it listens to ends its every voice on a rest - twelve ticks of silence that hold the logo up while the voices decay. So it was measuring exactly the quiet the score asks for and calling a perfect tune a failure. Three seconds instead, which is still twice the second and a half the silent path holds the logo for, and which is what the check is actually about: that this is the tune and not the hold. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
f351ee8844
commit
4e61158b11
+11
-6
@@ -940,9 +940,14 @@ open('$BUILD/still.pad','wb').write(b'\x00' * 20000)"
|
||||
--disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \
|
||||
"$BUILD/cosmos.bin" > "$BUILD/splash.out" 2>&1 || true
|
||||
|
||||
# The tune is six seconds of ticks. What is checked is that music is still playing well
|
||||
# after a splash that failed to load would have given up: the silent path holds the logo
|
||||
# for ninety frames, a second and a half, and then the game starts.
|
||||
# What is checked is that music is still playing well after a splash that failed to load
|
||||
# would have given up: the silent path holds the logo for ninety frames, a second and a
|
||||
# half, and then the game starts. So the late window is at three seconds, twice that.
|
||||
#
|
||||
# NOT LATER, because the tune stops sounding before it ends. Its last sequence on every
|
||||
# voice is a rest, which is what holds the logo up while the voices decay - so a window
|
||||
# past three and three quarter seconds is measuring the silence the score asks for and
|
||||
# would fail on a tune that played perfectly.
|
||||
read -r EARLY LATE <<EOT
|
||||
$(python3 - "$BUILD/splash.raw" <<'PY2'
|
||||
import struct, sys
|
||||
@@ -955,13 +960,13 @@ v = struct.unpack("<%dh" % n, d)
|
||||
def rms(a, b):
|
||||
w = v[a:b]
|
||||
return int((sum(x*x for x in w) / len(w)) ** 0.5) if w else 0
|
||||
print("%d %d" % (rms(48000, 96000), rms(192000, 240000)))
|
||||
print("%d %d" % (rms(48000, 96000), rms(144000, 168000)))
|
||||
PY2
|
||||
)
|
||||
EOT
|
||||
[ "${EARLY:-0}" -gt 500 ] && [ "${LATE:-0}" -gt 500 ] \
|
||||
&& result ok "a game plays its own music" "still sounding at four seconds, so it is the tune and not the silent hold" \
|
||||
|| result no "a game plays its own music" "RMS was $EARLY at one second and $LATE at four"
|
||||
&& result ok "a game plays its own music" "still sounding at three seconds, so it is the tune and not the silent hold" \
|
||||
|| result no "a game plays its own music" "RMS was $EARLY at one second and $LATE at three"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user