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

Functions

int audsrv_init (void)
int audsrv_quit (void)
int audsrv_set_format (struct audsrv_fmt_t *fmt)
int audsrv_wait_audio (int bytes)
int audsrv_set_volume (int volume)
int audsrv_play_audio (const char *chunk, int bytes)
int audsrv_stop_audio (void)
int audsrv_get_error (void)
const char * audsrv_get_error_string (void)
int audsrv_available (void)
int audsrv_queued (void)
int audsrv_on_fillbuf (int amount, audsrv_callback_t cb, void *arg)

Detailed Description

Function Documentation

◆ audsrv_available()

int audsrv_available ( void )
Returns
Bytes of stream space free, or a negative error.

◆ audsrv_get_error()

int audsrv_get_error ( void )
Returns
The last error code raised by any call, as a positive value; 0 if none.

◆ audsrv_get_error_string()

const char * audsrv_get_error_string ( void )
Returns
Text for audsrv_get_error().

◆ audsrv_init()

int audsrv_init ( void )

Starts the audio system. Calling it again is not an error.

Returns
0 on success, or a negative error.

◆ audsrv_on_fillbuf()

int audsrv_on_fillbuf ( int amount,
audsrv_callback_t cb,
void * arg )

Calls cb(arg) when at least amount bytes of stream space are free, once each time the queue drains to that point. A NULL cb unregisters. The stream must be started. Returns 0, or -AUDSRV_ERR_ARGS if amount is larger than the stream buffer.

Parameters
amountFree space that triggers the call.
cbThe function, or NULL.
argPassed to cb.
Returns
0 or a negative error.

◆ audsrv_play_audio()

int audsrv_play_audio ( const char * chunk,
int bytes )

Queues audio in the stream format, waiting for space as needed so that all of it is accepted.

Parameters
chunkThe data.
bytesIts size.
Returns
The bytes queued, or a negative error when none were.

◆ audsrv_queued()

int audsrv_queued ( void )
Returns
Bytes queued in the stream, or a negative error.

◆ audsrv_quit()

int audsrv_quit ( void )

Stops the audio system.

Returns
0.

◆ audsrv_set_format()

int audsrv_set_format ( struct audsrv_fmt_t * fmt)

Sets the stream format and restarts the stream. The volume is kept.

Parameters
fmtThe format.
Returns
0 on success, or a negative error.

◆ audsrv_set_volume()

int audsrv_set_volume ( int volume)

Sets the stream volume. The volume of sample channels is separate.

Parameters
volumePercent, 0 to 100.
Returns
0 on success, or a negative error.

◆ audsrv_stop_audio()

int audsrv_stop_audio ( void )

Stops the stream and discards queued data. The stream can be used again without audsrv_set_format().

Returns
0 on success, or a negative error.

◆ audsrv_wait_audio()

int audsrv_wait_audio ( int bytes)

Blocks until bytes can be queued.

Parameters
bytesSize of the next chunk.
Returns
0, or a negative error (also when bytes is larger than the stream buffer).