|
PS2SDK
PS2 Homebrew Libraries
|
Include dependency graph for audsrv.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | AUDSRV_INIT 0x0000 |
| #define | AUDSRV_QUIT 0x0001 |
| #define | AUDSRV_FORMAT_OK 0x0002 |
| #define | AUDSRV_SET_FORMAT 0x0003 |
| #define | AUDSRV_PLAY_AUDIO 0x0004 |
| #define | AUDSRV_WAIT_AUDIO 0x0005 |
| #define | AUDSRV_STOP_AUDIO 0x0006 |
| #define | AUDSRV_SET_VOLUME 0x0007 |
| #define | AUDSRV_SET_THRESHOLD 0x0008 |
| #define | AUDSRV_PLAY_CD 0x0009 |
| #define | AUDSRV_STOP_CD 0x000a |
| #define | AUDSRV_GET_CDPOS 0x000b |
| #define | AUDSRV_GET_TRACKPOS 0x000c |
| #define | AUDSRV_GET_NUMTRACKS 0x000d |
| #define | AUDSRV_GET_TRACKOFFSET 0x000e |
| #define | AUDSRV_PAUSE_CD 0x0011 |
| #define | AUDSRV_RESUME_CD 0x0012 |
| #define | AUDSRV_PLAY_SECTORS 0x0013 |
| #define | AUDSRV_GET_CD_STATUS 0x0014 |
| #define | AUDSRV_GET_CD_TYPE 0x0015 |
| #define | AUDSRV_INIT_ADPCM 0x0016 |
| #define | AUDSRV_LOAD_ADPCM 0x0017 |
| #define | AUDSRV_PLAY_ADPCM 0x0018 |
| #define | AUDSRV_SET_ADPCM_VOL 0x0019 |
| #define | AUDSRV_FREE_ADPCM 0x001c |
| #define | AUDSRV_IS_ADPCM_PLAYING 0x001d |
| #define | AUDSRV_AVAILABLE 0x001a |
| #define | AUDSRV_QUEUED 0x001b |
| #define | AUDSRV_FILLBUF_CALLBACK 0x0001 |
| #define | AUDSRV_CDDA_CALLBACK 0x0002 |
| #define | AUDSRV_ERR_NOERROR 0x0000 |
| #define | AUDSRV_ERR_NOT_INITIALIZED 0x0001 |
| #define | AUDSRV_ERR_RPC_FAILED 0x0002 |
| #define | AUDSRV_ERR_FORMAT_NOT_SUPPORTED 0x0003 |
| #define | AUDSRV_ERR_OUT_OF_MEMORY 0x0004 |
| #define | AUDSRV_ERR_ARGS 0x0005 |
| #define | AUDSRV_ERR_NO_DISC 0x0006 |
| #define | AUDSRV_ERR_NO_MORE_CHANNELS 0x0007 |
| #define | audsrv_play_adpcm(id) audsrv_ch_play_adpcm(-1, id) |
| #define | audsrv_IMPORTS_start DECLARE_IMPORT_TABLE(audsrv, 1, 4) |
| #define | audsrv_IMPORTS_end END_IMPORT_TABLE |
| #define | I_audsrv_init DECLARE_IMPORT( 4, audsrv_init) |
| #define | I_audsrv_quit DECLARE_IMPORT( 5, audsrv_quit) |
| #define | I_audsrv_format_ok DECLARE_IMPORT( 6, audsrv_format_ok) |
| #define | I_audsrv_set_format DECLARE_IMPORT( 7, audsrv_set_format) |
| #define | I_audsrv_wait_audio DECLARE_IMPORT( 8, audsrv_wait_audio) |
| #define | I_audsrv_play_audio DECLARE_IMPORT( 9, audsrv_play_audio) |
| #define | I_audsrv_stop_audio DECLARE_IMPORT(10, audsrv_stop_audio) |
| #define | I_audsrv_set_volume DECLARE_IMPORT(11, audsrv_set_volume) |
| #define | I_audsrv_play_cd DECLARE_IMPORT(12, audsrv_play_cd) |
| #define | I_audsrv_stop_cd DECLARE_IMPORT(13, audsrv_stop_cd) |
| #define | I_audsrv_set_threshold DECLARE_IMPORT(14, audsrv_set_threshold) |
| #define | I_audsrv_get_cdpos DECLARE_IMPORT(15, audsrv_get_cdpos) |
| #define | I_audsrv_get_trackpos DECLARE_IMPORT(16, audsrv_get_trackpos) |
| #define | I_audsrv_get_numtracks DECLARE_IMPORT(17, audsrv_get_numtracks) |
| #define | I_audsrv_get_track_offset DECLARE_IMPORT(18, audsrv_get_track_offset) |
| #define | I_audsrv_cd_pause DECLARE_IMPORT(19, audsrv_cd_pause) |
| #define | I_audsrv_cd_resume DECLARE_IMPORT(20, audsrv_cd_resume) |
| #define | I_audsrv_cd_play_sectors DECLARE_IMPORT(21, audsrv_cd_play_sectors) |
| #define | I_audsrv_get_cd_status DECLARE_IMPORT(22, audsrv_get_cd_status) |
| #define | I_audsrv_get_cd_type DECLARE_IMPORT(23, audsrv_get_cd_type) |
| #define | I_audsrv_adpcm_init DECLARE_IMPORT(24, audsrv_adpcm_init) |
| #define | I_audsrv_load_adpcm DECLARE_IMPORT(25, audsrv_load_adpcm) |
| #define | I_audsrv_play_adpcm I_audsrv_ch_play_adpcm |
| #define | I_audsrv_ch_play_adpcm DECLARE_IMPORT(26, audsrv_ch_play_adpcm) |
| #define | I_audsrv_adpcm_set_volume DECLARE_IMPORT(27, audsrv_adpcm_set_volume) |
| #define | I_audsrv_available DECLARE_IMPORT(28, audsrv_available) |
| #define | I_audsrv_queued DECLARE_IMPORT(29, audsrv_queued) |
Functions | |
| int | audsrv_init () |
| int | audsrv_quit () |
| int | audsrv_format_ok (int freq, int bits, int channels) |
| int | audsrv_set_format (int freq, int bits, int channels) |
| int | audsrv_wait_audio (int buflen) |
| int | audsrv_play_audio (const char *buf, int buflen) |
| int | audsrv_stop_audio () |
| int | audsrv_set_volume (int vol) |
| int | audsrv_available () |
| int | audsrv_queued () |
| int | audsrv_play_cd (int track) |
| int | audsrv_stop_cd () |
| int | audsrv_set_threshold (int amount) |
| int | audsrv_get_cdpos () |
| int | audsrv_get_trackpos () |
| int | audsrv_get_numtracks () |
| int | audsrv_get_track_offset (int track) |
| int | audsrv_cd_pause () |
| int | audsrv_cd_resume () |
| int | audsrv_cd_play_sectors (int start, int end) |
| int | audsrv_get_cd_status () |
| int | audsrv_get_cd_type () |
| int | audsrv_adpcm_init () |
| int | audsrv_adpcm_set_volume (int ch, int voll, int volr) |
| void * | audsrv_load_adpcm (u32 *buffer, int size, int id) |
| int | audsrv_ch_play_adpcm (int ch, u32 id) |
| int | audsrv_is_adpcm_playing (int ch, u32 id) |
| int | free_sample (u32 id) |
audsrv IOP server
Definition in file audsrv.h.
| #define AUDSRV_INIT 0x0000 |
| int audsrv_init | ( | ) |
Initializes audsrv library
Initializes audsrv library
Definition at line 328 of file audsrv_rpc.c.
References initialized.
| int audsrv_quit | ( | ) |
Shutdowns audsrv
Definition at line 143 of file audsrv_rpc.c.
References audsrv_adpcm_init(), audsrv_stop_audio(), and audsrv_stop_cd().
| int audsrv_format_ok | ( | int | freq, |
| int | bits, | ||
| int | channels | ||
| ) |
Checks if the format noted by frequency and depth is supported
| freq | frequency in hz |
| bits | bits per sample (8, 16) |
| channels | channels |
Definition at line 156 of file audsrv.c.
References find_upsampler().
Referenced by audsrv_set_format().
| int audsrv_set_format | ( | int | freq, |
| int | bits, | ||
| int | channels | ||
| ) |
Configures audio stream
| freq | frequency in hz |
| bits | bits per sample (8, 16) |
| channels | number of channels |
This sets up audsrv to accept stream in this format and convert it to SPU2's native format if required. Note: it is possible to change the format at any point. You might want to stop audio prior to that, to prevent mismatched audio output.
Definition at line 178 of file audsrv.c.
References audsrv_format_ok().
| int audsrv_wait_audio | ( | int | buflen | ) |
Blocks until there is enough space to enqueue chunk
| bytes | size of chunk requested to be enqueued (in bytes) |
Blocks until there are enough space to store the upcoming chunk in audsrv's internal ring buffer.
Blocks until there is enough space to enqueue chunk
| buflen | size of chunk requested to be enqueued (in bytes) |
Blocks until there are enough space to store the upcoming chunk in audsrv's internal ring buffer.
Definition at line 178 of file audsrv_rpc.c.
References call_rpc_1(), and ringbuf_size.
| int audsrv_play_audio | ( | const char * | buf, |
| int | buflen | ||
| ) |
Uploads audio buffer to SPU
| chunk | audio buffer |
| bytes | size of chunk in bytes |
Plays an audio buffer; It will not interrupt a playing buffer, rather queue it up and play it as soon as possible without interfering with fluent streaming. The buffer and buflen are given in host format (i.e, 11025hz 8bit stereo.)
Uploads audio buffer to SPU
| buf | audio chunk |
| buflen | size of chunk in bytes |
Plays an audio buffer; It will not interrupt a playing buffer, rather queue it up and play it as soon as possible without interfering with fluent streaming. The buffer and buflen are given in host format (i.e, 11025hz 8bit stereo.)
Definition at line 254 of file audsrv_rpc.c.
References AUDSRV_ERR_NOERROR, and set_error().
| int audsrv_stop_audio | ( | ) |
Stops audio from playing.
Stops all audio playing
Mutes output and stops accepting audio blocks; also, clears callbacks.
Definition at line 292 of file audsrv_rpc.c.
References AUDSRV_ERR_NOERROR, call_rpc_1(), fillbuf_threshold, playing, and update_volume().
Referenced by audsrv_quit().
| int audsrv_set_volume | ( | int | vol | ) |
Sets output volume
| vol | volume in percentage |
Sets output volume
| vol | volume in SPU2 units [0 .. 0x3fff] |
Definition at line 183 of file audsrv_rpc.c.
References call_rpc_1(), MAX_VOLUME, and MIN_VOLUME.
| int audsrv_available | ( | ) |
Returns the number of bytes that can be queued
Returns the number of bytes that are available in the ring buffer. This is the total bytes that can be queued, without collision of the reading head with the writing head.
Returns the number of bytes that can be queued
Returns the number of bytes that are available in the ring buffer. This is the total bytes that can be queued, without collision of the reading head with the writing head.
Definition at line 549 of file audsrv_rpc.c.
References call_rpc_1(), readpos, ringbuf_size, and writepos.
| int audsrv_queued | ( | ) |
Returns the number of bytes already in queue
Returns the number of bytes that are already in the ring buffer.
Definition at line 554 of file audsrv_rpc.c.
References call_rpc_1(), readpos, ringbuf_size, and writepos.
| int audsrv_play_cd | ( | int | track | ) |
Starts playing the request track
| track | segment to play |
Plays CD audio track
| track | segment to play [1 .. 99] |
Definition at line 197 of file audsrv_rpc.c.
References AUDSRV_PLAY_CD, and call_rpc_1().
| int audsrv_stop_cd | ( | ) |
Stops CD from playing.
Stops CD play
Stops CD from being played; this has no effect on other music audsrv is currently playing
Definition at line 207 of file audsrv_rpc.c.
References audsrv_stop_cd_stream(), call_rpc_1(), and cdda_play_tid.
| int audsrv_get_cdpos | ( | ) |
Returns the current playing sector
CDDA type discs have sector size of 2352 bytes. There are 75 such sectors per second.
Returns the current sector being played
Definition at line 214 of file audsrv_rpc.c.
References call_rpc_1(), cd_playing, and cdda_pos.
| int audsrv_get_trackpos | ( | ) |
Returns the current playing sector, relative to track
There are 75 sectors a second. To translate this position to mm:ss:ff use the following: mm = sector / (75*60) ss = (sector / 75) % 60 ff = sector % 75
where ff is the frame number, 1/75th of a second.
Returns the current sector being played, relative to first sector in track
Definition at line 219 of file audsrv_rpc.c.
References call_rpc_1(), cd_playing, cdda_play_start, and cdda_pos.
| int audsrv_get_numtracks | ( | ) |
Returns the number of tracks available on the CD in tray
Definition at line 224 of file audsrv_rpc.c.
References call_rpc_1().
| int audsrv_get_track_offset | ( | int | track | ) |
Returns the first sector for the given track
| track | track index, must be between 1 and the trackcount |
Definition at line 229 of file audsrv_rpc.c.
References call_rpc_1().
| int audsrv_cd_pause | ( | ) |
Pauses CD playing
Definition at line 298 of file cdrom.c.
References AUDSRV_ERR_NOERROR, and cd_paused.
| int audsrv_cd_resume | ( | ) |
Resumes CD playing
Definition at line 307 of file cdrom.c.
References AUDSRV_ERR_NOERROR, and cd_paused.
| int audsrv_cd_play_sectors | ( | int | start, |
| int | end | ||
| ) |
Starts playing cdda sectors from disc
| start | first sector to play |
| end | stop playing at this sector |
Starts the cdda feeding thread at the given sector. Any previously set up playback is stopped. If a callback was set, it will NOT be called, as the thread is stopped abnormally.
| int audsrv_get_cd_status | ( | ) |
Returns the status of the CD tray (open, closed, seeking etc.)
Returns CD drive status
Definition at line 249 of file audsrv_rpc.c.
References call_rpc_1(), and sceCdStatus().
| int audsrv_get_cd_type | ( | ) |
Returns the type of disc currently in tray
Returns the type of disc in drive
Definition at line 244 of file audsrv_rpc.c.
References call_rpc_1().
| int audsrv_adpcm_init | ( | ) |
Initializes adpcm unit of audsrv
Frees up all memory taken by samples, and stops all voices from being played. This can be called multiple times
Initializes adpcm unit of audsrv
Definition at line 394 of file audsrv_rpc.c.
References AUDSRV_INIT_ADPCM, and call_rpc_1().
| int audsrv_adpcm_set_volume | ( | int | ch, |
| int | voll, | ||
| int | volr | ||
| ) |
Sets output volume for the specified voice channel.
| ch | Voice channel ID |
| voll | left volume in SPU2 units [0 .. 0x3fff] |
| volr | right volume in SPU2 units [0 .. 0x3fff] |
Definition at line 347 of file adpcm.c.
References MAX_VOLUME.
| void* audsrv_load_adpcm | ( | u32 * | buffer, |
| int | size, | ||
| int | id | ||
| ) |
| int audsrv_ch_play_adpcm | ( | int | ch, |
| u32 | id | ||
| ) |
Plays an adpcm sample already uploaded with audsrv_load_adpcm()
| ch | channel identifier. Specifies one of the 24 voice channel to play the ADPCM channel on. If set to an invalid channel ID, an unoccupied channel will be selected. |
| id | sample identifier, as specified in load() |
When ch is set to an invalid channel ID, the sample will be played in an unoccupied channel. If all 24 channels are used, then -AUDSRV_ERR_NO_MORE_CHANNELS is returned. When ch is set to a valid channel ID, -AUDSRV_ERR_NO_MORE_CHANNELS is returned if the channel is currently in use. Trying to play a sample which is unavailable will result in -AUDSRV_ERR_ARGS
Definition at line 277 of file adpcm.c.
References adpcm_loaded().
| int free_sample | ( | u32 | id | ) |
Remove an adpcm sample uploaded with audsrv_load_adpcm() from the list of loaded sounds
| id | sample identifier, as specified in load() |
SPU memory is freed only when there are no sounds in the list that where loaded after the ones that have been freed