annotate mgw/dtmf_table.c @ 145:4b685a5d9bd4

sip-in code: split invite.c into 3 separate C modules
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 08 Oct 2022 19:31:05 -0800
parents 815e4c59162e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
126
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module holds the table of all possible DTMF tones we can generate.
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <math.h>
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "dtmf_defs.h"
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #define FREQ_697 (M_PI * 697.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #define FREQ_770 (M_PI * 770.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #define FREQ_852 (M_PI * 852.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #define FREQ_941 (M_PI * 941.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #define FREQ_1209 (M_PI * 1209.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #define FREQ_1336 (M_PI * 1336.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #define FREQ_1477 (M_PI * 1477.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define FREQ_1633 (M_PI * 1633.0 / 4000.0)
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 struct dtmf_desc dtmf_table[] = {
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {'1', FREQ_697, FREQ_1209},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {'2', FREQ_697, FREQ_1336},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {'3', FREQ_697, FREQ_1477},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 {'A', FREQ_697, FREQ_1633},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {'4', FREQ_770, FREQ_1209},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 {'5', FREQ_770, FREQ_1336},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {'6', FREQ_770, FREQ_1477},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {'B', FREQ_770, FREQ_1633},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 {'7', FREQ_852, FREQ_1209},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 {'8', FREQ_852, FREQ_1336},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {'9', FREQ_852, FREQ_1477},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 {'C', FREQ_852, FREQ_1633},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {'*', FREQ_941, FREQ_1209},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {'0', FREQ_941, FREQ_1336},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {'#', FREQ_941, FREQ_1477},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 {'D', FREQ_941, FREQ_1633},
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /* table search terminator */
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 {0, 0, 0}
815e4c59162e mgw DTMF: tone definitions and sample array generation
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 };