Mercurial > sdl-ios-xcode
annotate src/audio/SDL_sysaudio.h @ 262:ba5363e21df8
Don't allow multiple audio opens to succeed (until SDL 1.3)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 09 Jan 2002 16:04:58 +0000 |
parents | e8157fcb3114 |
children | f6ffac90895c |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
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 | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
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 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_sysaudio_h | |
29 #define _SDL_sysaudio_h | |
30 | |
31 #include "SDL_mutex.h" | |
32 #include "SDL_thread.h" | |
33 | |
34 /* The SDL audio driver */ | |
35 typedef struct SDL_AudioDevice SDL_AudioDevice; | |
36 | |
37 /* Define the SDL audio driver structure */ | |
38 #define _THIS SDL_AudioDevice *_this | |
39 #ifndef _STATUS | |
40 #define _STATUS SDL_status *status | |
41 #endif | |
42 struct SDL_AudioDevice { | |
43 /* * * */ | |
44 /* The name of this audio driver */ | |
45 const char *name; | |
46 | |
47 /* * * */ | |
48 /* The description of this audio driver */ | |
49 const char *desc; | |
50 | |
51 /* * * */ | |
52 /* Public driver functions */ | |
53 int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); | |
54 void (*ThreadInit)(_THIS); /* Called by audio thread at start */ | |
55 void (*WaitAudio)(_THIS); | |
56 void (*PlayAudio)(_THIS); | |
57 Uint8 *(*GetAudioBuf)(_THIS); | |
58 void (*WaitDone)(_THIS); | |
59 void (*CloseAudio)(_THIS); | |
60 | |
61 /* * * */ | |
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 | |
121
43febd46d49d
Name changed from OBSD to OPENBSD_AUDIO
Sam Lantinga <slouken@libsdl.org>
parents:
94
diff
changeset
|
102 #ifdef OPENBSD_AUDIO_SUPPORT |
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 |
0 | 105 #ifdef OSS_SUPPORT |
106 extern AudioBootStrap DSP_bootstrap; | |
107 extern AudioBootStrap DMA_bootstrap; | |
108 #endif | |
109 #ifdef ALSA_SUPPORT | |
110 extern AudioBootStrap ALSA_bootstrap; | |
111 #endif | |
148
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
112 #ifdef SUNAUDIO_SUPPORT |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
113 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
|
114 #endif |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
115 #ifdef DMEDIA_SUPPORT |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
116 extern AudioBootStrap DMEDIA_bootstrap; |
35
d3bc792e136d
Added detection of Open Sound System on Solaris x86
Sam Lantinga <slouken@lokigames.com>
parents:
21
diff
changeset
|
117 #endif |
0 | 118 #ifdef ARTSC_SUPPORT |
119 extern AudioBootStrap ARTSC_bootstrap; | |
120 #endif | |
121 #ifdef ESD_SUPPORT | |
122 extern AudioBootStrap ESD_bootstrap; | |
123 #endif | |
124 #ifdef NAS_SUPPORT | |
125 extern AudioBootStrap NAS_bootstrap; | |
126 #endif | |
127 #ifdef ENABLE_DIRECTX | |
128 extern AudioBootStrap DSOUND_bootstrap; | |
129 #endif | |
130 #ifdef ENABLE_WINDIB | |
131 extern AudioBootStrap WAVEOUT_bootstrap; | |
132 #endif | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
133 #ifdef _AIX |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
134 extern AudioBootStrap Paud_bootstrap; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
135 #endif |
0 | 136 #ifdef __BEOS__ |
137 extern AudioBootStrap BAUDIO_bootstrap; | |
138 #endif | |
139 #if defined(macintosh) || TARGET_API_MAC_CARBON | |
140 extern AudioBootStrap SNDMGR_bootstrap; | |
141 #endif | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
142 #ifdef ENABLE_AHI |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
143 extern AudioBootStrap AHI_bootstrap; |
0 | 144 #endif |
68
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
145 #ifdef DISKAUD_SUPPORT |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
146 extern AudioBootStrap DISKAUD_bootstrap; |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
147 #endif |
0 | 148 |
149 /* This is the current audio device */ | |
150 extern SDL_AudioDevice *current_audio; | |
151 | |
152 #endif /* _SDL_sysaudio_h */ |