aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_morsecode.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 07:14:42 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 07:14:42 +0000
commit3496603957661f140c2dc12149107a2d6c033fd7 (patch)
tree1e9364de760f54127a74db6c8fd289dd86a70b01 /apps/app_morsecode.c
parent10af5c1ff2bc2a2787323b16b568aa4ba7ce6750 (diff)
Somebody complained the that length of the dah wasn't quite up to spec...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8051 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_morsecode.c')
-rw-r--r--apps/app_morsecode.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c
index 04c88b390..459b67640 100644
--- a/apps/app_morsecode.c
+++ b/apps/app_morsecode.c
@@ -55,12 +55,8 @@ STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
-#define TONE 440
-#define DITLEN 100
-#define DAHLEN 250
-#define DITDAHSEPLEN 50
-#define CHARSEPLEN 200
-/* Pause between words will be twice CHARSEPLEN plus DITDAHSEPLEN - 450 */
+#define TONE 800
+#define DITLEN 80
static char *morsecode[] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */
@@ -109,9 +105,9 @@ static char *morsecode[] = {
static void playtone(struct ast_channel *chan, int tone, int len)
{
char dtmf[20];
- snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, len);
+ snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, DITLEN * len);
ast_playtones_start(chan, 0, dtmf, 0);
- ast_safe_sleep(chan, len);
+ ast_safe_sleep(chan, DITLEN * len);
ast_playtones_stop(chan);
}
@@ -136,18 +132,19 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
}
for (dahdit = morsecode[(int)*digit]; *dahdit; dahdit++) {
if (*dahdit == '-') {
- playtone(chan, TONE, DAHLEN);
+ playtone(chan, TONE, 3);
} else if (*dahdit == '.') {
- playtone(chan, TONE, DITLEN);
+ playtone(chan, TONE, 1);
} else {
- playtone(chan, TONE, CHARSEPLEN);
+ /* Account for ditlen of silence immediately following */
+ playtone(chan, 0, 2);
}
/* Pause slightly between each dit and dah */
- playtone(chan, 0, DITDAHSEPLEN);
+ playtone(chan, 0, 1);
}
/* Pause between characters */
- playtone(chan, 0, CHARSEPLEN);
+ playtone(chan, 0, 2);
}
LOCAL_USER_REMOVE(u);