PS2SDK
PS2 Homebrew Libraries
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 0x870884e
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 extern int audsrv_init();
71 
75 extern int audsrv_quit();
76 
86 extern int audsrv_set_format(struct audsrv_fmt_t *fmt);
87 
95 extern int audsrv_wait_audio(int bytes);
96 
101 extern int audsrv_set_volume(int volume);
102 
113 extern int audsrv_play_audio(const char *chunk, int bytes);
114 
118 extern int audsrv_stop_audio();
119 
123 extern int audsrv_get_error();
124 
128 extern const char *audsrv_get_error_string();
129 
134 extern int audsrv_play_cd(int track);
135 
139 extern int audsrv_stop_cd();
140 
147 extern int audsrv_get_cdpos();
148 
160 extern int audsrv_get_trackpos();
161 
165 extern int audsrv_get_numtracks();
166 
171 extern int audsrv_get_track_offset(int track);
172 
178 extern int audsrv_pause_cd();
179 
185 extern int audsrv_resume_cd();
186 
192 extern int audsrv_play_sectors(int start, int end);
193 
197 extern int audsrv_get_cd_status();
198 
202 extern int audsrv_get_cd_type();
203 
211 extern int audsrv_on_fillbuf(int amount, audsrv_callback_t cb, void *arg);
212 
219 extern int audsrv_adpcm_init();
220 
227 extern int audsrv_adpcm_set_volume_and_pan(int ch, int vol, int pan);
228 #define audsrv_adpcm_set_volume(ch, vol) audsrv_adpcm_set_volume_and_pan(ch, vol, 0) //For backward-compatibility
229 
236 extern int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size);
237 
248 extern int audsrv_ch_play_adpcm(int ch, audsrv_adpcm_t *adpcm);
249 #define audsrv_play_adpcm(adpcm) audsrv_ch_play_adpcm(-1, adpcm) //For backward-compatibility
250 
254 extern int audsrv_is_adpcm_playing(int ch, audsrv_adpcm_t *adpcm);
255 
261 extern int audsrv_free_adpcm(audsrv_adpcm_t *adpcm);
262 
268 extern int audsrv_on_cdda_stop(audsrv_callback_t cb, void *arg);
269 
277 extern int audsrv_available();
278 
284 extern int audsrv_queued();
285 
286 #ifdef __cplusplus
287 }
288 #endif
289 
290 #endif /* __AUDSRV_H__ */
audsrv_load_adpcm
int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size)
Definition: audsrv_rpc.c:430
audsrv_free_adpcm
int audsrv_free_adpcm(audsrv_adpcm_t *adpcm)
Definition: audsrv_rpc.c:492
audsrv_adpcm_set_volume_and_pan
int audsrv_adpcm_set_volume_and_pan(int ch, int vol, int pan)
Definition: audsrv_rpc.c:399
audsrv_quit
int audsrv_quit()
Definition: audsrv_rpc.c:143
audsrv_play_sectors
int audsrv_play_sectors(int start, int end)
Definition: audsrv_rpc.c:202
audsrv_adpcm_init
int audsrv_adpcm_init()
Definition: audsrv_rpc.c:394
audsrv_stop_audio
int audsrv_stop_audio()
Definition: audsrv_rpc.c:292
audsrv_available
int audsrv_available()
Definition: audsrv_rpc.c:549
audsrv_get_numtracks
int audsrv_get_numtracks()
Definition: audsrv_rpc.c:224
audsrv_get_cdpos
int audsrv_get_cdpos()
Definition: audsrv_rpc.c:214
audsrv_set_volume
int audsrv_set_volume(int volume)
Definition: audsrv_rpc.c:183
audsrv_get_trackpos
int audsrv_get_trackpos()
Definition: audsrv_rpc.c:219
audsrv_play_cd
int audsrv_play_cd(int track)
Definition: audsrv_rpc.c:197
audsrv_on_cdda_stop
int audsrv_on_cdda_stop(audsrv_callback_t cb, void *arg)
Definition: audsrv_rpc.c:524
audsrv_fmt_t
Definition: audsrv.h:41
audsrv_queued
int audsrv_queued()
Definition: audsrv_rpc.c:554
audsrv_adpcm_t
struct audsrv_adpcm_t audsrv_adpcm_t
audsrv_is_adpcm_playing
int audsrv_is_adpcm_playing(int ch, audsrv_adpcm_t *adpcm)
Definition: audsrv_rpc.c:487
audsrv_get_track_offset
int audsrv_get_track_offset(int track)
Definition: audsrv_rpc.c:229
audsrv_get_error
int audsrv_get_error()
Definition: audsrv_rpc.c:66
audsrv_get_error_string
const char * audsrv_get_error_string()
Definition: audsrv_rpc.c:498
audsrv_on_fillbuf
int audsrv_on_fillbuf(int amount, audsrv_callback_t cb, void *arg)
Definition: audsrv_rpc.c:531
audsrv_fmt_t::channels
int channels
Definition: audsrv.h:48
audsrv_pause_cd
int audsrv_pause_cd()
Definition: audsrv_rpc.c:234
audsrv_fmt_t::freq
int freq
Definition: audsrv.h:44
audsrv_init
int audsrv_init()
Definition: audsrv_rpc.c:328
audsrv_play_audio
int audsrv_play_audio(const char *chunk, int bytes)
Definition: audsrv_rpc.c:254
audsrv_ch_play_adpcm
int audsrv_ch_play_adpcm(int ch, audsrv_adpcm_t *adpcm)
Definition: audsrv_rpc.c:481
audsrv_set_format
int audsrv_set_format(struct audsrv_fmt_t *fmt)
Definition: audsrv_rpc.c:159
audsrv_adpcm_t
Definition: audsrv.h:52
audsrv_wait_audio
int audsrv_wait_audio(int bytes)
Definition: audsrv_rpc.c:178
audsrv_get_cd_type
int audsrv_get_cd_type()
Definition: audsrv_rpc.c:244
audsrv_fmt_t::bits
int bits
Definition: audsrv.h:46
audsrv_stop_cd
int audsrv_stop_cd()
Definition: audsrv_rpc.c:207
audsrv_fmt_t
struct audsrv_fmt_t audsrv_fmt_t
audsrv_resume_cd
int audsrv_resume_cd()
Definition: audsrv_rpc.c:239
audsrv_get_cd_status
int audsrv_get_cd_status()
Definition: audsrv_rpc.c:249