18 Commits
Author SHA1 Message Date
Thomas MartinandClaude Opus 5.5 37abf45ccb libsd: an effect work area clear takes its SPU2 DMA time, also for ready-completion hosts
sceSdCleanEffectWorkArea reported its end after the transfer latency alone,
and a host that delivers audio completions at once (VP2S) ran it immediately.
VP2's reverb change (Csm export 8) clears core 0, then core 1, then releases
its lock; the EE asks (Csi RPC 0x1c) about two frames later whether the change
is still running and sends it again when it is not. With a clear that takes no
time it was never running: the castle-hall event of chapter 2 waited forever.

The clear's end now comes after the area's DMA time (16 IOP cycles per
halfword: mode 7 is 0x18040 bytes, about 21 ms per core) through a new
LibsdHost::interruptCallAfterWork, which ready-completion hosts honour (its
default forwards to interruptCall). Test: the end's delay and its route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:29:51 +01:00
Thomas MartinandClaude Opus 5.5 eb05b04ca0 SPU2 output IRQ: the mix stops at it, its handler 32 samples on
A sample-clocked timer on the output write-back (Harmonix's softFX refills
core 0's input area on it) was answered only after the whole mix of a
frame, so its refills landed anywhere in the half being played: stale
halves replayed, a crackle and a slowed-down sound. The native IRX host's
mix now stops where the output reaches an enabled IRQ address
(Mixer::nextOutputIrqCycle), and the SPU2 interrupt's handler runs 32
samples later (Libsd::kIrqResponse): the IOP's response and its driver's
work, which take no time here. Run at once, softFX's transfer landed 2
samples before the half it refills had played.

Amplitude's tutorial narration: 265 clicks in 65 s before, 7 after; the
song select's previews likewise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-27 19:16:51 +01:00
Thomas MartinandClaude Opus 5.5 ef902f605a libmpeg: the SDK's demux (sdkDemux), picturesAhead; PAL console; block transfer status ahead
- MpegOptions::picturesAhead (was kPicturesAhead, 8): how far the demux reads ahead of the game. Shinobido's first
  audio packet comes 14 pictures into the stream and its player waits for 0x6000 bytes of it.
- MpegOptions::sdkDemux: sceMpegDemuxPssRing as the SDK runs it. Each packet's callback runs before the demux goes
  on (the calling thread waits for it), and a 0 from the sound callback ends the call before that packet, which the
  next call gives again; only whole packets are taken. Shinobido's PCM callback refuses a packet when its ring is
  full: with the queued callbacks a refused packet was lost, and the sound after an odd-sized one (4073 bytes) was
  read a byte off (noise from 28 s into its intro). A video callback's 0 is not waited for: the decoder takes the
  video from the demux and the game's own IPU input is never drained. Off by default (TMB unchanged).
- Libraries::palConsole: sceGsResetGraph's video mode 0 (the console's own standard) at 50 Hz on a PAL console.
- CompiledLibraries::useBlockTransStatusAhead: sceSdBlockTransStatus one 1 KB block ahead of the sample playing, as
  the SPU2's input DMA reports it (a driver keeping its ring full by it). Off by default (TMB's logged answers kept).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 18:30:07 +01:00
boubou666 66929cadd0 Merge pull request #127 from TheBozos/shinobido/setupthread-getstat
Kernel: SetupThread's stack -1; libcdvd: sceGetstat; libsd: VoiceTrans alignment
2026-11-23 16:38:45 +01:00
Thomas MartinandClaude Opus 5.5 1672fc20e2 libsd: sceSdVoiceTrans's SPU address in 16-byte units
The SPU2's transfer start address is in units of 8 halfwords, as a voice's
start and loop are (the mixer keeps those 16-byte aligned). Shinobido's sound
driver allocates its music buffers down from the last byte of sound memory
(0x1fffff - 0x28000 = 0x1d7fff) and passes that address to sceSdVoiceTrans
and to the voice's SSA: written at the exact byte, every ADPCM block was
decoded 15 bytes off its start, and the title music came out as noise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 16:35:25 +01:00
Thomas MartinandClaude Opus 5.5 3b7973008b Native SPU2 interrupt; IOP sceSifCheckStatRpc and sceSifSetDChain
- Mixer: a core's IRQ address and enable (setIrqAddress / setIrqEnabled).
  A voice reading the 16-byte block that holds the address (a block
  decoded, a key on) or a transfer writing over it calls the IRQ
  callback once. The core then stays disabled until it is enabled again,
  as the SPU2's IRQ flag is cleared. Both are saved with the mixer's
  state.
- libsd: SD_A_IRQA (0x1F00) and SD_CORE_IRQ_ENABLE (0x4) drive the mixer.
  sceSdSetSpu2IntrHandler (27) keeps its handler, which the interrupt
  calls as handler(1 << core, argument) through the host's interrupt
  calls, like the transfer handlers. It was a no-op before.
- IRX host: sifcmd 18 (sceSifCheckStatRpc) answers 0, since IOP calls to
  EE services complete within sceSifCallRpc. sifman 6 (sceSifSetDChain)
  does nothing, as no chain mode needs arming.

Capcom's SNDDRVCD (Onimusha: Warlords) plays its voice streams (ADS)
through the SPU2 interrupt and reports a stream busy until it ends. Its
room events wait for that, so the first room's opening never started.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 16:31:28 +01:00
Thomas MartinandClaude Opus 5.5 f550fb1487 libsd: VOLX follows a voice's volume sweep
VOLXL / VOLXR now report the current volume: the volume's level, where a
sweep has brought it (Mixer::currentVolume, the Volume level the mixer
already ticks per sample), scaled by ENVX. Before, the voice's setting
was used, and a sweeping volume (bit 15) counted as full.

