comparison src/audio/mint/SDL_mintaudio_gsxb.c @ 704:c4803992e09c

Small bugfixes
author Patrice Mandin <patmandin@gmail.com>
date Sat, 30 Aug 2003 20:00:11 +0000
parents 594422ab8f9f
children b8d311d90021
comparison
equal deleted inserted replaced
703:ca809c1b41ca 704:c4803992e09c
212 int i, resolution, format_signed, format_bigendian; 212 int i, resolution, format_signed, format_bigendian;
213 213
214 resolution = spec->format & 0x00ff; 214 resolution = spec->format & 0x00ff;
215 format_signed = ((spec->format & 0x8000)!=0); 215 format_signed = ((spec->format & 0x8000)!=0);
216 format_bigendian = ((spec->format & 0x1000)!=0); 216 format_bigendian = ((spec->format & 0x1000)!=0);
217 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",resolution)); 217
218 DEBUG_PRINT(("signed=%d, ", format_signed)); 218 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
219 DEBUG_PRINT(("big endian=%d, ", format_bigendian)); 219 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
220 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
220 DEBUG_PRINT(("channels=%d, ", spec->channels)); 221 DEBUG_PRINT(("channels=%d, ", spec->channels));
221 DEBUG_PRINT(("freq=%d\n", spec->freq)); 222 DEBUG_PRINT(("freq=%d\n", spec->freq));
222 223
223 /* Check formats available */ 224 /* Check formats available */
224 snd_format = Sndstatus(SND_QUERYFORMATS); 225 snd_format = Sndstatus(SND_QUERYFORMATS);
266 } else if (snd_format & SND_FORMATLITTLEENDIAN) { 267 } else if (snd_format & SND_FORMATLITTLEENDIAN) {
267 /* Give little endian format */ 268 /* Give little endian format */
268 spec->format = spec->format & (~0x1000); 269 spec->format = spec->format & (~0x1000);
269 } 270 }
270 } else { 271 } else {
271 if (snd_format & SND_FORMATBIGENDIAN) { 272 if (snd_format & SND_FORMATLITTLEENDIAN) {
272 /* Ok */ 273 /* Ok */
273 } else if (snd_format & SND_FORMATLITTLEENDIAN) { 274 } else if (snd_format & SND_FORMATBIGENDIAN) {
274 /* Give big endian format */ 275 /* Give big endian format */
275 spec->format |= 0x1000; 276 spec->format |= 0x1000;
276 } 277 }
277 } 278 }
278 279
287 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 1, spec->freq); 288 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 1, spec->freq);
288 spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq]; 289 spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq];
289 290
290 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); 291 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
291 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); 292 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
292 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); 293 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
293 DEBUG_PRINT(("channels=%d, ", spec->channels)); 294 DEBUG_PRINT(("channels=%d, ", spec->channels));
294 DEBUG_PRINT(("freq=%d\n", spec->freq)); 295 DEBUG_PRINT(("freq=%d\n", spec->freq));
295 296
296 return 0; 297 return 0;
297 } 298 }
366 } 367 }
367 368
368 SDL_CalculateAudioSpec(spec); 369 SDL_CalculateAudioSpec(spec);
369 370
370 /* Allocate memory for audio buffers in DMA-able RAM */ 371 /* Allocate memory for audio buffers in DMA-able RAM */
371 spec->size = spec->samples;
372 spec->size *= spec->channels;
373 spec->size *= (spec->format & 0xFF)/8;
374
375 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); 372 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
376 373
377 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); 374 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
378 if (SDL_MintAudio_audiobuf[0]==NULL) { 375 if (SDL_MintAudio_audiobuf[0]==NULL) {
379 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); 376 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");