ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
audsrv.h
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2005, ps2dev - http://www.ps2dev.org
7 # Licenced under GNU Library General Public License version 2
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #ifndef __AUDSRV_H__
17 #define __AUDSRV_H__
18 
19 #define AUDSRV_IRX 0x870884d
20 
22 #define MIN_VOLUME 0
23 
25 #define MAX_VOLUME 100
26 
28 #define AUDSRV_ERR_NOERROR 0x0000
29 #define AUDSRV_ERR_NOT_INITIALIZED 0x0001
30 #define AUDSRV_ERR_RPC_FAILED 0x0002
31 #define AUDSRV_ERR_FORMAT_NOT_SUPPORTED 0x0003
32 #define AUDSRV_ERR_OUT_OF_MEMORY 0x0004
33 #define AUDSRV_ERR_ARGS 0x0005
34 #define AUDSRV_ERR_NO_DISC 0x0006
35 #define AUDSRV_ERR_NO_MORE_CHANNELS 0x0007
36 
37 #define AUDSRV_ERR_FAILED_TO_LOAD_ADPCM 0x0010
38 #define AUDSRV_ERR_FAILED_TO_CREATE_SEMA 0x0011
39 
41 typedef struct audsrv_fmt_t
42 {
44  int freq;
46  int bits;
48  int channels;
49 } audsrv_fmt_t;
50 
52 typedef struct audsrv_adpcm_t
53 {
54  int pitch;
55  int loop;
56  int channels;
57  void *buffer;
58  int size;
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 typedef int (*audsrv_callback_t)(void *arg);
66 
70 int audsrv_init();
71 
75 int audsrv_quit();
76 
86 int audsrv_set_format(struct audsrv_fmt_t *fmt);
87 
95 int audsrv_wait_audio(int bytes);
96 
101 int audsrv_set_volume(int volume);
102 
113 int audsrv_play_audio(const char *chunk, int bytes);
114 
118 int audsrv_stop_audio();
119 
123 int audsrv_get_error();
124 
128 const char *audsrv_get_error_string();
129 
134 int audsrv_play_cd(int track);
135 
139 int audsrv_stop_cd();
140 
147 int audsrv_get_cdpos();
148 
160 int audsrv_get_trackpos();
161 
166 
171 int audsrv_get_track_offset(int track);
172 
178 int audsrv_pause_cd();
179 
185 int audsrv_resume_cd();
186 
192 int audsrv_play_sectors(int start, int end);
193 
198 
202 int audsrv_get_cd_type();
203 
211 int audsrv_on_fillbuf(int amount, audsrv_callback_t cb, void *arg);
212 
219 int audsrv_adpcm_init();
220 
226 int audsrv_adpcm_set_volume(int ch, int vol);
227 
234 int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size);
235 
246 int audsrv_ch_play_adpcm(int ch, audsrv_adpcm_t *adpcm);
247 #define audsrv_play_adpcm(adpcm) audsrv_ch_play_adpcm(-1, adpcm) //For backward-compatibility
248 
254 int audsrv_on_cdda_stop(audsrv_callback_t cb, void *arg);
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif /* __AUDSRV_H__ */
int audsrv_play_sectors(int start, int end)
Definition: audsrv_rpc.c:176
int audsrv_get_numtracks()
Definition: audsrv_rpc.c:198
const char * audsrv_get_error_string()
Definition: audsrv_rpc.c:438
int audsrv_get_error()
Definition: audsrv_rpc.c:66
int audsrv_resume_cd()
Definition: audsrv_rpc.c:213
int audsrv_init()
Definition: audsrv_rpc.c:296
int audsrv_pause_cd()
Definition: audsrv_rpc.c:208
int audsrv_get_cd_type()
Definition: audsrv_rpc.c:218
int audsrv_play_audio(const char *chunk, int bytes)
Definition: audsrv_rpc.c:228
int audsrv_on_cdda_stop(audsrv_callback_t cb, void *arg)
Definition: audsrv_rpc.c:464
int audsrv_adpcm_init()
Definition: audsrv_rpc.c:362
int audsrv_stop_audio()
Definition: audsrv_rpc.c:264
int audsrv_adpcm_set_volume(int ch, int vol)
Definition: audsrv_rpc.c:367
int audsrv_ch_play_adpcm(int ch, audsrv_adpcm_t *adpcm)
Definition: audsrv_rpc.c:432
int audsrv_play_cd(int track)
Definition: audsrv_rpc.c:171
int audsrv_get_trackpos()
Definition: audsrv_rpc.c:193
int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size)
Definition: audsrv_rpc.c:381
int audsrv_set_volume(int volume)
Definition: audsrv_rpc.c:157
int audsrv_get_cdpos()
Definition: audsrv_rpc.c:188
int(* audsrv_callback_t)(void *arg)
Definition: audsrv.h:65
int audsrv_stop_cd()
Definition: audsrv_rpc.c:181
int audsrv_on_fillbuf(int amount, audsrv_callback_t cb, void *arg)
Definition: audsrv_rpc.c:471
int audsrv_wait_audio(int bytes)
Definition: audsrv_rpc.c:152
int audsrv_get_track_offset(int track)
Definition: audsrv_rpc.c:203
int audsrv_set_format(struct audsrv_fmt_t *fmt)
Definition: audsrv_rpc.c:133
int audsrv_get_cd_status()
Definition: audsrv_rpc.c:223
int audsrv_quit()
Definition: audsrv_rpc.c:117
u8 buffer[128]
Definition: rpc_client.c:19
void * buffer
Definition: audsrv.h:57
int channels
Definition: audsrv.h:56
int bits
Definition: audsrv.h:46
int freq
Definition: audsrv.h:44
int channels
Definition: audsrv.h:48