00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #if !defined(_SPANDSP_TELEPHONY_H_)
00027 #define _SPANDSP_TELEPHONY_H_
00028
00029 #if defined(_M_IX86) || defined(_M_X64)
00030 #if defined(LIBSPANDSP_EXPORTS)
00031 #define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall
00032 #define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
00033 #define SPAN_DECLARE_DATA __declspec(dllexport)
00034 #else
00035 #define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall
00036 #define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
00037 #define SPAN_DECLARE_DATA __declspec(dllimport)
00038 #endif
00039 #elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__))
00040 #define SPAN_DECLARE(type) __attribute__((visibility("default"))) type
00041 #define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
00042 #define SPAN_DECLARE_DATA __attribute__((visibility("default")))
00043 #else
00044 #define SPAN_DECLARE(type) type
00045 #define SPAN_DECLARE_NONSTD(type) type
00046 #define SPAN_DECLARE_DATA
00047 #endif
00048
00049 #define SAMPLE_RATE 8000
00050
00051
00052 #define DBM0_MAX_POWER (3.14f + 3.02f)
00053 #define DBM0_MAX_SINE_POWER (3.14f)
00054
00055 #define DBOV_MAX_POWER (0.0f)
00056 #define DBOV_MAX_SINE_POWER (-3.02f)
00057
00058
00059 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len);
00060
00061
00062 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len);
00063
00064
00065 typedef int (span_rx_fillin_handler_t)(void *s, int len);
00066
00067
00068 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len);
00069
00070 #define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000))
00071 #define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE))
00072
00073 #if !defined(FALSE)
00074 #define FALSE 0
00075 #endif
00076 #if !defined(TRUE)
00077 #define TRUE (!FALSE)
00078 #endif
00079
00080 #if defined(__cplusplus)
00081
00082 #if !defined(WIN32)
00083 #define lrint(x) ((long int) (x))
00084 #define lrintf(x) ((long int) (x))
00085 #endif
00086 #endif
00087
00088 #endif
00089