summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-08-26 16:55:25 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-08-26 16:55:25 +0000
commitb473449ca6cb4eed2d80176ab928badc9cded840 (patch)
treed0538f2b0f060d53a862fed98868fd973d64aaab
parent7e0441c99f1cae94e43fa75a6c13971079098e0f (diff)
Improvements to fxotune. It should work now :-)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@748 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xfxotune.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fxotune.c b/fxotune.c
index 07fb834..26de87a 100755
--- a/fxotune.c
+++ b/fxotune.c
@@ -84,10 +84,7 @@ static float power_of(void *prebuf, int bufsize, int short_format)
numsamples = bufsize / 2;
for (i = 0; i < numsamples; i++) {
-#if 0
- sum_of_squares += ((float)sbuf[i] * (float)sbuf[i])/(float)32768;
-#endif
- sum_of_squares += ((float)sbuf[i] * (float)sbuf[i]);
+ sum_of_squares += ((float)sbuf[i] * (float)sbuf[i])/(float)loudness;
if (sbuf[i] > 0) {
square_of_sums += (float)sbuf[i];
} else {
@@ -532,10 +529,10 @@ set:
printf("Tuning module %d", i + 1);
res = acim_tune(fd, argv[2]); /* Shouldn't matter what digit we press */
- if (!res)
- printf("Done!\n");
- else
+ if (res < 0)
printf("Failure!\n");
+ else
+ printf("Done!\n");
close(fd);
if (res > -1) {