Capcom's SNDDRVCD (Onimusha: Warlords) stops a movie's PCM voice by
setting its volume to a decreasing exponential sweep (0xe010). It then
polls VOLX in an RPC handler until it reaches 0. With the setting it
never did: "native RPC handler made no progress" when a movie is
skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:55:18 +01:00
Thomas MartinandClaude Opus 5.5 575db8fdce Native IRX host: sysclib memmove and strrchr; libsd VOLX follows the envelope
- compiled_libraries: sysclib 13 (memmove) shares memcpy's overlap-safe copy;
  sysclib 32 (strrchr) returns the last occurrence or 0. Capcom's SNDDRVCD
  (Onimusha: Warlords) imports both.
- libsd: VOLXL / VOLXR report the voice's current volume (its volume scaled
  by ENVX, a sweeping volume counting as full), as the SPU2 does, instead of
  the volume as set. SNDDRVCD releases a voice and polls VOLX until it
  reaches 0; with the set volume it never did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:29:29 +01:00
boubou666 61d939f4eb Merge pull request #84 from TheBozos/codex/vp2s-libsd-clean-effect
Report sceSdCleanEffectWorkArea's end as its channel's transfer interrupt
2026-11-18 01:36:31 +01:00
ArzarothandClaude Opus 5.5 c32a7690e1 [ffop/sdinit-mix] fix(audio): sceSdInit puts every voice in both cores' dry and wet mixes
The SDK's sceSdInit writes VMIXL, VMIXEL, VMIXR and VMIXER to 0xFFFFFF on
both cores. The native init left them at 0, so a driver that keys a voice on
without writing its own VMIX bits (Fighting for One Piece's STRADPCM, the
background music) was never heard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 05:39:59 +01:00
Thomas MartinandClaude Opus 5.5 a2b2d133c0 Report sceSdCleanEffectWorkArea's end as its channel's transfer interrupt
libsd export 31 (sceSdCleanEffectWorkArea) starts the effect-area clear on
a DMA channel and returns; its end arrives as that channel's transfer
interrupt, like a voice transfer's. The native provider treated it like
export 25 (the blocking sceSdClearEffectWorkArea): it cleared the area but
raised no interrupt.

VP2's Csm changes reverb by clearing core 0, then core 1 from the channel 1
interrupt, then releasing its busy flag from the next one. Without the
interrupt the chain stopped after its first step: Csd kept its SPU transfer
lock, no later voice bank was uploaded and the town dialogue waited for its
voice line forever.

Export 25 is unchanged. The audio test checks that 25 queues no interrupt
and that 31 queues channel 1's handler with its argument and the transfer
delay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-10 13:16:31 +01:00
ArzarothandClaude Opus 5.5 7bb981c32f [sc3/irx-sound] Merge main (compiled IRX host, port stream, kernel calls by number)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:22:37 +01:00
ArzarothandClaude Opus 5.5 6becb20afe [norrath/irx-sdrdrv] fix(libsd): effect mode calls as the disc's LIBSD does them
sceSdSetEffectMode zeroes delay, feedback and depth and returns -100 for a bad
mode; sceSdSetEffectModeParams returns -100 unless its mode is the current
one and sets delay and feedback only in modes 7 and 8. The earlier version
came from the API; this is read from LIBSD.IRX's code (SC3's finding, checked).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 22:52:54 +01:00
ArzarothandClaude Opus 5.5 61860f6779 [sc3/irx-sound] feat(libsd): sceSdNote2Pitch, sceSdPitch2Note, GetTransIntrHandlerArgument and StopTrans natively
Exports 13, 14, 28 and 30, so a module needs no LIBSD image at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 22:09:14 +01:00
ArzarothandClaude Opus 5.5 7fe36c4988 [sc3/irx-sound] feat(libsd): each signalled input half answered in turn, the host's mix stops at each half
A 4 KiB sceSdBlockTrans ring: a long clock step no longer plays a half before its handler
refilled it, and a status read after the input moved on still names the half to refill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 22:09:14 +01:00
ArzarothandClaude Opus 5.5 ff88d7aa3d [con/irx-sdrdrv] feat(libsd): sceSdSetEffectMode (32) and sceSdSetEffectModeParams (33)
SDRDRV sets CoN's reverb with them right after cleaning the work area.
Agreed with SC3: CoN takes 31-33, SC3 keeps 13, 14, 28 and 30.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 20:53:31 +01:00
ArzarothandClaude Opus 5.5 6bb6d46901 [con/irx-sdrdrv] feat(libsd): sceSdCleanEffectWorkArea (31) natively
SDRDRV cleans the reverb work area during CoN's play; the native clear is
immediate, as for sceSdClearEffectWorkArea (25).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 20:51:58 +01:00
Thomas MartinandClaude Opus 5.5 d8bec0fdf6 Audio: the native mixer and libsd move from the fork (PLAN.md section 7)
runtime/audio (bozo_audio): the team's own mixer (48 voices, ADPCM, ADSR,
volume sweeps, reverb presets, the sound data input, IOP-clocked mode) and
libsd at its API, from the fork's native_mixer.cpp and native_libsd.cpp
(every line by boubou666 / thomas.epitech). The fork types are replaced:
no singleton, no IOP Env; libsd takes its arguments and a LibsdHost (the
IOP clock, its RAM, interrupt calls). Not wired into bozo-run.

bozo-audio-tests: ENVX after KeyOn, ends with and without repeat, the
release after KeyOff, ENDX, the 768-cycle sample clock and its 16384 cap,
libsd's entries and batches, and a fixed scenario (mixer_scenario.h)
whose digests (samples, ENVX, ENDX, NAX) are the fork mixer's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 23:28:48 +01:00