comparison decoders/wav.c @ 193:6cd07211a235

Added some debugging output in preparation for future codecs (gsm, maybe?)
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 02 Jan 2002 01:09:02 +0000
parents 6bb68b3bdcf1
children c9772a9f5271
comparison
equal deleted inserted replaced
192:5b311ffabe45 193:6cd07211a235
554 return(read_fmt_adpcm(rw, fmt)); 554 return(read_fmt_adpcm(rw, fmt));
555 555
556 /* add other types here. */ 556 /* add other types here. */
557 557
558 default: 558 default:
559 SNDDBG(("WAV: Format %lu is unknown.\n", 559 SNDDBG(("WAV: Format 0x%X is unknown.\n",
560 (unsigned int) fmt->wFormatTag)); 560 (unsigned int) fmt->wFormatTag));
561 Sound_SetError("WAV: Unsupported format"); 561 Sound_SetError("WAV: Unsupported format");
562 return(0); /* not supported whatsoever. */ 562 return(0); /* not supported whatsoever. */
563 } /* switch */ 563 } /* switch */
564 564
608 BAIL_IF_MACRO(!find_chunk(rw, fmtID), "WAV: No format chunk.", 0); 608 BAIL_IF_MACRO(!find_chunk(rw, fmtID), "WAV: No format chunk.", 0);
609 BAIL_IF_MACRO(!read_fmt_chunk(rw, fmt), "WAV: Can't read format chunk.", 0); 609 BAIL_IF_MACRO(!read_fmt_chunk(rw, fmt), "WAV: Can't read format chunk.", 0);
610 610
611 sample->actual.channels = (Uint8) fmt->wChannels; 611 sample->actual.channels = (Uint8) fmt->wChannels;
612 sample->actual.rate = fmt->dwSamplesPerSec; 612 sample->actual.rate = fmt->dwSamplesPerSec;
613 if (fmt->wBitsPerSample == 4) 613 if ((fmt->wBitsPerSample == 4) /*|| (fmt->wBitsPerSample == 0) */ )
614 sample->actual.format = AUDIO_S16SYS; /* !!! FIXME ? */ 614 sample->actual.format = AUDIO_S16SYS; /* !!! FIXME ? */
615 else if (fmt->wBitsPerSample == 8) 615 else if (fmt->wBitsPerSample == 8)
616 sample->actual.format = AUDIO_U8; 616 sample->actual.format = AUDIO_U8;
617 else if (fmt->wBitsPerSample == 16) 617 else if (fmt->wBitsPerSample == 16)
618 sample->actual.format = AUDIO_S16LSB; 618 sample->actual.format = AUDIO_S16LSB;
619 else 619 else
620 {
621 SNDDBG(("WAV: %d bits per sample!?\n", (int) fmt->wBitsPerSample));
620 BAIL_MACRO("WAV: Unsupported sample size.", 0); 622 BAIL_MACRO("WAV: Unsupported sample size.", 0);
623 } /* else */
621 624
622 BAIL_IF_MACRO(!read_fmt(rw, fmt), NULL, 0); 625 BAIL_IF_MACRO(!read_fmt(rw, fmt), NULL, 0);
623 BAIL_IF_MACRO(!find_chunk(rw, dataID), "WAV: No data chunk.", 0); 626 BAIL_IF_MACRO(!find_chunk(rw, dataID), "WAV: No data chunk.", 0);
624 BAIL_IF_MACRO(!read_data_chunk(rw, &d), "WAV: Can't read data chunk.", 0); 627 BAIL_IF_MACRO(!read_data_chunk(rw, &d), "WAV: Can't read data chunk.", 0);
625 628