Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/openal-0.0.8/src/backends/alc_backend.h @ 17

Last change on this file since 17 was 17, checked in by landauf, 17 years ago

added openal

File size: 12.9 KB
Line 
1/* -*- mode: C; tab-width:8; c-basic-offset:8 -*-
2 * vi:set ts=8:
3 *
4 * interface_sound.h
5 *
6 * High level prototypes for sound device aquisition and management.
7 *
8 */
9#ifndef AL_BACKENDS_ALC_BACKEND_H_
10#define AL_BACKENDS_ALC_BACKEND_H_
11
12#include "al_siteconfig.h"
13
14#include <AL/al.h>
15
16/*
17 * An opaque backend structure, only used via pointers from outside.
18 */
19typedef struct ALC_BackendStruct ALC_Backend;
20
21typedef enum
22{
23  ALC_OPEN_INPUT_,
24  ALC_OPEN_OUTPUT_
25} ALC_OpenMode;
26
27/*
28 * Returns a handle to a backend suitable for reading or writing sound data, or
29 * NULL if no such backend is available. This function is used to implement
30 * alcOpenDevice.
31 */
32ALC_Backend *alcBackendOpen_ (ALC_OpenMode mode);
33
34/*
35 * Closes an (output or input) backend. Returns AL_TRUE if closing was
36 * successful, AL_FALSE if the handle was invalid or the backend could not be
37 * closed for some reason. This function is used to implement alcCloseDevice.
38 */
39ALboolean alcBackendClose_ (ALC_Backend *backend);
40
41/*
42 * Informs a backend that it is about to get paused. This function is used to
43 * implement alcMakeContextCurrent(NULL).
44 */
45void alcBackendPause_ (ALC_Backend *backend);
46
47/*
48 * Informs a backend that it is about to get resumed. This function is used to
49 * implement alcMakeContextCurrent(NON_NULL).
50 */
51void alcBackendResume_ (ALC_Backend *backend);
52
53/*
54 * Sets the parameters for a backend. Because we follow a meet-or-exceed
55 * policty, *bufsiz, *fmt, and *speed might be different from the parameters
56 * initially passed, so the caller should check these after a succesful
57 * call. Returns AL_TRUE if setting was successful, AL_FALSE if the parameters
58 * could not be matched or exceeded. This function is used to implement
59 * alcMakeContextCurrent(NON_NULL).
60 */
61ALboolean alcBackendSetAttributes_ (ALC_Backend *backend,
62                                    ALuint *bufsiz, ALenum *fmt,
63                                    ALuint *speed);
64
65/*
66 * Writes a given interleaved array of sound data to an output backend. This
67 * function is used to implement (a)sync_mixer_iterate.
68 */
69void alcBackendWrite_ (ALC_Backend *backend, void *data, int size);
70
71/*
72 * Captures data from an input backend into the given buffer. This function is
73 * used to implement alCaptureGetData_EXT.
74 */
75ALsizei alcBackendRead_ (ALC_Backend *backend, void *data, int size);
76
77/*
78 * Returns the normalized volume for the given channel (main/PCM/CD) on an
79 * output backend. This function is used to implement alcGetAudioChannel_LOKI.
80 */
81ALfloat alcBackendGetAudioChannel_ (ALC_Backend *backend, ALuint channel);
82
83/*
84 * Sets the normalized volume for the given channel (main/PCM/CD) on an output
85 * backend. This function is used to implement alcSetAudioChannel_LOKI.
86 */
87void alcBackendSetAudioChannel_ (ALC_Backend *backend, ALuint channel,
88                                 ALfloat volume);
89
90/******************************************************************************/
91
92/*
93 * Various data, the details depend on the backend in question.
94 */
95typedef void ALC_BackendPrivateData;
96
97ALC_BackendPrivateData *alcBackendOpenNative_ (ALC_OpenMode mode);
98void release_native (ALC_BackendPrivateData *privateData);
99void pause_nativedevice (ALC_BackendPrivateData *privateData);
100void resume_nativedevice (ALC_BackendPrivateData *privateData);
101ALboolean alcBackendSetAttributesNative_ (ALC_OpenMode mode,
102                                          ALC_BackendPrivateData *privateData,
103                                          ALuint *bufsiz, ALenum *fmt,
104                                          ALuint *speed);
105void native_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
106                        int bytes);
107ALsizei capture_nativedevice (ALC_BackendPrivateData *privateData,
108                              void *capture_buffer, int bufsiz);
109ALfloat get_nativechannel (ALC_BackendPrivateData *privateData,
110                           ALuint channel);
111int set_nativechannel (ALC_BackendPrivateData *privateData, ALuint channel,
112                       ALfloat volume);
113
114#ifdef USE_BACKEND_ALSA
115ALC_BackendPrivateData *alcBackendOpenALSA_ (ALC_OpenMode mode);
116void release_alsa (ALC_BackendPrivateData *privateData);
117void pause_alsa (ALC_BackendPrivateData *privateData);
118void resume_alsa (ALC_BackendPrivateData *privateData);
119ALboolean alcBackendSetAttributesALSA_ (ALC_OpenMode mode,
120                                        ALC_BackendPrivateData *privateData,
121                                        ALuint *bufsiz, ALenum *fmt,
122                                        ALuint *speed);
123void alsa_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
124                      int bytes);
125ALsizei capture_alsa (ALC_BackendPrivateData *privateData,
126                      void *capture_buffer, int bufsiz);
127ALfloat get_alsachannel (ALC_BackendPrivateData *privateData, ALuint channel);
128int set_alsachannel (ALC_BackendPrivateData *privateData, ALuint channel,
129                     ALfloat volume);
130#else
131#define alcBackendOpenALSA_(m)        NULL
132#define release_alsa(h)
133#define pause_alsa(h)
134#define resume_alsa(h)
135#define alcBackendSetAttributesALSA_(m,h,b,f,s) AL_FALSE
136#define alsa_blitbuffer(h,d,b)
137#define capture_alsa(h,d,b)           0
138#define get_alsachannel(h,c)          0.0
139#define set_alsachannel(h,c,v)        0
140#endif /* USE_BACKEND_ALSA */
141
142#ifdef USE_BACKEND_ARTS
143ALC_BackendPrivateData *alcBackendOpenARts_ (ALC_OpenMode mode);
144void release_arts (ALC_BackendPrivateData *privateData);
145void pause_arts (ALC_BackendPrivateData *privateData);
146void resume_arts (ALC_BackendPrivateData *privateData);
147ALboolean alcBackendSetAttributesARts_ (ALC_OpenMode mode,
148                                        ALC_BackendPrivateData *privateData,
149                                        ALuint *bufsiz, ALenum *fmt,
150                                        ALuint *speed);
151void arts_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
152                      int bytes);
153ALsizei capture_arts (ALC_BackendPrivateData *privateData,
154                      void *capture_buffer, int bufsiz);
155ALfloat get_artschannel (ALC_BackendPrivateData *privateData, ALuint channel);
156int set_artschannel (ALC_BackendPrivateData *privateData, ALuint channel,
157                     ALfloat volume);
158#else
159#define alcBackendOpenARts_(m)        NULL
160#define release_arts(h)
161#define pause_arts(h)
162#define resume_arts(h)
163#define alcBackendSetAttributesARts_(m,h,b,f,s) AL_FALSE
164#define arts_blitbuffer(h,d,b)
165#define capture_arts(h,d,b)           0
166#define get_artschannel(h,c)          0.0
167#define set_artschannel(h,c,v)        0
168#endif /* USE_BACKEND_ARTS */
169
170#ifdef USE_BACKEND_DMEDIA
171ALC_BackendPrivateData *alcBackendOpenDMedia_ (ALC_OpenMode mode);
172void release_dmedia (ALC_BackendPrivateData *privateData);
173void pause_dmedia (ALC_BackendPrivateData *privateData);
174void resume_dmedia (ALC_BackendPrivateData *privateData);
175ALboolean alcBackendSetAttributesDMedia_ (ALC_OpenMode mode,
176                                        ALC_BackendPrivateData *privateData,
177                                        ALuint *bufsiz, ALenum *fmt,
178                                        ALuint *speed);
179void dmedia_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
180                      int bytes);
181ALsizei capture_dmedia (ALC_BackendPrivateData *privateData,
182                      void *capture_buffer, int bufsiz);
183ALfloat get_dmediachannel (ALC_BackendPrivateData *privateData, ALuint channel);
184int set_dmediachannel (ALC_BackendPrivateData *privateData, ALuint channel,
185                     ALfloat volume);
186#else
187#define alcBackendOpenDMedia_(m)        NULL
188#define release_dmedia(h)
189#define pause_dmedia(h)
190#define resume_dmedia(h)
191#define alcBackendSetAttributesDMedia_(m,h,b,f,s) AL_FALSE
192#define dmedia_blitbuffer(h,d,b)
193#define capture_dmedia(h,d,b)           0
194#define get_dmediachannel(h,c)          0.0
195#define set_dmediachannel(h,c,v)        0
196#endif /* USE_BACKEND_DMEDIA */
197
198#ifdef USE_BACKEND_ESD
199void *alcBackendOpenESD_ (ALC_OpenMode mode);
200void release_esd (ALC_BackendPrivateData *privateData);
201void pause_esd (ALC_BackendPrivateData *privateData);
202void resume_esd (ALC_BackendPrivateData *privateData);
203ALboolean alcBackendSetAttributesESD_ (ALC_OpenMode mode,
204                                       ALC_BackendPrivateData *privateData,
205                                       ALuint *bufsiz, ALenum *fmt,
206                                       ALuint *speed);
207void esd_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
208                     int bytes);
209ALsizei capture_esd (ALC_BackendPrivateData *privateData,
210                     void *capture_buffer, int bufsiz);
211ALfloat get_esdchannel (ALC_BackendPrivateData *privateData, ALuint channel);
212int set_esdchannel (ALC_BackendPrivateData *privateData, ALuint channel,
213                    ALfloat volume);
214#else
215#define alcBackendOpenESD_(m)         NULL
216#define pause_esd(h)
217#define release_esd(h)
218#define resume_esd(h)
219#define alcBackendSetAttributesESD_(m,h,b,f,s) AL_FALSE
220#define esd_blitbuffer(h,d,b)
221#define capture_esd(h,d,b)            0
222#define get_esdchannel(h,c)           0.0
223#define set_esdchannel(h,c,v)         0
224#endif /* USE_BACKEND_ESD */
225
226#ifdef USE_BACKEND_SDL
227ALC_BackendPrivateData *alcBackendOpenSDL_ (ALC_OpenMode mode);
228void release_sdl (ALC_BackendPrivateData *privateData);
229void pause_sdl (ALC_BackendPrivateData *privateData);
230void resume_sdl (ALC_BackendPrivateData *privateData);
231ALboolean alcBackendSetAttributesSDL_ (ALC_OpenMode mode,
232                                       ALC_BackendPrivateData *privateData,
233                                       ALuint *bufsiz, ALenum *fmt,
234                                       ALuint *speed);
235void sdl_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
236                     int bytes);
237ALsizei capture_sdl (ALC_BackendPrivateData *privateData,
238                     void *capture_buffer, int bufsiz);
239ALfloat get_sdlchannel (ALC_BackendPrivateData *privateData, ALuint channel);
240int set_sdlchannel (ALC_BackendPrivateData *privateData, ALuint channel,
241                    ALfloat volume);
242#else
243#define alcBackendOpenSDL_(m)         NULL
244#define release_sdl(h)
245#define pause_sdl(h)
246#define resume_sdl(h)
247#define alcBackendSetAttributesSDL_(m,h,b,f,s) AL_FALSE
248#define sdl_blitbuffer(h,d,b)
249#define capture_sdl(h,d,b)            0
250#define get_sdlchannel(h,c)           0.0
251#define set_sdlchannel(h,c,v)         0
252#endif /* USE_BACKEND_SDL */
253
254#ifdef USE_BACKEND_NULL
255ALC_BackendPrivateData *alcBackendOpenNull_ (ALC_OpenMode mode);
256void release_null (ALC_BackendPrivateData *privateData);
257void pause_null (ALC_BackendPrivateData *privateData);
258void resume_null (ALC_BackendPrivateData *privateData);
259ALboolean alcBackendSetAttributesNull_ (ALC_OpenMode mode,
260                                        ALC_BackendPrivateData *privateData,
261                                        ALuint *bufsiz, ALenum *fmt,
262                                        ALuint *speed);
263void null_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
264                      int bytes);
265ALsizei capture_null (ALC_BackendPrivateData *privateData,
266                      void *capture_buffer, int bufsiz);
267ALfloat get_nullchannel (ALC_BackendPrivateData *privateData, ALuint channel);
268int set_nullchannel (ALC_BackendPrivateData *privateData, ALuint channel,
269                     ALfloat volume);
270#else
271#define alcBackendOpenNull_(m)        NULL
272#define release_null(h)
273#define pause_null(h)
274#define resume_null(h)
275#define alcBackendSetAttributesNull_(m,h,b,f,s) AL_FALSE
276#define null_blitbuffer(h,d,b)
277#define capture_null(h,d,b)           0
278#define get_nullchannel(h,c)          0.0
279#define set_nullchannel(h,c,v)        0
280#endif /* USE_BACKEND_NULL */
281
282#ifdef USE_BACKEND_WAVEOUT
283ALC_BackendPrivateData *alcBackendOpenWAVE_ (ALC_OpenMode mode);
284void release_waveout (ALC_BackendPrivateData *privateData);
285void pause_waveout (ALC_BackendPrivateData *privateData);
286void resume_waveout (ALC_BackendPrivateData *privateData);
287ALboolean alcBackendSetAttributesWAVE_ (ALC_OpenMode mode,
288                                        ALC_BackendPrivateData *privateData,
289                                        ALuint *bufsiz, ALenum *fmt,
290                                        ALuint *speed);
291void waveout_blitbuffer (ALC_BackendPrivateData *privateData, void *data,
292                         int bytes);
293ALsizei capture_waveout (ALC_BackendPrivateData *privateData,
294                         void *capture_buffer, int bufsiz);
295ALfloat get_waveoutchannel (ALC_BackendPrivateData *privateData,
296                            ALuint channel);
297int set_waveoutchannel (ALC_BackendPrivateData *privateData, ALuint channel,
298                        ALfloat volume);
299#else
300#define alcBackendOpenWAVE_(m)        NULL
301#define release_waveout(h)
302#define pause_waveout(h)
303#define resume_waveout(h)
304#define alcBackendSetAttributesWAVE_(m,h,b,f,s) AL_FALSE
305#define waveout_blitbuffer(h,d,b)
306#define capture_waveout(h,d,b)        0
307#define get_waveoutchannel(h,c)       0.0
308#define set_waveoutchannel(h,c,v)     0
309#endif /* USE_BACKEND_WAVEOUT */
310
311#endif /* AL_BACKENDS_ALC_BACKEND_H_ */
Note: See TracBrowser for help on using the repository browser.