shithub: libsamplerate

Download patch

ref: aff4ab16e14426c362e80032b9e489a6fc733845
parent: e3755e2cef4c44aa630b2949f4489420edcafb4b
author: Erik de Castro Lopo <erikd@miles>
date: Tue Jun 15 07:44:47 EDT 2004

Fix : must truncate output file if restarting conversion in sndfile-resample.

--- a/examples/sndfile-resample.c
+++ b/examples/sndfile-resample.c
@@ -233,6 +233,8 @@
 	if (max > 1.0)
 	{	*gain = 1.0 / max ;
 		printf ("\nOutput has clipped. Restarting conversion to prevent clipping.\n\n") ;
+		output_count = 0 ;
+		sf_command (outfile, SFC_FILE_TRUNCATE, &output_count, sizeof (output_count)) ;
 		return -1 ;
 		} ;