changeset 9277:d824f1a3c341

The "initialize wav header with infinite lenght" broke the post-recording fixup by changing the initialisation value of data_length. This fixes it. based on patch by Olivier Galibert <galibert@pobox.com>
author arpi
date Tue, 04 Feb 2003 18:22:43 +0000
parents 9fd44bc91631
children caea8ed36b48
files libao2/ao_pcm.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_pcm.c	Tue Feb 04 17:51:39 2003 +0000
+++ b/libao2/ao_pcm.c	Tue Feb 04 18:22:43 2003 +0000
@@ -107,6 +107,9 @@
 	wavhdr.sample_rate = le2me_32(ao_data.samplerate);
 	wavhdr.bytes_per_second = le2me_32(ao_data.bps);
 	wavhdr.bits = le2me_16(bits);
+	
+	wavhdr.data_length=le2me_32(0x7ffff000);
+	wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
 
 	printf("PCM: File: %s (%s)\n"
 	       "PCM: Samplerate: %iHz Channels: %s Format %s\n",
@@ -118,8 +121,10 @@
 
 	fp = fopen(ao_outputfilename, "wb");
 	if(fp) {
-		if(ao_pcm_waveheader) /* Reserve space for wave header */
+		if(ao_pcm_waveheader){ /* Reserve space for wave header */
 			fwrite(&wavhdr,sizeof(wavhdr),1,fp);
+			wavhdr.file_length=wavhdr.data_length=0;
+		}
 		return 1;
 	}
 	printf("PCM: Failed to open %s for writing!\n", ao_outputfilename);