|
sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
|
audio_sound_load_apcm() loads the .adp files that Open PS2 Loader uses. A file has a 16-byte header followed by PS-ADPCM blocks of 16 bytes (28 samples each).
| Offset | Size | Field |
|---|---|---|
| 0x00 | 4 | APCM |
| 0x04 | 1 | version, 1 |
| 0x05 | 1 | channels, 1 or 2 |
| 0x06 | 1 | loop, 1 to play until stopped |
| 0x07 | 1 | reserved |
| 0x08 | 4 | pitch value written by the encoder (little endian) |
| 0x0C | 4 | sample frames per channel (little endian) |
| 0x10 | ADPCM blocks. Stereo: every left block, then every right block. |
The header has no sample rate; the library plays these files at 44100 Hz. Each channel's run of blocks ends with one extra block that the encoder flags to repeat itself. The library rewrites the loop flags when it uploads a sound: a sound that plays once ends at the last block of each run, and a looping sound repeats each run from its first block.
audio_sound_load_adpcm() takes the same block data without the header, with the rate, channel count and loop setting passed in a audio_sound_desc_t.