FreeSWITCH API Documentation  1.7.0
libteletone.h
Go to the documentation of this file.
1 /*
2  * libteletone
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is libteletone
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * libteletone.h -- Tone Generator/Detector
30  *
31  *
32  *
33  * Exception:
34  * The author hereby grants the use of this source code under the
35  * following license if and only if the source code is distributed
36  * as part of the OpenZAP or FreeTDM library. Any use or distribution of this
37  * source code outside the scope of the OpenZAP or FreeTDM library will nullify the
38  * following license and reinact the MPL 1.1 as stated above.
39  *
40  * Copyright (c) 2007, Anthony Minessale II
41  * All rights reserved.
42  *
43  * Redistribution and use in source and binary forms, with or without
44  * modification, are permitted provided that the following conditions
45  * are met:
46  *
47  * * Redistributions of source code must retain the above copyright
48  * notice, this list of conditions and the following disclaimer.
49  *
50  * * Redistributions in binary form must reproduce the above copyright
51  * notice, this list of conditions and the following disclaimer in the
52  * documentation and/or other materials provided with the distribution.
53  *
54  * * Neither the name of the original author; nor the names of any contributors
55  * may be used to endorse or promote products derived from this software
56  * without specific prior written permission.
57  *
58  *
59  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
60  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
61  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
62  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
63  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
64  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
65  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
66  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
67  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
68  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
69  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70  */
71 #ifndef LIBTELETONE_H
72 #define LIBTELETONE_H
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 #include <math.h>
79 
80 #define TELETONE_MAX_DTMF_DIGITS 128
81 #define TELETONE_MAX_TONES 18
82 #define TELETONE_TONE_RANGE 127
83 
84 typedef double teletone_process_t;
85 
86 /*! \file libteletone.h
87  \brief Top level include file
88 
89  This file should be included by applications using the library
90 */
91 
92 /*! \brief An abstraction to store a tone mapping */
93 typedef struct {
94  /*! An array of tone frequencies */
95  teletone_process_t freqs[TELETONE_MAX_TONES];
97 
98 #if !defined(M_PI)
99 /* C99 systems may not define M_PI */
100 #define M_PI 3.14159265358979323846264338327
101 #endif
102 
103 #ifdef _MSC_VER
104 typedef __int16 int16_t;
105 #endif
106 
107 #if (_MSC_VER >= 1400) // VC8+
108 #define teletone_assert(expr) assert(expr);__analysis_assume( expr )
109 #else
110 #define teletone_assert(expr) assert(expr)
111 #endif
112 
113 #ifdef _MSC_VER
114 #if defined(TT_DECLARE_STATIC)
115 #define TELETONE_API(type) type __stdcall
116 #define TELETONE_API_NONSTD(type) type __cdecl
117 #define TELETONE_API_DATA
118 #elif defined(TELETONE_EXPORTS)
119 #define TELETONE_API(type) __declspec(dllexport) type __stdcall
120 #define TELETONE_API_NONSTD(type) __declspec(dllexport) type __cdecl
121 #define TELETONE_API_DATA __declspec(dllexport)
122 #else
123 #define TELETONE_API(type) __declspec(dllimport) type __stdcall
124 #define TELETONE_API_NONSTD(type) __declspec(dllimport) type __cdecl
125 #define TELETONE_API_DATA __declspec(dllimport)
126 #endif
127 #else
128 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
129 #define TELETONE_API(type) __attribute__((visibility("default"))) type
130 #define TELETONE_API_NONSTD(type) __attribute__((visibility("default"))) type
131 #define TELETONE_API_DATA __attribute__((visibility("default")))
132 #else
133 #define TELETONE_API(type) type
134 #define TELETONE_API_NONSTD(type) type
135 #define TELETONE_API_DATA
136 #endif
137 #endif
138 
139 #include <libteletone_generate.h>
140 #include <libteletone_detect.h>
141 
142 #ifdef HAVE_STRING_H
143 #include <string.h>
144 #endif
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif
151 
152 /* For Emacs:
153  * Local Variables:
154  * mode:c
155  * indent-tabs-mode:t
156  * tab-width:4
157  * c-basic-offset:4
158  * End:
159  * For VIM:
160  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
161  */
#define TELETONE_MAX_TONES
Definition: libteletone.h:81
An abstraction to store a tone mapping.
Definition: libteletone.h:93
Tone Detection Routines.
Tone Generation Routines.
double teletone_process_t
Definition: libteletone.h:84