Mercurial > sdl-ios-xcode
annotate src/audio/SDL_sysaudio.h @ 4557:4aa31b9207f2 SDL-1.2
Finally fixed bug 894 without breaking bug 716. Yay! :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Jul 2010 00:01:26 -0700 |
parents | fe15c4e8efe6 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
4159 | 3 Copyright (C) 1997-2009 Sam Lantinga |
0 | 4 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
5 This library is SDL_free software; you can redistribute it and/or |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
148
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 #ifndef _SDL_sysaudio_h | |
25 #define _SDL_sysaudio_h | |
26 | |
27 #include "SDL_mutex.h" | |
28 #include "SDL_thread.h" | |
29 | |
30 /* The SDL audio driver */ | |
31 typedef struct SDL_AudioDevice SDL_AudioDevice; | |
32 | |
33 /* Define the SDL audio driver structure */ | |
34 #define _THIS SDL_AudioDevice *_this | |
35 #ifndef _STATUS | |
36 #define _STATUS SDL_status *status | |
37 #endif | |
38 struct SDL_AudioDevice { | |
39 /* * * */ | |
40 /* The name of this audio driver */ | |
41 const char *name; | |
42 | |
43 /* * * */ | |
44 /* The description of this audio driver */ | |
45 const char *desc; | |
46 | |
47 /* * * */ | |
48 /* Public driver functions */ | |
49 int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); | |
50 void (*ThreadInit)(_THIS); /* Called by audio thread at start */ | |
51 void (*WaitAudio)(_THIS); | |
52 void (*PlayAudio)(_THIS); | |
53 Uint8 *(*GetAudioBuf)(_THIS); | |
54 void (*WaitDone)(_THIS); | |
55 void (*CloseAudio)(_THIS); | |
56 | |
57 /* * * */ | |
322
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
58 /* Lock / Unlock functions added for the Mac port */ |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
59 void (*LockAudio)(_THIS); |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
60 void (*UnlockAudio)(_THIS); |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
61 |
4398
fe15c4e8efe6
1.2: let PulseAudio hook into SDL_WM_SetCaption().
Ryan C. Gordon <icculus@icculus.org>
parents:
4301
diff
changeset
|
62 void (*SetCaption)(_THIS, const char *caption); |
fe15c4e8efe6
1.2: let PulseAudio hook into SDL_WM_SetCaption().
Ryan C. Gordon <icculus@icculus.org>
parents:
4301
diff
changeset
|
63 |
322
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
64 /* * * */ |
0 | 65 /* Data common to all devices */ |
66 | |
67 /* The current audio specification (shared with audio thread) */ | |
68 SDL_AudioSpec spec; | |
69 | |
70 /* An audio conversion block for audio format emulation */ | |
71 SDL_AudioCVT convert; | |
72 | |
73 /* Current state flags */ | |
74 int enabled; | |
75 int paused; | |
76 int opened; | |
77 | |
78 /* Fake audio buffer for when the audio hardware is busy */ | |
79 Uint8 *fake_stream; | |
80 | |
81 /* A semaphore for locking the mixing buffers */ | |
82 SDL_mutex *mixer_lock; | |
83 | |
84 /* A thread to feed the audio device */ | |
85 SDL_Thread *thread; | |
86 Uint32 threadid; | |
87 | |
88 /* * * */ | |
89 /* Data private to this driver */ | |
90 struct SDL_PrivateAudioData *hidden; | |
91 | |
92 /* * * */ | |
93 /* The function used to dispose of this structure */ | |
94 void (*free)(_THIS); | |
95 }; | |
96 #undef _THIS | |
97 | |
98 typedef struct AudioBootStrap { | |
99 const char *name; | |
100 const char *desc; | |
101 int (*available)(void); | |
102 SDL_AudioDevice *(*create)(int devindex); | |
103 } AudioBootStrap; | |
104 | |
1567
12b6d331d82a
Good idea, renaming OpenBSD audio to BSD audio.
Sam Lantinga <slouken@libsdl.org>
parents:
1532
diff
changeset
|
105 #if SDL_AUDIO_DRIVER_BSD |
12b6d331d82a
Good idea, renaming OpenBSD audio to BSD audio.
Sam Lantinga <slouken@libsdl.org>
parents:
1532
diff
changeset
|
106 extern AudioBootStrap BSD_AUDIO_bootstrap; |
94
ae6e6b73333f
Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents:
68
diff
changeset
|
107 #endif |
3939
42e83d81224b
Committed PulseAudio driver. Thanks, Stephan!
Ryan C. Gordon <icculus@icculus.org>
parents:
3889
diff
changeset
|
108 #if SDL_AUDIO_DRIVER_PULSE |
42e83d81224b
Committed PulseAudio driver. Thanks, Stephan!
Ryan C. Gordon <icculus@icculus.org>
parents:
3889
diff
changeset
|
109 extern AudioBootStrap PULSE_bootstrap; |
42e83d81224b
Committed PulseAudio driver. Thanks, Stephan!
Ryan C. Gordon <icculus@icculus.org>
parents:
3889
diff
changeset
|
110 #endif |
4301
5007e6a66814
Debian patch: 209_alsa_priority.diff
Sam Lantinga <slouken@libsdl.org>
parents:
4159
diff
changeset
|
111 #if SDL_AUDIO_DRIVER_ALSA |
5007e6a66814
Debian patch: 209_alsa_priority.diff
Sam Lantinga <slouken@libsdl.org>
parents:
4159
diff
changeset
|
112 extern AudioBootStrap ALSA_bootstrap; |
5007e6a66814
Debian patch: 209_alsa_priority.diff
Sam Lantinga <slouken@libsdl.org>
parents:
4159
diff
changeset
|
113 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
114 #if SDL_AUDIO_DRIVER_OSS |
0 | 115 extern AudioBootStrap DSP_bootstrap; |
116 extern AudioBootStrap DMA_bootstrap; | |
117 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
118 #if SDL_AUDIO_DRIVER_QNXNTO |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
654
diff
changeset
|
119 extern AudioBootStrap QNXNTOAUDIO_bootstrap; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
654
diff
changeset
|
120 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
121 #if SDL_AUDIO_DRIVER_SUNAUDIO |
148
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
122 extern AudioBootStrap SUNAUDIO_bootstrap; |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
123 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
124 #if SDL_AUDIO_DRIVER_DMEDIA |
148
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
125 extern AudioBootStrap DMEDIA_bootstrap; |
35
d3bc792e136d
Added detection of Open Sound System on Solaris x86
Sam Lantinga <slouken@lokigames.com>
parents:
21
diff
changeset
|
126 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
127 #if SDL_AUDIO_DRIVER_ARTS |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
128 extern AudioBootStrap ARTS_bootstrap; |
0 | 129 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
130 #if SDL_AUDIO_DRIVER_ESD |
0 | 131 extern AudioBootStrap ESD_bootstrap; |
132 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
133 #if SDL_AUDIO_DRIVER_NAS |
0 | 134 extern AudioBootStrap NAS_bootstrap; |
135 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
136 #if SDL_AUDIO_DRIVER_DSOUND |
0 | 137 extern AudioBootStrap DSOUND_bootstrap; |
138 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
139 #if SDL_AUDIO_DRIVER_WAVEOUT |
0 | 140 extern AudioBootStrap WAVEOUT_bootstrap; |
141 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
142 #if SDL_AUDIO_DRIVER_PAUD |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
143 extern AudioBootStrap Paud_bootstrap; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
144 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
145 #if SDL_AUDIO_DRIVER_BAUDIO |
0 | 146 extern AudioBootStrap BAUDIO_bootstrap; |
147 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
148 #if SDL_AUDIO_DRIVER_COREAUDIO |
935
f8d5ddc7aef1
Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
149 extern AudioBootStrap COREAUDIO_bootstrap; |
f8d5ddc7aef1
Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
150 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
151 #if SDL_AUDIO_DRIVER_SNDMGR |
0 | 152 extern AudioBootStrap SNDMGR_bootstrap; |
153 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
154 #if SDL_AUDIO_DRIVER_MINT |
644
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
155 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
156 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
157 extern AudioBootStrap MINTAUDIO_STFA_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
158 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
159 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap; |
398
d219b0e02f5f
Added Atari audio support (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
322
diff
changeset
|
160 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
161 #if SDL_AUDIO_DRIVER_DISK |
68
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
162 extern AudioBootStrap DISKAUD_bootstrap; |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
163 #endif |
1532
30f189cdd82b
Implemented dummy audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
164 #if SDL_AUDIO_DRIVER_DUMMY |
30f189cdd82b
Implemented dummy audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
165 extern AudioBootStrap DUMMYAUD_bootstrap; |
30f189cdd82b
Implemented dummy audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
166 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
167 #if SDL_AUDIO_DRIVER_DC |
509
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
168 extern AudioBootStrap DCAUD_bootstrap; |
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
169 #endif |
3976
8582c6a5ca16
Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
3975
diff
changeset
|
170 #if SDL_AUDIO_DRIVER_NDS |
8582c6a5ca16
Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
3975
diff
changeset
|
171 extern AudioBootStrap NDSAUD_bootstrap; |
8582c6a5ca16
Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
3975
diff
changeset
|
172 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
173 #if SDL_AUDIO_DRIVER_MMEAUDIO |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
644
diff
changeset
|
174 extern AudioBootStrap MMEAUDIO_bootstrap; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
644
diff
changeset
|
175 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
176 #if SDL_AUDIO_DRIVER_DART |
1190 | 177 extern AudioBootStrap DART_bootstrap; |
178 #endif | |
3975 | 179 #if SDL_AUDIO_DRIVER_EPOCAUDIO |
180 extern AudioBootStrap EPOCAudio_bootstrap; | |
181 #endif | |
0 | 182 |
183 /* This is the current audio device */ | |
184 extern SDL_AudioDevice *current_audio; | |
185 | |
186 #endif /* _SDL_sysaudio_h */ |