comparison 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
comparison
equal deleted inserted replaced
125:5081f2bc6f1c 126:815e4c59162e
1 /*
2 * This module holds the table of all possible DTMF tones we can generate.
3 */
4
5 #include <math.h>
6 #include <stdint.h>
7 #include "dtmf_defs.h"
8
9 #define FREQ_697 (M_PI * 697.0 / 4000.0)
10 #define FREQ_770 (M_PI * 770.0 / 4000.0)
11 #define FREQ_852 (M_PI * 852.0 / 4000.0)
12 #define FREQ_941 (M_PI * 941.0 / 4000.0)
13 #define FREQ_1209 (M_PI * 1209.0 / 4000.0)
14 #define FREQ_1336 (M_PI * 1336.0 / 4000.0)
15 #define FREQ_1477 (M_PI * 1477.0 / 4000.0)
16 #define FREQ_1633 (M_PI * 1633.0 / 4000.0)
17
18 struct dtmf_desc dtmf_table[] = {
19 {'1', FREQ_697, FREQ_1209},
20 {'2', FREQ_697, FREQ_1336},
21 {'3', FREQ_697, FREQ_1477},
22 {'A', FREQ_697, FREQ_1633},
23 {'4', FREQ_770, FREQ_1209},
24 {'5', FREQ_770, FREQ_1336},
25 {'6', FREQ_770, FREQ_1477},
26 {'B', FREQ_770, FREQ_1633},
27 {'7', FREQ_852, FREQ_1209},
28 {'8', FREQ_852, FREQ_1336},
29 {'9', FREQ_852, FREQ_1477},
30 {'C', FREQ_852, FREQ_1633},
31 {'*', FREQ_941, FREQ_1209},
32 {'0', FREQ_941, FREQ_1336},
33 {'#', FREQ_941, FREQ_1477},
34 {'D', FREQ_941, FREQ_1633},
35 /* table search terminator */
36 {0, 0, 0}
37 };