Mercurial > sdl-ios-xcode
annotate src/audio/SDL_sysaudio.h @ 1379:c0a74f199ecf
Use only safe string functions
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Feb 2006 23:46:34 +0000 |
parents | 19418e4422cb |
children | d910939febfa |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
3 Copyright (C) 1997-2006 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 */ |
22 | |
23 #ifndef _SDL_sysaudio_h | |
24 #define _SDL_sysaudio_h | |
25 | |
26 #include "SDL_mutex.h" | |
27 #include "SDL_thread.h" | |
28 | |
29 /* The SDL audio driver */ | |
30 typedef struct SDL_AudioDevice SDL_AudioDevice; | |
31 | |
32 /* Define the SDL audio driver structure */ | |
33 #define _THIS SDL_AudioDevice *_this | |
34 #ifndef _STATUS | |
35 #define _STATUS SDL_status *status | |
36 #endif | |
37 struct SDL_AudioDevice { | |
38 /* * * */ | |
39 /* The name of this audio driver */ | |
40 const char *name; | |
41 | |
42 /* * * */ | |
43 /* The description of this audio driver */ | |
44 const char *desc; | |
45 | |
46 /* * * */ | |
47 /* Public driver functions */ | |
48 int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); | |
49 void (*ThreadInit)(_THIS); /* Called by audio thread at start */ | |
50 void (*WaitAudio)(_THIS); | |
51 void (*PlayAudio)(_THIS); | |
52 Uint8 *(*GetAudioBuf)(_THIS); | |
53 void (*WaitDone)(_THIS); | |
54 void (*CloseAudio)(_THIS); | |
55 | |
56 /* * * */ | |
322
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
57 /* 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
|
58 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
|
59 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
|
60 |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
61 /* * * */ |
0 | 62 /* Data common to all devices */ |
63 | |
64 /* The current audio specification (shared with audio thread) */ | |
65 SDL_AudioSpec spec; | |
66 | |
67 /* An audio conversion block for audio format emulation */ | |
68 SDL_AudioCVT convert; | |
69 | |
70 /* Current state flags */ | |
71 int enabled; | |
72 int paused; | |
73 int opened; | |
74 | |
75 /* Fake audio buffer for when the audio hardware is busy */ | |
76 Uint8 *fake_stream; | |
77 | |
78 /* A semaphore for locking the mixing buffers */ | |
79 SDL_mutex *mixer_lock; | |
80 | |
81 /* A thread to feed the audio device */ | |
82 SDL_Thread *thread; | |
83 Uint32 threadid; | |
84 | |
85 /* * * */ | |
86 /* Data private to this driver */ | |
87 struct SDL_PrivateAudioData *hidden; | |
88 | |
89 /* * * */ | |
90 /* The function used to dispose of this structure */ | |
91 void (*free)(_THIS); | |
92 }; | |
93 #undef _THIS | |
94 | |
95 typedef struct AudioBootStrap { | |
96 const char *name; | |
97 const char *desc; | |
98 int (*available)(void); | |
99 SDL_AudioDevice *(*create)(int devindex); | |
100 } AudioBootStrap; | |
101 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
102 #if SDL_AUDIO_DRIVER_OPENBSD |
121
43febd46d49d
Name changed from OBSD to OPENBSD_AUDIO
Sam Lantinga <slouken@libsdl.org>
parents:
94
diff
changeset
|
103 extern AudioBootStrap OPENBSD_AUDIO_bootstrap; |
94
ae6e6b73333f
Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents:
68
diff
changeset
|
104 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
105 #if SDL_AUDIO_DRIVER_OSS |
0 | 106 extern AudioBootStrap DSP_bootstrap; |
107 extern AudioBootStrap DMA_bootstrap; | |
108 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
109 #if SDL_AUDIO_DRIVER_ALSA |
0 | 110 extern AudioBootStrap ALSA_bootstrap; |
111 #endif | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
112 #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
|
113 extern AudioBootStrap QNXNTOAUDIO_bootstrap; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
654
diff
changeset
|
114 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
115 #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
|
116 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
|
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_DMEDIA |
148
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
119 extern AudioBootStrap DMEDIA_bootstrap; |
35
d3bc792e136d
Added detection of Open Sound System on Solaris x86
Sam Lantinga <slouken@lokigames.com>
parents:
21
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_ARTS |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
122 extern AudioBootStrap ARTS_bootstrap; |
0 | 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_ESD |
0 | 125 extern AudioBootStrap ESD_bootstrap; |
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_NAS |
0 | 128 extern AudioBootStrap NAS_bootstrap; |
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_DSOUND |
0 | 131 extern AudioBootStrap DSOUND_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_WAVEOUT |
0 | 134 extern AudioBootStrap WAVEOUT_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_PAUD |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
137 extern AudioBootStrap Paud_bootstrap; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
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_BAUDIO |
0 | 140 extern AudioBootStrap BAUDIO_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_COREAUDIO |
935
f8d5ddc7aef1
Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
143 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
|
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_SNDMGR |
0 | 146 extern AudioBootStrap SNDMGR_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_AHI |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
149 extern AudioBootStrap AHI_bootstrap; |
0 | 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_MINT |
644
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
152 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
153 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
154 extern AudioBootStrap MINTAUDIO_STFA_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
155 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap; |
594422ab8f9f
Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
630
diff
changeset
|
156 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap; |
398
d219b0e02f5f
Added Atari audio support (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
322
diff
changeset
|
157 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
158 #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
|
159 extern AudioBootStrap DISKAUD_bootstrap; |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
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_DC |
509
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
162 extern AudioBootStrap DCAUD_bootstrap; |
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
163 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
164 #if SDL_AUDIO_DRIVER_DRENDERER |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
165 extern AudioBootStrap DRENDERER_bootstrap; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
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_MMEAUDIO |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
644
diff
changeset
|
168 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
|
169 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
170 #if SDL_AUDIO_DRIVER_DART |
1190 | 171 extern AudioBootStrap DART_bootstrap; |
172 #endif | |
0 | 173 |
174 /* This is the current audio device */ | |
175 extern SDL_AudioDevice *current_audio; | |
176 | |
177 #endif /* _SDL_sysaudio_h */ |