comparison src/audio/macrom/SDL_romaudio.c @ 3830:29e83f221c62 SDL-ryan-multiple-audio-device

Fixed some things to use SDL C runtime functions.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 07 Oct 2006 19:56:47 +0000
parents 1f156fd874fa
children 66fb40445587
comparison
equal deleted inserted replaced
3829:d3171647e661 3830:29e83f221c62
143 cmd.cmd = bufferCmd; 143 cmd.cmd = bufferCmd;
144 cmd.param1 = 0; 144 cmd.param1 = 0;
145 cmd.param2 = (long) &header; 145 cmd.param2 = (long) &header;
146 SndDoCommand(chan, &cmd, 0); 146 SndDoCommand(chan, &cmd, 0);
147 147
148 memset(buffer[fill_me], 0, audio->spec.size); 148 SDL_memset(buffer[fill_me], 0, audio->spec.size);
149 149
150 /* 150 /*
151 * if audio device isn't locked, mix the next buffer to be queued in 151 * if audio device isn't locked, mix the next buffer to be queued in
152 * the memory block that just finished playing. 152 * the memory block that just finished playing.
153 */ 153 */
201 break; 201 break;
202 } 202 }
203 SDL_CalculateAudioSpec(&this->spec); 203 SDL_CalculateAudioSpec(&this->spec);
204 204
205 /* initialize bufferCmd header */ 205 /* initialize bufferCmd header */
206 memset(&header, 0, sizeof(header)); 206 SDL_memset(&header, 0, sizeof(header));
207 callback = (SndCallBackUPP) NewSndCallBackUPP(callBackProc); 207 callback = (SndCallBackUPP) NewSndCallBackUPP(callBackProc);
208 sample_bits = spec->size / spec->samples / spec->channels * 8; 208 sample_bits = spec->size / spec->samples / spec->channels * 8;
209 209
210 #ifdef DEBUG_AUDIO 210 #ifdef DEBUG_AUDIO
211 fprintf(stderr, 211 fprintf(stderr,
234 header.format = kFloat32Format; 234 header.format = kFloat32Format;
235 } 235 }
236 236
237 /* allocate 2 buffers */ 237 /* allocate 2 buffers */
238 for (i = 0; i < 2; i++) { 238 for (i = 0; i < 2; i++) {
239 buffer[i] = (UInt8 *) malloc(sizeof(UInt8) * spec->size); 239 buffer[i] = (UInt8 *) SDL_malloc(sizeof(UInt8) * spec->size);
240 if (buffer[i] == NULL) { 240 if (buffer[i] == NULL) {
241 SNDMGR_CloseDevice(this); 241 SNDMGR_CloseDevice(this);
242 SDL_OutOfMemory(); 242 SDL_OutOfMemory();
243 return 0; 243 return 0;
244 } 244 }
245 memset(buffer[i], 0, spec->size); 245 SDL_memset(buffer[i], 0, spec->size);
246 } 246 }
247 247
248 /* Create the sound manager channel */ 248 /* Create the sound manager channel */
249 channel = (SndChannelPtr) SDL_malloc(sizeof(*channel)); 249 channel = (SndChannelPtr) SDL_malloc(sizeof(*channel));
250 if (channel == NULL) { 250 if (channel == NULL) {