shithub: libsamplerate

Download patch

ref: 42b64e659d1a8468b1296636d088257d326dc248
parent: 1c2109140514fa74d15a9e7ed8b1b6d3af5e94d5
author: Erik de Castro Lopo <erikd@mingus>
date: Wed Dec 28 16:55:48 EST 2005

sndfile-resample.c : Exit if SRC ratio is 1.0.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-resample.c
+    Exit if SRC ratio is 1.0. Suggested by Bram de Jong.
+
 2005-11-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/timewarp-file.c
--- a/examples/sndfile-resample.c
+++ b/examples/sndfile-resample.c
@@ -119,6 +119,12 @@
 		exit (1) ;
 		} ;
 
+	if (fabs (src_ratio - 1.0) < 1e-20)
+	{	printf ("Target samplerate and input samplerate are the same. Exiting.\n") ;
+		sf_close (infile) ;
+		exit (0) ;
+		} ;
+
 	printf ("SRC Ratio     : %f\n", src_ratio) ;
 	printf ("Converter     : %s\n\n", src_get_name (converter)) ;