Mercurial > sdl-ios-xcode
comparison src/audio/dsp/SDL_dspaudio.c @ 2060:866052b01ee5
indent is evil
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 28 Oct 2006 16:48:03 +0000 |
parents | 5f6550e5184f |
children | 579abbb51f80 |
comparison
equal
deleted
inserted
replaced
2059:4685ccd33d0e | 2060:866052b01ee5 |
---|---|
109 } else { | 109 } else { |
110 build_device_list(0, &outputDevices, &outputDeviceCount); | 110 build_device_list(0, &outputDevices, &outputDeviceCount); |
111 return outputDeviceCount; | 111 return outputDeviceCount; |
112 } | 112 } |
113 | 113 |
114 return 0; /* shouldn't ever hit this. */ | 114 return 0; /* shouldn't ever hit this. */ |
115 } | 115 } |
116 | 116 |
117 static const char * | 117 static const char * |
118 DSP_GetDeviceName(int index, int iscapture) | 118 DSP_GetDeviceName(int index, int iscapture) |
119 { | 119 { |
156 SDL_AudioFormat test_format; | 156 SDL_AudioFormat test_format; |
157 | 157 |
158 /* We don't care what the devname is...we'll try to open anything. */ | 158 /* We don't care what the devname is...we'll try to open anything. */ |
159 /* ...but default to first name in the list... */ | 159 /* ...but default to first name in the list... */ |
160 if (devname == NULL) { | 160 if (devname == NULL) { |
161 if ( ((iscapture) && (inputDeviceCount == 0)) || | 161 if (((iscapture) && (inputDeviceCount == 0)) || |
162 ((!iscapture) && (outputDeviceCount == 0)) ) { | 162 ((!iscapture) && (outputDeviceCount == 0))) { |
163 SDL_SetError("No such audio device"); | 163 SDL_SetError("No such audio device"); |
164 return 0; | 164 return 0; |
165 } | 165 } |
166 devname = ((iscapture) ? inputDevices[0] : outputDevices[0]); | 166 devname = ((iscapture) ? inputDevices[0] : outputDevices[0]); |
167 } | 167 } |
168 | 168 |
169 /* Initialize all variables that we clean on shutdown */ | 169 /* Initialize all variables that we clean on shutdown */ |
170 this->hidden = (struct SDL_PrivateAudioData *) | 170 this->hidden = (struct SDL_PrivateAudioData *) |
171 SDL_malloc((sizeof *this->hidden)); | 171 SDL_malloc((sizeof *this->hidden)); |
172 if (this->hidden == NULL) { | 172 if (this->hidden == NULL) { |
173 SDL_OutOfMemory(); | 173 SDL_OutOfMemory(); |
174 return 0; | 174 return 0; |
175 } | 175 } |
176 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); | 176 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); |
263 } | 263 } |
264 this->spec.format = test_format; | 264 this->spec.format = test_format; |
265 | 265 |
266 /* Set the audio format */ | 266 /* Set the audio format */ |
267 value = format; | 267 value = format; |
268 if ( (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || | 268 if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || |
269 (value != format) ) { | 269 (value != format)) { |
270 perror("SNDCTL_DSP_SETFMT"); | 270 perror("SNDCTL_DSP_SETFMT"); |
271 DSP_CloseDevice(this); | 271 DSP_CloseDevice(this); |
272 SDL_SetError("Couldn't set audio format"); | 272 SDL_SetError("Couldn't set audio format"); |
273 return 0; | 273 return 0; |
274 } | 274 } |
358 { | 358 { |
359 return (this->hidden->mixbuf); | 359 return (this->hidden->mixbuf); |
360 } | 360 } |
361 | 361 |
362 static int | 362 static int |
363 DSP_Init(SDL_AudioDriverImpl *impl) | 363 DSP_Init(SDL_AudioDriverImpl * impl) |
364 { | 364 { |
365 /* Set the function pointers */ | 365 /* Set the function pointers */ |
366 impl->DetectDevices = DSP_DetectDevices; | 366 impl->DetectDevices = DSP_DetectDevices; |
367 impl->GetDeviceName = DSP_GetDeviceName; | 367 impl->GetDeviceName = DSP_GetDeviceName; |
368 impl->OpenDevice = DSP_OpenDevice; | 368 impl->OpenDevice = DSP_OpenDevice; |