psxsdk

cdda

CD audio: tracks of music recorded on the disc after the program, played by the drive while the program goes on, with a level meter of what the SPU is mixing.

Controls

Left and right choose a track. Cross plays from it to the last, triangle round and round, and circle stops.

A port of the SCEE tutorial's chapter 3, example 2 (docs/manuals/tutorial-cd.md), which played the tracks of whatever music CD was in the drive: the Net Yaroze could only read its own boot disc, so a program's own music had to come from elsewhere. A disc built here can carry its own, so the tracks are the program's: three short ones that gen writes, declared with disc.Track, which records each as a track of CD audio after the data track and tells the program its number.

CD audio costs the program nothing: the drive reads it and sends it straight to the SPU, which mixes it with whatever the program plays itself, as SsSetSerialAttr and SsSetSerialVol set up. CdPlay plays a list of tracks from one of them on, once or round and round, and says which is playing. Sound from the disc is CD quality, 44.1 kHz stereo, and takes 176 KB of disc a second, which is why games kept their music on it and their sound effects in the SPU's memory.

Differences from the tutorial: the tracks are on the program's own disc, cross plays them all in turn and triangle round and round, where the tutorial played one at a time, and the program shows which is playing.

Source on GitHub