comparison src/audio/nas/SDL_nasaudio.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 c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
64 return 1; 64 return 1;
65 } 65 }
66 66
67 static void Audio_DeleteDevice(SDL_AudioDevice *device) 67 static void Audio_DeleteDevice(SDL_AudioDevice *device)
68 { 68 {
69 free(device->hidden); 69 SDL_free(device->hidden);
70 free(device); 70 SDL_free(device);
71 } 71 }
72 72
73 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 73 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
74 { 74 {
75 SDL_AudioDevice *this; 75 SDL_AudioDevice *this;
76 76
77 /* Initialize all variables that we clean on shutdown */ 77 /* Initialize all variables that we clean on shutdown */
78 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 78 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
79 if ( this ) { 79 if ( this ) {
80 memset(this, 0, (sizeof *this)); 80 SDL_memset(this, 0, (sizeof *this));
81 this->hidden = (struct SDL_PrivateAudioData *) 81 this->hidden = (struct SDL_PrivateAudioData *)
82 malloc((sizeof *this->hidden)); 82 SDL_malloc((sizeof *this->hidden));
83 } 83 }
84 if ( (this == NULL) || (this->hidden == NULL) ) { 84 if ( (this == NULL) || (this->hidden == NULL) ) {
85 SDL_OutOfMemory(); 85 SDL_OutOfMemory();
86 if ( this ) { 86 if ( this ) {
87 free(this); 87 SDL_free(this);
88 } 88 }
89 return(0); 89 return(0);
90 } 90 }
91 memset(this->hidden, 0, (sizeof *this->hidden)); 91 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
92 92
93 /* Set the function pointers */ 93 /* Set the function pointers */
94 this->OpenAudio = NAS_OpenAudio; 94 this->OpenAudio = NAS_OpenAudio;
95 this->WaitAudio = NAS_WaitAudio; 95 this->WaitAudio = NAS_WaitAudio;
96 this->PlayAudio = NAS_PlayAudio; 96 this->PlayAudio = NAS_PlayAudio;
291 this->hidden->mixlen = spec->size; 291 this->hidden->mixlen = spec->size;
292 this->hidden->mixbuf = (Uint8 *)SDL_AllocAudioMem(this->hidden->mixlen); 292 this->hidden->mixbuf = (Uint8 *)SDL_AllocAudioMem(this->hidden->mixlen);
293 if ( this->hidden->mixbuf == NULL ) { 293 if ( this->hidden->mixbuf == NULL ) {
294 return(-1); 294 return(-1);
295 } 295 }
296 memset(this->hidden->mixbuf, spec->silence, spec->size); 296 SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
297 297
298 /* Get the parent process id (we're the parent of the audio thread) */ 298 /* Get the parent process id (we're the parent of the audio thread) */
299 this->hidden->parent = getpid(); 299 this->hidden->parent = getpid();
300 300
301 /* We're ready to rock and roll. :-) */ 301 /* We're ready to rock and roll. :-) */