[asterisk-commits] russell: branch russell/jack r93168 - /team/russell/jack/apps/app_jack.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 16 11:07:51 CST 2007


Author: russell
Date: Sun Dec 16 11:07:50 2007
New Revision: 93168

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93168
Log:
Normalize samples when converting from short to float

Modified:
    team/russell/jack/apps/app_jack.c

Modified: team/russell/jack/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/apps/app_jack.c?view=diff&rev=93168&r1=93167&r2=93168
==============================================================================
--- team/russell/jack/apps/app_jack.c (original)
+++ team/russell/jack/apps/app_jack.c Sun Dec 16 11:07:50 2007
@@ -38,6 +38,8 @@
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <values.h>
 
 #include <jack/jack.h>
 #include <jack/ringbuffer.h>
@@ -300,9 +302,8 @@
 		int in_buf_used = 0;
 		int out_buf_used = 0;
 
-		/* XXX Does this need to be normalized? */
 		for (i = 0; i < f->samples; i++)
-			in_buf[i] = s_buf[i];
+			in_buf[i] = s_buf[i] * (FLT_MAX / SHRT_MAX);
 
 		while (in_buf_used < sizeof(in_buf)) {
 			int res;
@@ -330,9 +331,8 @@
 	} else {
 		/* No resampling needed */
 
-		/* XXX Does this need to be normalized? */
 		for (i = 0; i < f->samples; i++)
-			f_buf[i] = s_buf[i];
+			f_buf[i] = s_buf[i] * (FLT_MAX / SHRT_MAX);
 
 		f_buf_used = sizeof(f_buf[0]) * f->samples;
 	}




More information about the asterisk-commits mailing list