comparison src/audio/alsa/SDL_alsa_audio.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents 1cbaeee565b1
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
168 168
169 static const char *get_audio_device(int channels) 169 static const char *get_audio_device(int channels)
170 { 170 {
171 const char *device; 171 const char *device;
172 172
173 device = getenv("AUDIODEV"); /* Is there a standard variable name? */ 173 device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
174 if ( device == NULL ) { 174 if ( device == NULL ) {
175 if (channels == 6) device = "surround51"; 175 if (channels == 6) device = "surround51";
176 else if (channels == 4) device = "surround40"; 176 else if (channels == 4) device = "surround40";
177 else device = DEFAULT_DEVICE; 177 else device = DEFAULT_DEVICE;
178 } 178 }
200 return(available); 200 return(available);
201 } 201 }
202 202
203 static void Audio_DeleteDevice(SDL_AudioDevice *device) 203 static void Audio_DeleteDevice(SDL_AudioDevice *device)
204 { 204 {
205 free(device->hidden); 205 SDL_free(device->hidden);
206 free(device); 206 SDL_free(device);
207 UnloadALSALibrary(); 207 UnloadALSALibrary();
208 } 208 }
209 209
210 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 210 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
211 { 211 {
212 SDL_AudioDevice *this; 212 SDL_AudioDevice *this;
213 213
214 /* Initialize all variables that we clean on shutdown */ 214 /* Initialize all variables that we clean on shutdown */
215 LoadALSALibrary(); 215 LoadALSALibrary();
216 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 216 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
217 if ( this ) { 217 if ( this ) {
218 memset(this, 0, (sizeof *this)); 218 SDL_memset(this, 0, (sizeof *this));
219 this->hidden = (struct SDL_PrivateAudioData *) 219 this->hidden = (struct SDL_PrivateAudioData *)
220 malloc((sizeof *this->hidden)); 220 SDL_malloc((sizeof *this->hidden));
221 } 221 }
222 if ( (this == NULL) || (this->hidden == NULL) ) { 222 if ( (this == NULL) || (this->hidden == NULL) ) {
223 SDL_OutOfMemory(); 223 SDL_OutOfMemory();
224 if ( this ) { 224 if ( this ) {
225 free(this); 225 SDL_free(this);
226 } 226 }
227 return(0); 227 return(0);
228 } 228 }
229 memset(this->hidden, 0, (sizeof *this->hidden)); 229 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
230 230
231 /* Set the function pointers */ 231 /* Set the function pointers */
232 this->OpenAudio = ALSA_OpenAudio; 232 this->OpenAudio = ALSA_OpenAudio;
233 this->WaitAudio = ALSA_WaitAudio; 233 this->WaitAudio = ALSA_WaitAudio;
234 this->PlayAudio = ALSA_PlayAudio; 234 this->PlayAudio = ALSA_PlayAudio;
433 mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); 433 mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
434 if ( mixbuf == NULL ) { 434 if ( mixbuf == NULL ) {
435 ALSA_CloseAudio(this); 435 ALSA_CloseAudio(this);
436 return(-1); 436 return(-1);
437 } 437 }
438 memset(mixbuf, spec->silence, spec->size); 438 SDL_memset(mixbuf, spec->silence, spec->size);
439 439
440 /* Get the parent process id (we're the parent of the audio thread) */ 440 /* Get the parent process id (we're the parent of the audio thread) */
441 parent = getpid(); 441 parent = getpid();
442 442
443 /* Switch to blocking mode for playback */ 443 /* Switch to blocking mode for playback */