shithub: libsamplerate

Download patch

ref: ad15d5dea00cb8bc8b249ff8231827b84bcecd21
parent: 3e36e65d36431635e42f9a5910171a86b9816e77
author: Erik de Castro Lopo <erikd@mingus>
date: Fri May 26 06:39:17 EDT 2006

tests/calc_snr.c : Fix minor bug in analysis routines.

--- a/tests/calc_snr.c
+++ b/tests/calc_snr.c
@@ -158,11 +158,12 @@
 			{	peaks [peak_count].peak = magnitude [k] ;
 				peaks [peak_count].index = k ;
 				peak_count ++ ;
+				qsort (peaks, peak_count, sizeof (PEAK_DATA), peak_compare) ;
 				}
 			else if (magnitude [k] > peaks [MAX_PEAKS - 1].peak)
-			{	qsort (peaks, MAX_PEAKS, sizeof (PEAK_DATA), peak_compare) ;
-				peaks [MAX_PEAKS - 1].peak = magnitude [k] ;
+			{	peaks [MAX_PEAKS - 1].peak = magnitude [k] ;
 				peaks [MAX_PEAKS - 1].index = k ;
+				qsort (peaks, MAX_PEAKS, sizeof (PEAK_DATA), peak_compare) ;
 				} ;
 			} ;
 		} ;