comparison src/audio/mint/SDL_mintaudio_xbios.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 _SND present ? if not, assume ST machine */ 102 /* Cookie _SND present ? if not, assume ST machine */
122 return(1); 122 return(1);
123 } 123 }
124 124
125 static void Audio_DeleteDevice(SDL_AudioDevice *device) 125 static void Audio_DeleteDevice(SDL_AudioDevice *device)
126 { 126 {
127 free(device->hidden); 127 SDL_free(device->hidden);
128 free(device); 128 SDL_free(device);
129 } 129 }
130 130
131 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 131 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
132 { 132 {
133 SDL_AudioDevice *this; 133 SDL_AudioDevice *this;
134 134
135 /* Initialize all variables that we clean on shutdown */ 135 /* Initialize all variables that we clean on shutdown */
136 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 136 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
137 if ( this ) { 137 if ( this ) {
138 memset(this, 0, (sizeof *this)); 138 SDL_memset(this, 0, (sizeof *this));
139 this->hidden = (struct SDL_PrivateAudioData *) 139 this->hidden = (struct SDL_PrivateAudioData *)
140 malloc((sizeof *this->hidden)); 140 SDL_malloc((sizeof *this->hidden));
141 } 141 }
142 if ( (this == NULL) || (this->hidden == NULL) ) { 142 if ( (this == NULL) || (this->hidden == NULL) ) {
143 SDL_OutOfMemory(); 143 SDL_OutOfMemory();
144 if ( this ) { 144 if ( this ) {
145 free(this); 145 SDL_free(this);
146 } 146 }
147 return(0); 147 return(0);
148 } 148 }
149 memset(this->hidden, 0, (sizeof *this->hidden)); 149 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
150 150
151 /* Set the function pointers */ 151 /* Set the function pointers */
152 this->OpenAudio = Mint_OpenAudio; 152 this->OpenAudio = Mint_OpenAudio;
153 this->CloseAudio = Mint_CloseAudio; 153 this->CloseAudio = Mint_CloseAudio;
154 this->LockAudio = Mint_LockAudio; 154 this->LockAudio = Mint_LockAudio;
283 buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM); 283 buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM);
284 if (buffer==NULL) { 284 if (buffer==NULL) {
285 DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n")); 285 DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n"));
286 return; 286 return;
287 } 287 }
288 memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE); 288 SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
289 289
290 Buffoper(0); 290 Buffoper(0);
291 Settracks(0,0); 291 Settracks(0,0);
292 Setmontracks(0); 292 Setmontracks(0);
293 Setmode(MONO8); 293 Setmode(MONO8);
475 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); 475 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
476 return (-1); 476 return (-1);
477 } 477 }
478 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; 478 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
479 SDL_MintAudio_numbuf=0; 479 SDL_MintAudio_numbuf=0;
480 memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); 480 SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
481 SDL_MintAudio_audiosize = spec->size; 481 SDL_MintAudio_audiosize = spec->size;
482 SDL_MintAudio_mutex = 0; 482 SDL_MintAudio_mutex = 0;
483 483
484 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); 484 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
485 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); 485 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));