[Asterisk-cvs] zaptel fxotune.c,1.21,1.22

mattf mattf
Thu Aug 11 10:45:23 CDT 2005


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv27615

Modified Files:
	fxotune.c 
Log Message:
Let's generate a valid sample for our wave form


Index: fxotune.c
===================================================================
RCS file: /usr/cvsroot/zaptel/fxotune.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- fxotune.c	11 Aug 2005 13:33:35 -0000	1.21
+++ fxotune.c	11 Aug 2005 14:48:42 -0000	1.22
@@ -34,7 +34,7 @@
 #define BUFFER_LENGTH 8000			/* 4000 sample buffers */
 #define SKIP_BYTES 1600
 
-#define PI 3.14
+static const float loudness = 16384.0;
 
 static char *zappath = "/dev/zap";
 static char *configfile = "/etc/fxotune.conf";
@@ -56,7 +56,7 @@
  * Returns a 16bit slinear sample. */
 static short inline gentone(int hz, int index)
 {
-	return sinf(index * 2 * PI * hz/8000);
+	return loudness * sin((index * 2.0 * M_PI * hz)/8000);
 }
 
 /* Returns the power of the buffer of samples in 16bit slinear format.




More information about the svn-commits mailing list