summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-08-11 14:48:42 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-08-11 14:48:42 +0000
commit4deee2187194f1747158e51e0ac7198f5a24f8e8 (patch)
treeb0504454ffdd596dfc960964714966500e5f5a0d
parent175c10988e98321542ec6e57d67d3ca8d859e688 (diff)
Let's generate a valid sample for our wave form
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@731 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xfxotune.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fxotune.c b/fxotune.c
index 04f89ed..07fb834 100755
--- a/fxotune.c
+++ b/fxotune.c
@@ -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 @@ static int debug = 0;
* 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.