summaryrefslogtreecommitdiff
path: root/gendigits.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-12-30 01:23:44 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-12-30 01:23:44 +0000
commit2476adaa0c7d95967ee3d87019094b8d41a3c3c4 (patch)
treeb5d6177b5dbeedc653a44a31d39773201b6d039c /gendigits.c
parentd044e651fa6d985368ce6c969d2840a238762b9c (diff)
Make it easier to change tone levels in gendigits (bug #3072)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@524 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'gendigits.c')
-rwxr-xr-xgendigits.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gendigits.c b/gendigits.c
index 7433e50..73141d2 100755
--- a/gendigits.c
+++ b/gendigits.c
@@ -95,9 +95,7 @@ short sample; {
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 @@ int process(FILE *f, char *label, ZAP_DIAL z[])
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 @@ int process(FILE *f, char *label, ZAP_DIAL z[])
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 @@ int main(int argc, char *argv[])
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);