comparison src/audio/dmedia/SDL_irixaudio.c @ 2060:866052b01ee5

indent is evil
author Sam Lantinga <slouken@libsdl.org>
date Sat, 28 Oct 2006 16:48:03 +0000
parents 5f6550e5184f
children 99210400e8b9
comparison
equal deleted inserted replaced
2059:4685ccd33d0e 2060:866052b01ee5
102 102
103 /* !!! FIXME: Handle multiple devices and capture? */ 103 /* !!! FIXME: Handle multiple devices and capture? */
104 104
105 /* Initialize all variables that we clean on shutdown */ 105 /* Initialize all variables that we clean on shutdown */
106 this->hidden = (struct SDL_PrivateAudioData *) 106 this->hidden = (struct SDL_PrivateAudioData *)
107 SDL_malloc((sizeof *this->hidden)); 107 SDL_malloc((sizeof *this->hidden));
108 if (this->hidden == NULL) { 108 if (this->hidden == NULL) {
109 SDL_OutOfMemory(); 109 SDL_OutOfMemory();
110 return 0; 110 return 0;
111 } 111 }
112 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); 112 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
158 if (valid) { 158 if (valid) {
159 ALconfig audio_config = alNewConfig(); 159 ALconfig audio_config = alNewConfig();
160 valid = 0; 160 valid = 0;
161 if (audio_config) { 161 if (audio_config) {
162 if (alSetChannels(audio_config, this->spec.channels) < 0) { 162 if (alSetChannels(audio_config, this->spec.channels) < 0) {
163 if (this->spec.channels > 2) { /* can't handle > stereo? */ 163 if (this->spec.channels > 2) { /* can't handle > stereo? */
164 this->spec.channels = 2; /* try again below. */ 164 this->spec.channels = 2; /* try again below. */
165 } 165 }
166 } 166 }
167 167
168 if ((alSetSampFmt(audio_config, fmt) >= 0) && 168 if ((alSetSampFmt(audio_config, fmt) >= 0) &&
169 ((!width) || (alSetWidth(audio_config, width) >= 0)) && 169 ((!width) || (alSetWidth(audio_config, width) >= 0)) &&
170 (alSetQueueSize(audio_config,this->spec.samples*2) >= 0) && 170 (alSetQueueSize(audio_config, this->spec.samples * 2) >=
171 (alSetChannels(audio_config, this->spec.channels) >= 0)) { 171 0)
172 && (alSetChannels(audio_config, this->spec.channels) >=
173 0)) {
172 174
173 this->hidden->audio_port = alOpenPort("SDL audio", "w", 175 this->hidden->audio_port = alOpenPort("SDL audio", "w",
174 audio_config); 176 audio_config);
175 if (this->hidden->audio_port == NULL) { 177 if (this->hidden->audio_port == NULL) {
176 /* docs say AL_BAD_CHANNELS happens here, too. */ 178 /* docs say AL_BAD_CHANNELS happens here, too. */
177 int err = oserror(); 179 int err = oserror();
178 if (err == AL_BAD_CHANNELS) { 180 if (err == AL_BAD_CHANNELS) {
179 this->spec.channels = 2; 181 this->spec.channels = 2;
180 alSetChannels(audio_config, this->spec.channels); 182 alSetChannels(audio_config, this->spec.channels);
181 this->hidden->audio_port = alOpenPort("SDL audio", "w", 183 this->hidden->audio_port =
182 audio_config); 184 alOpenPort("SDL audio", "w", audio_config);
183 } 185 }
184 } 186 }
185 187
186 if (this->hidden->audio_port != NULL) { 188 if (this->hidden->audio_port != NULL) {
187 valid = 1; 189 valid = 1;
214 /* We're ready to rock and roll. :-) */ 216 /* We're ready to rock and roll. :-) */
215 return 1; 217 return 1;
216 } 218 }
217 219
218 static int 220 static int
219 IRIXAUDIO_Init(SDL_AudioDriverImpl *impl) 221 IRIXAUDIO_Init(SDL_AudioDriverImpl * impl)
220 { 222 {
221 /* Set the function pointers */ 223 /* Set the function pointers */
222 impl->OpenDevice = DSP_OpenDevice; 224 impl->OpenDevice = DSP_OpenDevice;
223 impl->PlayDevice = DSP_PlayDevice; 225 impl->PlayDevice = DSP_PlayDevice;
224 impl->WaitDevice = DSP_WaitDevice; 226 impl->WaitDevice = DSP_WaitDevice;
225 impl->GetDeviceBuf = DSP_GetDeviceBuf; 227 impl->GetDeviceBuf = DSP_GetDeviceBuf;
226 impl->CloseDevice = DSP_CloseDevice; 228 impl->CloseDevice = DSP_CloseDevice;
227 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */ 229 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */
228 230
229 return 1; 231 return 1;
230 } 232 }
231 233
232 AudioBootStrap IRIXAUDIO_bootstrap = { 234 AudioBootStrap IRIXAUDIO_bootstrap = {