Mercurial > sdl-ios-xcode
comparison src/audio/SDL_sysaudio.h @ 2049:5f6550e5184f
Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 17 Oct 2006 09:15:21 +0000 |
parents | c121d94672cb |
children | 866052b01ee5 |
comparison
equal
deleted
inserted
replaced
2048:6067c7f9a672 | 2049:5f6550e5184f |
---|---|
27 #include "SDL_mutex.h" | 27 #include "SDL_mutex.h" |
28 #include "SDL_thread.h" | 28 #include "SDL_thread.h" |
29 | 29 |
30 /* The SDL audio driver */ | 30 /* The SDL audio driver */ |
31 typedef struct SDL_AudioDevice SDL_AudioDevice; | 31 typedef struct SDL_AudioDevice SDL_AudioDevice; |
32 #define _THIS SDL_AudioDevice *_this | |
32 | 33 |
33 /* Define the SDL audio driver structure */ | 34 typedef struct SDL_AudioDriverImpl |
34 #define _THIS SDL_AudioDevice *_this | 35 { |
35 #ifndef _STATUS | 36 int (*DetectDevices)(int iscapture); |
36 #define _STATUS SDL_status *status | 37 const char *(*GetDeviceName)(int index, int iscapture); |
37 #endif | 38 int (*OpenDevice) (_THIS, const char *devname, int iscapture); |
38 struct SDL_AudioDevice | 39 void (*ThreadInit) (_THIS); /* Called by audio thread at start */ |
40 void (*WaitDevice) (_THIS); | |
41 void (*PlayDevice) (_THIS); | |
42 Uint8 *(*GetDeviceBuf) (_THIS); | |
43 void (*WaitDone) (_THIS); | |
44 void (*CloseDevice) (_THIS); | |
45 void (*LockDevice) (_THIS); | |
46 void (*UnlockDevice) (_THIS); | |
47 void (*Deinitialize) (void); | |
48 | |
49 /* Some flags to push duplicate code into the core and reduce #ifdefs. */ | |
50 int ProvidesOwnCallbackThread:1; | |
51 int SkipMixerLock:1; | |
52 int HasCaptureSupport:1; | |
53 int OnlyHasDefaultOutputDevice:1; | |
54 int OnlyHasDefaultInputDevice:1; | |
55 } SDL_AudioDriverImpl; | |
56 | |
57 | |
58 typedef struct SDL_AudioDriver | |
39 { | 59 { |
40 /* * * */ | 60 /* * * */ |
41 /* The name of this audio driver */ | 61 /* The name of this audio driver */ |
42 const char *name; | 62 const char *name; |
43 | 63 |
44 /* * * */ | 64 /* * * */ |
45 /* The description of this audio driver */ | 65 /* The description of this audio driver */ |
46 const char *desc; | 66 const char *desc; |
47 | 67 |
48 /* * * */ | 68 SDL_AudioDriverImpl impl; |
49 /* Public driver functions */ | 69 } SDL_AudioDriver; |
50 int (*OpenAudio) (_THIS, SDL_AudioSpec * spec); | |
51 void (*ThreadInit) (_THIS); /* Called by audio thread at start */ | |
52 void (*WaitAudio) (_THIS); | |
53 void (*PlayAudio) (_THIS); | |
54 Uint8 *(*GetAudioBuf) (_THIS); | |
55 void (*WaitDone) (_THIS); | |
56 void (*CloseAudio) (_THIS); | |
57 | 70 |
58 /* * * */ | |
59 /* Lock / Unlock functions added for the Mac port */ | |
60 void (*LockAudio) (_THIS); | |
61 void (*UnlockAudio) (_THIS); | |
62 | 71 |
72 /* Define the SDL audio driver structure */ | |
73 struct SDL_AudioDevice | |
74 { | |
63 /* * * */ | 75 /* * * */ |
64 /* Data common to all devices */ | 76 /* Data common to all devices */ |
65 | 77 |
66 /* The current audio specification (shared with audio thread) */ | 78 /* The current audio specification (shared with audio thread) */ |
67 SDL_AudioSpec spec; | 79 SDL_AudioSpec spec; |
68 | 80 |
69 /* An audio conversion block for audio format emulation */ | 81 /* An audio conversion block for audio format emulation */ |
70 SDL_AudioCVT convert; | 82 SDL_AudioCVT convert; |
71 | 83 |
72 /* Current state flags */ | 84 /* Current state flags */ |
85 int iscapture; | |
73 int enabled; | 86 int enabled; |
74 int paused; | 87 int paused; |
75 int opened; | 88 int opened; |
76 | 89 |
77 /* Fake audio buffer for when the audio hardware is busy */ | 90 /* Fake audio buffer for when the audio hardware is busy */ |
85 Uint32 threadid; | 98 Uint32 threadid; |
86 | 99 |
87 /* * * */ | 100 /* * * */ |
88 /* Data private to this driver */ | 101 /* Data private to this driver */ |
89 struct SDL_PrivateAudioData *hidden; | 102 struct SDL_PrivateAudioData *hidden; |
90 | |
91 /* * * */ | |
92 /* The function used to dispose of this structure */ | |
93 void (*free) (_THIS); | |
94 }; | 103 }; |
95 #undef _THIS | 104 #undef _THIS |
96 | 105 |
97 typedef struct AudioBootStrap | 106 typedef struct AudioBootStrap |
98 { | 107 { |
99 const char *name; | 108 const char *name; |
100 const char *desc; | 109 const char *desc; |
101 int (*available) (void); | 110 int (*init) (SDL_AudioDriverImpl *impl); |
102 SDL_AudioDevice *(*create) (int devindex); | 111 int demand_only:1; /* 1==request explicitly, or it won't be available. */ |
103 } AudioBootStrap; | 112 } AudioBootStrap; |
104 | 113 |
105 #if SDL_AUDIO_DRIVER_BSD | 114 #endif /* _SDL_sysaudio_h */ |
106 extern AudioBootStrap BSD_AUDIO_bootstrap; | |
107 #endif | |
108 #if SDL_AUDIO_DRIVER_OSS | |
109 extern AudioBootStrap DSP_bootstrap; | |
110 extern AudioBootStrap DMA_bootstrap; | |
111 #endif | |
112 #if SDL_AUDIO_DRIVER_ALSA | |
113 extern AudioBootStrap ALSA_bootstrap; | |
114 #endif | |
115 #if SDL_AUDIO_DRIVER_QNXNTO | |
116 extern AudioBootStrap QNXNTOAUDIO_bootstrap; | |
117 #endif | |
118 #if SDL_AUDIO_DRIVER_SUNAUDIO | |
119 extern AudioBootStrap SUNAUDIO_bootstrap; | |
120 #endif | |
121 #if SDL_AUDIO_DRIVER_DMEDIA | |
122 extern AudioBootStrap DMEDIA_bootstrap; | |
123 #endif | |
124 #if SDL_AUDIO_DRIVER_ARTS | |
125 extern AudioBootStrap ARTS_bootstrap; | |
126 #endif | |
127 #if SDL_AUDIO_DRIVER_ESD | |
128 extern AudioBootStrap ESD_bootstrap; | |
129 #endif | |
130 #if SDL_AUDIO_DRIVER_NAS | |
131 extern AudioBootStrap NAS_bootstrap; | |
132 #endif | |
133 #if SDL_AUDIO_DRIVER_DSOUND | |
134 extern AudioBootStrap DSOUND_bootstrap; | |
135 #endif | |
136 #if SDL_AUDIO_DRIVER_WAVEOUT | |
137 extern AudioBootStrap WAVEOUT_bootstrap; | |
138 #endif | |
139 #if SDL_AUDIO_DRIVER_PAUD | |
140 extern AudioBootStrap Paud_bootstrap; | |
141 #endif | |
142 #if SDL_AUDIO_DRIVER_BAUDIO | |
143 extern AudioBootStrap BAUDIO_bootstrap; | |
144 #endif | |
145 #if SDL_AUDIO_DRIVER_COREAUDIO | |
146 extern AudioBootStrap COREAUDIO_bootstrap; | |
147 #endif | |
148 #if SDL_AUDIO_DRIVER_SNDMGR | |
149 extern AudioBootStrap SNDMGR_bootstrap; | |
150 #endif | |
151 #if SDL_AUDIO_DRIVER_AHI | |
152 extern AudioBootStrap AHI_bootstrap; | |
153 #endif | |
154 #if SDL_AUDIO_DRIVER_MINT | |
155 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap; | |
156 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap; | |
157 extern AudioBootStrap MINTAUDIO_STFA_bootstrap; | |
158 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap; | |
159 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap; | |
160 #endif | |
161 #if SDL_AUDIO_DRIVER_DISK | |
162 extern AudioBootStrap DISKAUD_bootstrap; | |
163 #endif | |
164 #if SDL_AUDIO_DRIVER_DUMMY | |
165 extern AudioBootStrap DUMMYAUD_bootstrap; | |
166 #endif | |
167 #if SDL_AUDIO_DRIVER_DC | |
168 extern AudioBootStrap DCAUD_bootstrap; | |
169 #endif | |
170 #if SDL_AUDIO_DRIVER_MMEAUDIO | |
171 extern AudioBootStrap MMEAUDIO_bootstrap; | |
172 #endif | |
173 #if SDL_AUDIO_DRIVER_DART | |
174 extern AudioBootStrap DART_bootstrap; | |
175 #endif | |
176 | 115 |
177 /* This is the current audio device */ | |
178 extern SDL_AudioDevice *current_audio; | |
179 | |
180 #endif /* _SDL_sysaudio_h */ | |
181 /* vi: set ts=4 sw=4 expandtab: */ | 116 /* vi: set ts=4 sw=4 expandtab: */ |