7 Commits
Author SHA1 Message Date
Thomas MartinandClaude Opus 5.5 7b168badc0 Free mode in real time: the IOP's clock held to the host's, so a match start's load no longer silences the sound
At a match start the load's disc reads are charged a PS2 drive's time: the EE gained ~2.8 s in 0.24 s of the PC's.
The engine made those 2.8 s at once (mostly dropped), then TMB's frame pacer held the EE back to pay the debt (EE/PC
0.48 for 5 s), so the sound was made at half speed: 270 underruns, ~4 s of silence in bursts.

- snd989::Engine::lead: added to P = (EE - reset) / 8 + G (0 unless set).
- SndDriver::realTimeClock / syncClock: before each command, write or bring-up, P is kept within -4 / +25 ms of a
  line on the host's steady clock (never below the engine's clock); more than 32 ms behind, the line moves instead
  (the sound resumes, no skip).
- FreeHost (real time with sound): a watcher thread raises a flag when no frame ended for 25 ms; the watchdog's next
  look on the game thread, between out-calls (never inside a 989SND command or SIF call), brings the engine up and
  hands the samples to onAudio. The next frame end takes the rest; nothing is made twice.
- libraries.md 15.13e.

tmb --audio-stats, ch1p to frame 6700: 9 underruns (54 ms) against 625 (5.9 s); dropped 1,899 frames (boot) against
12,906. Pinned boot and match1p MATCH; free 1P and story records byte-identical (not real time: unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 23:44:24 +01:00
Thomas MartinandClaude Opus 5.5 79fb362f37 989SND: snd_CloseVAGStreaming (0x35) frees the streams' IOP block and stops them (stage-level20 #26677069: Warhawk's Rooftop's first bank lands at 0x7fe60, where InitVAGStreamingEx's block was); stage-level20 pinned matches on every frame
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 20:41:36 +01:00
Thomas MartinandClaude Opus 5.5 67ac338375 Phase 4 M3: sound. 989SND's engine plays what only the output hears (StartSoundSystem's libsd setup, SetMasterVolume's voices and core 1's master volume, the reverb's attributes, depth and 10-tick enable, the movie's sound on the sound data input with its BVOL, from 989SND.IRX); the movie's PCM reaches its IOP RAM through sceSifSetDma; the engine and mixer brought up to each frame's end on the EE clock (the records' sound field, FreeHost::onAudio), long gaps mixed in steps; free mode's own IOP timing (Timing::freeRun); the tick's phase pinned from boot's sound records; bozo_app's AudioDevice (SDL3 stream, 48 kHz, frequency ratio following the queue); WavWriter; bozo-run reports the sound records (BOZO_WAV)
boot and match1p --pinned still MATCH; sound records equal on 1,659 / 3,000 and 3,926 / 16,000 frames (silence, both movies, the title's first music frames). Notes: docs/phase4-m3-notes.md, libraries.md 15.13d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 14:50:21 +01:00
Thomas MartinandClaude Opus 5.5 875d55361d 989SND native: snd989::Engine, 989SND's behaviour on bozo_audio's mixer (voices and stealing, the tick and its end counter, programs, MIDI, VAG streams, its sound memory allocator) on the IOP clock of iop-timing.md with a fitted cost model; --snd-log-replies off|on|<ids>, off the default: boot and match1p MATCH with every 989SND reply native (libraries.md 15.13c)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 02:43:46 +01:00
Thomas MartinandClaude Opus 5.5 6ac98c2501 Docs: 989SND's own rules from 989SND.IRX (libraries.md 15.12, 15.13)
Read from the module on the disc: the RPC reply buffer (the "last result" rule),
the play dispatch by sound type, the type 2 single instance, the handler pools
and generations, the 240 Hz tick, KeyOn/KeyOff once a tick, and the voice end:
256 silent ticks after the mixer reports ENVX 0 (the +1.166 s of the lifetime
model: 989SND's pitch 1216 for 0xe8310/3, 1.849 s + 255 ticks = 2.912-2.920 s,
against the log's 2.9002-2.9169 s). sceSdNote2Pitch from LIBSD.IRX. What stays
open is the fork's mixer under libsd (ENVX at KeyOn, at a sample's end, release
times), which decides voice stealing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 23:12:28 +01:00
Thomas MartinandClaude Opus 5.5 d077b83934 989SND sound timing: the lifetime model, --snd-log-replies, what remains
The native lifetime of a one-shot sound: its longest tone in the note's key
range, the sample at its pitch and the play's pitch bend (the tone's bend
range), plus 1.166 s (settled on match1p's two natural ends). It now gives
every pinned liveness decision of match1p but the 6 voice steals (570 wrong
before); the handler model gives 372 of the 778 pinned handles (302 before).

bozo-run --snd-log-replies off: the driver answers every reply from its
models in a pinned run. Boot matches fully native that way; match1p does not
(first divergence #17541429: the shell's slot generations), so the default
stays on. libraries.md 15.5, 15.8, 15.10, 15.11: the rules found, the
records that settled them, and what is still unexplained.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 21:56:20 +01:00
Thomas MartinandClaude Opus 5.5 cc6d6ead9d Native libraries: the SIF layer and the 989SND sound driver (phase 3, batch B3)
SIF (sif): RPC bind and call with the reference's client and server-data words,
CheckStat, the SIF registers, module loading (ids only), reboot and sync, the
IOP heap (16-byte blocks, first fit, from 0x7fe60), SIF DMA ids.

989SND (snd), the IOP side of RPC service 0x123456: command batches (0x4a) and
direct calls decoded, the reply (-1, results, -1, a command with no result
leaving the driver's last one), banks loaded by sector from the disc image and
placed in IOP memory as the reference did, master volumes, reverb, stops,
streams, the movie buffer, handles and their liveness where it is certain. What
the reference's IOP time decided (one-shot sounds' lifetimes, the handler slots
they free) a pinned run takes from the log's reply (Function::logReply,
Pin::logWord); free mode has native models. The driver follows the 989SND calls
of port overrides answered from the log, and sends what should play to a
SoundSink for the future mixer.

boot and match1p --pinned: every frame and record, 0 divergences; sif 7,212 /
245,108 calls native; 989SND 3,591 / 119,225 replies native, 1 / 3,294 pinned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 20:47:26 +01:00