spandsp
0.0.6
|
00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * telephony.h - some very basic telephony definitions 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2003 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 /* This is based on A-law, but u-law is only 0.03dB different */ 00052 #define DBM0_MAX_POWER (3.14f + 3.02f) 00053 #define DBM0_MAX_SINE_POWER (3.14f) 00054 /* This is based on the ITU definition of dbOv in G.100.1 */ 00055 #define DBOV_MAX_POWER (0.0f) 00056 #define DBOV_MAX_SINE_POWER (-3.02f) 00057 00058 /*! \brief A handler for pure receive. The buffer cannot be altered. */ 00059 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); 00060 00061 /*! \brief A handler for receive, where the buffer can be altered. */ 00062 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); 00063 00064 /*! \brief A handler for missing receive data fill-in. */ 00065 typedef int (span_rx_fillin_handler_t)(void *s, int len); 00066 00067 /*! \brief A handler for transmit, where the buffer will be filled. */ 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 /* C++ doesn't seem to have sane rounding functions/macros yet */ 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 /*- End of file ------------------------------------------------------------*/