diff mgw/dtmf_table.c @ 126:815e4c59162e

mgw DTMF: tone definitions and sample array generation
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 01 Oct 2022 17:09:51 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mgw/dtmf_table.c	Sat Oct 01 17:09:51 2022 -0800
@@ -0,0 +1,37 @@
+/*
+ * This module holds the table of all possible DTMF tones we can generate.
+ */
+
+#include <math.h>
+#include <stdint.h>
+#include "dtmf_defs.h"
+
+#define	FREQ_697	(M_PI * 697.0 / 4000.0)
+#define	FREQ_770	(M_PI * 770.0 / 4000.0)
+#define	FREQ_852	(M_PI * 852.0 / 4000.0)
+#define	FREQ_941	(M_PI * 941.0 / 4000.0)
+#define	FREQ_1209	(M_PI * 1209.0 / 4000.0)
+#define	FREQ_1336	(M_PI * 1336.0 / 4000.0)
+#define	FREQ_1477	(M_PI * 1477.0 / 4000.0)
+#define	FREQ_1633	(M_PI * 1633.0 / 4000.0)
+
+struct dtmf_desc dtmf_table[] = {
+	{'1', FREQ_697, FREQ_1209},
+	{'2', FREQ_697, FREQ_1336},
+	{'3', FREQ_697, FREQ_1477},
+	{'A', FREQ_697, FREQ_1633},
+	{'4', FREQ_770, FREQ_1209},
+	{'5', FREQ_770, FREQ_1336},
+	{'6', FREQ_770, FREQ_1477},
+	{'B', FREQ_770, FREQ_1633},
+	{'7', FREQ_852, FREQ_1209},
+	{'8', FREQ_852, FREQ_1336},
+	{'9', FREQ_852, FREQ_1477},
+	{'C', FREQ_852, FREQ_1633},
+	{'*', FREQ_941, FREQ_1209},
+	{'0', FREQ_941, FREQ_1336},
+	{'#', FREQ_941, FREQ_1477},
+	{'D', FREQ_941, FREQ_1633},
+	/* table search terminator */
+	{0, 0, 0}
+};