comparison src/audio/mint/SDL_mintaudio_mcsn.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 12c49532be00
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
82 /*--- Audio driver bootstrap functions ---*/ 82 /*--- Audio driver bootstrap functions ---*/
83 83
84 static int Audio_Available(void) 84 static int Audio_Available(void)
85 { 85 {
86 unsigned long dummy; 86 unsigned long dummy;
87 const char *envr = getenv("SDL_AUDIODRIVER"); 87 const char *envr = SDL_getenv("SDL_AUDIODRIVER");
88 88
89 SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); 89 SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
90 90
91 /* We can't use XBIOS in interrupt with Magic, don't know about thread */ 91 /* We can't use XBIOS in interrupt with Magic, don't know about thread */
92 if (Getcookie(C_MagX, &dummy) == C_FOUND) { 92 if (Getcookie(C_MagX, &dummy) == C_FOUND) {
93 return(0); 93 return(0);
94 } 94 }
95 95
96 /* Check if user asked a different audio driver */ 96 /* Check if user asked a different audio driver */
97 if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { 97 if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
98 DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); 98 DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
99 return(0); 99 return(0);
100 } 100 }
101 101
102 /* Cookie _MCH present ? if not, assume ST machine */ 102 /* Cookie _MCH present ? if not, assume ST machine */
139 return(1); 139 return(1);
140 } 140 }
141 141
142 static void Audio_DeleteDevice(SDL_AudioDevice *device) 142 static void Audio_DeleteDevice(SDL_AudioDevice *device)
143 { 143 {
144 free(device->hidden); 144 SDL_free(device->hidden);
145 free(device); 145 SDL_free(device);
146 } 146 }
147 147
148 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 148 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
149 { 149 {
150 SDL_AudioDevice *this; 150 SDL_AudioDevice *this;
151 151
152 /* Initialize all variables that we clean on shutdown */ 152 /* Initialize all variables that we clean on shutdown */
153 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 153 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
154 if ( this ) { 154 if ( this ) {
155 memset(this, 0, (sizeof *this)); 155 SDL_memset(this, 0, (sizeof *this));
156 this->hidden = (struct SDL_PrivateAudioData *) 156 this->hidden = (struct SDL_PrivateAudioData *)
157 malloc((sizeof *this->hidden)); 157 SDL_malloc((sizeof *this->hidden));
158 } 158 }
159 if ( (this == NULL) || (this->hidden == NULL) ) { 159 if ( (this == NULL) || (this->hidden == NULL) ) {
160 SDL_OutOfMemory(); 160 SDL_OutOfMemory();
161 if ( this ) { 161 if ( this ) {
162 free(this); 162 SDL_free(this);
163 } 163 }
164 return(0); 164 return(0);
165 } 165 }
166 memset(this->hidden, 0, (sizeof *this->hidden)); 166 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
167 167
168 /* Set the function pointers */ 168 /* Set the function pointers */
169 this->OpenAudio = Mint_OpenAudio; 169 this->OpenAudio = Mint_OpenAudio;
170 this->CloseAudio = Mint_CloseAudio; 170 this->CloseAudio = Mint_CloseAudio;
171 this->LockAudio = Mint_LockAudio; 171 this->LockAudio = Mint_LockAudio;
386 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); 386 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
387 return (-1); 387 return (-1);
388 } 388 }
389 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; 389 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
390 SDL_MintAudio_numbuf=0; 390 SDL_MintAudio_numbuf=0;
391 memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); 391 SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
392 SDL_MintAudio_audiosize = spec->size; 392 SDL_MintAudio_audiosize = spec->size;
393 SDL_MintAudio_mutex = 0; 393 SDL_MintAudio_mutex = 0;
394 394
395 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); 395 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
396 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); 396 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));