src/wav.c : For u-law and A-law files, write an 18 byte 'fmt ' chunk.

This commit is contained in:
Erik de Castro Lopo 2011-03-20 20:17:54 +11:00
parent 6b032a1b5f
commit 7cb04151b9
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2011-03-20 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/wav.c
For u-law and A-law files, write an 18 byte 'fmt ' chunk instead of a 16
byte one. Win98 accepts files with a 16 but not 18 byte 'fmt' chunk. Later
version accept 18 byte but not 16 byte.
2011-03-15 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* doc/FAQ.html

View File

@ -756,27 +756,27 @@ wav_write_fmt_chunk (SF_PRIVATE *psf)
break ;
case SF_FORMAT_ULAW :
fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ;
fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 ;
/* fmt : format, channels, samplerate */
psf_binheader_writef (psf, "4224", fmt_size, WAVE_FORMAT_MULAW, psf->sf.channels, psf->sf.samplerate) ;
/* fmt : bytespersec */
psf_binheader_writef (psf, "4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ;
/* fmt : blockalign, bitwidth */
psf_binheader_writef (psf, "22", psf->bytewidth * psf->sf.channels, 8) ;
/* fmt : blockalign, bitwidth, extrabytes */
psf_binheader_writef (psf, "222", psf->bytewidth * psf->sf.channels, 8, 0) ;
add_fact_chunk = SF_TRUE ;
break ;
case SF_FORMAT_ALAW :
fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ;
fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 ;
/* fmt : format, channels, samplerate */
psf_binheader_writef (psf, "4224", fmt_size, WAVE_FORMAT_ALAW, psf->sf.channels, psf->sf.samplerate) ;
/* fmt : bytespersec */
psf_binheader_writef (psf, "4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ;
/* fmt : blockalign, bitwidth */
psf_binheader_writef (psf, "22", psf->bytewidth * psf->sf.channels, 8) ;
/* fmt : blockalign, bitwidth, extrabytes */
psf_binheader_writef (psf, "222", psf->bytewidth * psf->sf.channels, 8, 0) ;
add_fact_chunk = SF_TRUE ;
break ;