Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module xa

Module xa 

Source
Expand description

XA-ADPCM music: stream one channel of an interleaved XA file through the drive’s own decoder to the SPU’s CD input.

The encoder side is psx-audio-cook xa-encode; docs/XA-MUSIC.md has the workflow. A song file holds several songs as interleaved channels (every fourth sector for four 37.8 kHz stereo songs at single speed). With XA-ADPCM and the file/channel filter switched on, the drive hands the sectors of the chosen channel to its decoder and drops the rest; the CPU never sees the audio.

§The drive is busy while music plays

Music is a read: the drive streams the file continuously, so the CPU cannot read data from the disc meanwhile, not even at the same time at the same speed (the laser follows the file, not the data). Load first, then start the song, or stop it for the load and start it again afterwards (it restarts from the top). Streaming data and music together needs the data interleaved into the filler slots of the song file, which this player does not do.

§Polling

The player is poll-driven like super::audio: call Player::poll about once per frame. It asks the drive where the head is, and when the head reaches the end of the song file it either restarts the file (looping) or pauses the drive. A restart is a seek, so a loop has an audible gap whose length is the drive’s seek time; authoring the loop point into a quiet passage hides it.

Structs§

File
An interleaved XA file on the disc.
Player
Plays XA-ADPCM songs. Owns the CD token: nothing else drives the controller while a player exists.
Song
One channel of an File.

Enums§

DriveSpeed
Speed the song file was interleaved for (psx-audio-cook xa-encode --speed).
Error
The step of starting a song that the drive refused.
Event
What Player::poll saw.

Constants§

COMMAND_SPINS
Per-command response spin budget: generous, the drive answers far sooner.