sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
Sounds

ADPCM sounds kept in SPU2 memory. More...

Functions

int audio_sound_load_adpcm (const audio_sound_desc_t *desc, audio_sound_t *sound_out)
int audio_sound_load_apcm (const void *file_data, int32_t file_size_bytes, audio_sound_t *sound_out)
int audio_sound_free (audio_sound_t sound)
int audio_sound_free_all (void)

Detailed Description

ADPCM sounds kept in SPU2 memory.

A sound is loaded once and identified by a handle. It plays on a channel, and one sound can play on several channels at once.

Function Documentation

◆ audio_sound_free()

int audio_sound_free ( audio_sound_t sound)

Stops the sound on every channel and frees its SPU2 memory. The handle is invalid afterwards.

Returns
AUDIO_OK, or -AUDIO_ERR_INVALID_ARGUMENT for an unknown or already freed handle.

◆ audio_sound_free_all()

int audio_sound_free_all ( void )

Stops all channels and frees every sound. Channel volume, pan and pitch are kept.

Returns
AUDIO_OK, also with no sounds loaded.

◆ audio_sound_load_adpcm()

int audio_sound_load_adpcm ( const audio_sound_desc_t * desc,
audio_sound_t * sound_out )

Uploads raw PS-ADPCM to SPU2 memory. The data is copied; the buffer can be freed on return.

Parameters
descThe data and its format.
[out]sound_outReceives the handle, or AUDIO_SOUND_INVALID on failure.
Returns
AUDIO_OK, -AUDIO_ERR_INVALID_ARGUMENT, -AUDIO_ERR_OUT_OF_SPU_MEMORY, -AUDIO_ERR_OUT_OF_MEMORY, -AUDIO_ERR_RPC_FAILED or -AUDIO_ERR_NOT_INITIALIZED.
Note
Blocks until the upload finishes. Loop flags in the data are rewritten according to desc->loops.

◆ audio_sound_load_apcm()

int audio_sound_load_apcm ( const void * file_data,
int32_t file_size_bytes,
audio_sound_t * sound_out )

Uploads the image of an APCM file (the .adp files Open PS2 Loader uses). The sample rate is derived from the header pitch field (44100 Hz when the field is absent or out of range); the channel count and the loop flag come from the header too. A looping sound ends its loop before the last, silent block of each channel.

Parameters
file_dataThe whole file.
file_size_bytesIts size.
[out]sound_outReceives the handle, or AUDIO_SOUND_INVALID on failure.
Returns
As audio_sound_load_adpcm(), with -AUDIO_ERR_BAD_SOUND_DATA for a file that is not a valid APCM image.