comparison src/audio/ums/SDL_umsaudio.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
82 return 1; 82 return 1;
83 } 83 }
84 84
85 static void Audio_DeleteDevice(_THIS) 85 static void Audio_DeleteDevice(_THIS)
86 { 86 {
87 if(this->hidden->playbuf._buffer) free(this->hidden->playbuf._buffer); 87 if(this->hidden->playbuf._buffer) SDL_free(this->hidden->playbuf._buffer);
88 if(this->hidden->fillbuf._buffer) free(this->hidden->fillbuf._buffer); 88 if(this->hidden->fillbuf._buffer) SDL_free(this->hidden->fillbuf._buffer);
89 _somFree( this->hidden->umsdev ); 89 _somFree( this->hidden->umsdev );
90 free(this->hidden); 90 SDL_free(this->hidden);
91 free(this); 91 SDL_free(this);
92 } 92 }
93 93
94 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 94 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
95 { 95 {
96 SDL_AudioDevice *this; 96 SDL_AudioDevice *this;
97 97
98 /* 98 /*
99 * Allocate and initialize management storage and private management 99 * Allocate and initialize management storage and private management
100 * storage for this SDL-using library. 100 * storage for this SDL-using library.
101 */ 101 */
102 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 102 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
103 if ( this ) { 103 if ( this ) {
104 memset(this, 0, (sizeof *this)); 104 SDL_memset(this, 0, (sizeof *this));
105 this->hidden = (struct SDL_PrivateAudioData *)malloc((sizeof *this->hidden)); 105 this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc((sizeof *this->hidden));
106 } 106 }
107 if ( (this == NULL) || (this->hidden == NULL) ) { 107 if ( (this == NULL) || (this->hidden == NULL) ) {
108 SDL_OutOfMemory(); 108 SDL_OutOfMemory();
109 if ( this ) { 109 if ( this ) {
110 free(this); 110 SDL_free(this);
111 } 111 }
112 return(0); 112 return(0);
113 } 113 }
114 memset(this->hidden, 0, (sizeof *this->hidden)); 114 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
115 #ifdef DEBUG_AUDIO 115 #ifdef DEBUG_AUDIO
116 fprintf(stderr, "Creating UMS Audio device\n"); 116 fprintf(stderr, "Creating UMS Audio device\n");
117 #endif 117 #endif
118 118
119 /* 119 /*
202 } 202 }
203 } 203 }
204 while(samplesToWrite>0); 204 while(samplesToWrite>0);
205 205
206 SDL_LockAudio(); 206 SDL_LockAudio();
207 memcpy( &swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer) ); 207 SDL_memcpy( &swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer) );
208 memcpy( &this->hidden->playbuf, &this->hidden->fillbuf, sizeof(UMSAudioTypes_Buffer) ); 208 SDL_memcpy( &this->hidden->playbuf, &this->hidden->fillbuf, sizeof(UMSAudioTypes_Buffer) );
209 memcpy( &this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer) ); 209 SDL_memcpy( &this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer) );
210 SDL_UnlockAudio(); 210 SDL_UnlockAudio();
211 211
212 #ifdef DEBUG_AUDIO 212 #ifdef DEBUG_AUDIO
213 fprintf(stderr, "Wrote audio data and swapped buffer\n"); 213 fprintf(stderr, "Wrote audio data and swapped buffer\n");
214 #endif 214 #endif
328 this->hidden->bytesPerSample = (bitsPerSample / 8) * spec->channels; 328 this->hidden->bytesPerSample = (bitsPerSample / 8) * spec->channels;
329 samplesPerSec = this->hidden->bytesPerSample * outRate; 329 samplesPerSec = this->hidden->bytesPerSample * outRate;
330 330
331 this->hidden->playbuf._length = 0; 331 this->hidden->playbuf._length = 0;
332 this->hidden->playbuf._maximum = spec->size; 332 this->hidden->playbuf._maximum = spec->size;
333 this->hidden->playbuf._buffer = (unsigned char*)malloc(spec->size); 333 this->hidden->playbuf._buffer = (unsigned char*)SDL_malloc(spec->size);
334 this->hidden->fillbuf._length = 0; 334 this->hidden->fillbuf._length = 0;
335 this->hidden->fillbuf._maximum = spec->size; 335 this->hidden->fillbuf._maximum = spec->size;
336 this->hidden->fillbuf._buffer = (unsigned char*)malloc(spec->size); 336 this->hidden->fillbuf._buffer = (unsigned char*)SDL_malloc(spec->size);
337 337
338 rc = UADSetBitsPerSample(this, bitsPerSample ); 338 rc = UADSetBitsPerSample(this, bitsPerSample );
339 rc = UADSetDMABufferSize(this, frag_spec, &outBufSize ); 339 rc = UADSetDMABufferSize(this, frag_spec, &outBufSize );
340 rc = UADSetChannels(this, spec->channels); /* functions reduces to mono or stereo */ 340 rc = UADSetChannels(this, spec->channels); /* functions reduces to mono or stereo */
341 341