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 */
9 
15 #ifndef __AUDSRV_H__
16 #define __AUDSRV_H__
17 
18 #include <types.h>
19 #include <irx.h>
20 
22 #define AUDSRV_INIT 0x0000
23 #define AUDSRV_QUIT 0x0001
24 
26 #define AUDSRV_FORMAT_OK 0x0002
27 #define AUDSRV_SET_FORMAT 0x0003
28 #define AUDSRV_PLAY_AUDIO 0x0004
29 #define AUDSRV_WAIT_AUDIO 0x0005
30 #define AUDSRV_STOP_AUDIO 0x0006
31 #define AUDSRV_SET_VOLUME 0x0007
32 #define AUDSRV_SET_THRESHOLD 0x0008
33 
35 #define AUDSRV_PLAY_CD 0x0009
36 #define AUDSRV_STOP_CD 0x000a
37 #define AUDSRV_GET_CDPOS 0x000b
38 #define AUDSRV_GET_TRACKPOS 0x000c
39 #define AUDSRV_GET_NUMTRACKS 0x000d
40 #define AUDSRV_GET_TRACKOFFSET 0x000e
41 #define AUDSRV_PAUSE_CD 0x0011
42 #define AUDSRV_RESUME_CD 0x0012
43 #define AUDSRV_PLAY_SECTORS 0x0013
44 #define AUDSRV_GET_CD_STATUS 0x0014
45 #define AUDSRV_GET_CD_TYPE 0x0015
46 
47 #define AUDSRV_INIT_ADPCM 0x0016
48 #define AUDSRV_LOAD_ADPCM 0x0017
49 #define AUDSRV_PLAY_ADPCM 0x0018
50 #define AUDSRV_SET_ADPCM_VOL 0x0019
51 #define AUDSRV_FREE_ADPCM 0x001c
52 #define AUDSRV_IS_ADPCM_PLAYING 0x001d
53 
54 #define AUDSRV_AVAILABLE 0x001a
55 #define AUDSRV_QUEUED 0x001b
56 
57 #define AUDSRV_FILLBUF_CALLBACK 0x0001
58 #define AUDSRV_CDDA_CALLBACK 0x0002
59 
60 /* error codes */
61 #define AUDSRV_ERR_NOERROR 0x0000
62 #define AUDSRV_ERR_NOT_INITIALIZED 0x0001
63 #define AUDSRV_ERR_RPC_FAILED 0x0002
64 #define AUDSRV_ERR_FORMAT_NOT_SUPPORTED 0x0003
65 #define AUDSRV_ERR_OUT_OF_MEMORY 0x0004
66 #define AUDSRV_ERR_ARGS 0x0005
67 #define AUDSRV_ERR_NO_DISC 0x0006
68 #define AUDSRV_ERR_NO_MORE_CHANNELS 0x0007
69 
70 extern int audsrv_init();
71 extern int audsrv_quit();
72 
73 /* audio streaming functions */
74 extern int audsrv_format_ok(int freq, int bits, int channels);
75 extern int audsrv_set_format(int freq, int bits, int channels);
76 extern int audsrv_wait_audio(int buflen);
77 extern int audsrv_play_audio(const char *buf, int buflen);
78 extern int audsrv_stop_audio();
79 extern int audsrv_set_volume(int vol);
80 extern int audsrv_available();
81 extern int audsrv_queued();
82 
83 /* cdda playing functions */
84 extern int audsrv_play_cd(int track);
85 extern int audsrv_stop_cd();
86 extern int audsrv_set_threshold(int amount);
87 extern int audsrv_get_cdpos();
88 extern int audsrv_get_trackpos();
89 extern int audsrv_get_numtracks();
90 extern int audsrv_get_track_offset(int track);
91 extern int audsrv_cd_pause();
92 extern int audsrv_cd_resume();
93 extern int audsrv_cd_play_sectors(int start, int end);
94 extern int audsrv_get_cd_status();
95 extern int audsrv_get_cd_type();
96 
97 /* adpcm functions */
98 extern int audsrv_adpcm_init();
99 extern int audsrv_adpcm_set_volume(int ch, int voll, int volr);
100 extern void *audsrv_load_adpcm(u32 *buffer, int size, int id);
101 #define audsrv_play_adpcm(id) audsrv_ch_play_adpcm(-1, id) //For backward-compatibility
102 extern int audsrv_ch_play_adpcm(int ch, u32 id);
103 extern int audsrv_is_adpcm_playing(int ch, u32 id);
104 extern int free_sample(u32 id);
105 
106 #define audsrv_IMPORTS_start DECLARE_IMPORT_TABLE(audsrv, 1, 4)
107 #define audsrv_IMPORTS_end END_IMPORT_TABLE
108 
109 #define I_audsrv_init DECLARE_IMPORT( 4, audsrv_init)
110 #define I_audsrv_quit DECLARE_IMPORT( 5, audsrv_quit)
111 
112 /* audio streaming functions */
113 #define I_audsrv_format_ok DECLARE_IMPORT( 6, audsrv_format_ok)
114 #define I_audsrv_set_format DECLARE_IMPORT( 7, audsrv_set_format)
115 #define I_audsrv_wait_audio DECLARE_IMPORT( 8, audsrv_wait_audio)
116 #define I_audsrv_play_audio DECLARE_IMPORT( 9, audsrv_play_audio)
117 #define I_audsrv_stop_audio DECLARE_IMPORT(10, audsrv_stop_audio)
118 #define I_audsrv_set_volume DECLARE_IMPORT(11, audsrv_set_volume)
119 
120 /* cdda playing functions */
121 #define I_audsrv_play_cd DECLARE_IMPORT(12, audsrv_play_cd)
122 #define I_audsrv_stop_cd DECLARE_IMPORT(13, audsrv_stop_cd)
123 #define I_audsrv_set_threshold DECLARE_IMPORT(14, audsrv_set_threshold)
124 #define I_audsrv_get_cdpos DECLARE_IMPORT(15, audsrv_get_cdpos)
125 #define I_audsrv_get_trackpos DECLARE_IMPORT(16, audsrv_get_trackpos)
126 #define I_audsrv_get_numtracks DECLARE_IMPORT(17, audsrv_get_numtracks)
127 #define I_audsrv_get_track_offset DECLARE_IMPORT(18, audsrv_get_track_offset)
128 #define I_audsrv_cd_pause DECLARE_IMPORT(19, audsrv_cd_pause)
129 #define I_audsrv_cd_resume DECLARE_IMPORT(20, audsrv_cd_resume)
130 #define I_audsrv_cd_play_sectors DECLARE_IMPORT(21, audsrv_cd_play_sectors)
131 #define I_audsrv_get_cd_status DECLARE_IMPORT(22, audsrv_get_cd_status)
132 #define I_audsrv_get_cd_type DECLARE_IMPORT(23, audsrv_get_cd_type)
133 
134 #define I_audsrv_adpcm_init DECLARE_IMPORT(24, audsrv_adpcm_init)
135 #define I_audsrv_load_adpcm DECLARE_IMPORT(25, audsrv_load_adpcm)
136 #define I_audsrv_play_adpcm I_audsrv_ch_play_adpcm //For backward-compatibility
137 #define I_audsrv_ch_play_adpcm DECLARE_IMPORT(26, audsrv_ch_play_adpcm)
138 #define I_audsrv_adpcm_set_volume DECLARE_IMPORT(27, audsrv_adpcm_set_volume)
139 #define I_audsrv_available DECLARE_IMPORT(28, audsrv_available)
140 #define I_audsrv_queued DECLARE_IMPORT(29, audsrv_queued)
141 
142 #endif /* __AUDSRV_H__ */
audsrv_load_adpcm
int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size)
Definition: audsrv_rpc.c:430
audsrv_quit
int audsrv_quit()
Definition: audsrv_rpc.c:143
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
irx.h
audsrv_queued
int audsrv_queued()
Definition: audsrv_rpc.c:554
audsrv_adpcm_set_volume
int audsrv_adpcm_set_volume(int ch, int voll, int volr)
Definition: adpcm.c:347
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
free_sample
int free_sample(u32 id)
Definition: adpcm.c:84
audsrv_cd_pause
int audsrv_cd_pause()
Definition: cdrom.c:298
audsrv_cd_play_sectors
int audsrv_cd_play_sectors(int start, int end)
Definition: cdrom.c:472
audsrv_init
int audsrv_init()
Definition: audsrv_rpc.c:328
audsrv_format_ok
int audsrv_format_ok(int freq, int bits, int channels)
Definition: audsrv.c:156
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_cd_resume
int audsrv_cd_resume()
Definition: cdrom.c:307
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_stop_cd
int audsrv_stop_cd()
Definition: audsrv_rpc.c:207
audsrv_get_cd_status
int audsrv_get_cd_status()
Definition: audsrv_rpc.c:249