[Asterisk-cvs] zaptel gendigits.c,1.3,1.4
markster at lists.digium.com
markster at lists.digium.com
Wed Dec 29 20:28:59 CST 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv22738
Modified Files:
gendigits.c
Log Message:
Make it easier to change tone levels in gendigits (bug #3072)
Index: gendigits.c
===================================================================
RCS file: /usr/cvsroot/zaptel/gendigits.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gendigits.c 19 Mar 2002 20:48:40 -0000 1.3
+++ gendigits.c 30 Dec 2004 01:23:44 -0000 1.4
@@ -95,9 +95,7 @@
return(ulawbyte);
}
-#define LEVEL -10
-
-int process(FILE *f, char *label, ZAP_DIAL z[])
+int process(FILE *f, char *label, ZAP_DIAL z[], float low_tone_level, float high_tone_level)
{
char c;
float gain;
@@ -111,12 +109,12 @@
if (c == '#')
c ='p';
/* Bring it down 6 dbm */
- gain = pow(10.0, (LEVEL - 3.14) / 20.0) * 65536.0 / 2.0;
-
+ gain = pow(10.0, (low_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
fac1 = 2.0 * cos(2.0 * M_PI * (z->f1 / 8000.0)) * 32768.0;
init_v2_1 = sin(-4.0 * M_PI * (z->f1 / 8000.0)) * gain;
init_v3_1 = sin(-2.0 * M_PI * (z->f1 / 8000.0)) * gain;
+ gain = pow(10.0, (high_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
fac2 = 2.0 * cos(2.0 * M_PI * (z->f2 / 8000.0)) * 32768.0;
init_v2_2 = sin(-4.0 * M_PI * (z->f2 / 8000.0)) * gain;
init_v3_2 = sin(-2.0 * M_PI * (z->f2 / 8000.0)) * gain;
@@ -131,6 +129,16 @@
return 0;
}
+/* The following are the levels for the low tones (LEVEL1) and the high tones
+ (LEVEL2) of DTMF digits, in dBm0. If you need to adjust these levels, this
+ is the place to do it */
+#define LEVEL_DTMF_LOW -10
+#define LEVEL_DTMF_HIGH -10
+
+/* The following is the level for the tones in MF digits, in dBm0. If you
+ need to adjust this level, this is the place to do it */
+#define LEVEL_MF -10
+
int main(int argc, char *argv[])
{
FILE *f;
@@ -139,10 +147,10 @@
fprintf(f, "/* DTMF and MF tones used by the Tormenta Driver, in static tables.\n"
" Generated automatically from gendigits. Do not edit by hand. */\n");
fprintf(f, "static struct zt_tone dtmf_tones[16] = {\n");
- process(f, "dtmf", dtmf_dial);
+ process(f, "dtmf", dtmf_dial, LEVEL_DTMF_LOW, LEVEL_DTMF_HIGH);
fprintf(f, "};\n\n");
fprintf(f, "static struct zt_tone mfv1_tones[15] = {\n");
- process(f, "mfv1", mf_dial);
+ process(f, "mfv1", mf_dial, LEVEL_MF, LEVEL_MF);
fprintf(f, "};\n\n");
fprintf(f, "/* END tones.h */\n");
fclose(f);
More information about the svn-commits
mailing list