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 * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $ 00026 */ 00027 00028 #if !defined(_SPANDSP_TELEPHONY_H_) 00029 #define _SPANDSP_TELEPHONY_H_ 00030 00031 #if defined(_M_IX86) || defined(_M_X64) 00032 #if defined(LIBSPANDSP_EXPORTS) 00033 #define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall 00034 #define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl 00035 #define SPAN_DECLARE_DATA __declspec(dllexport) 00036 #else 00037 #define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall 00038 #define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl 00039 #define SPAN_DECLARE_DATA __declspec(dllimport) 00040 #endif 00041 #elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__)) 00042 #define SPAN_DECLARE(type) __attribute__((visibility("default"))) type 00043 #define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type 00044 #define SPAN_DECLARE_DATA __attribute__((visibility("default"))) 00045 #else 00046 #define SPAN_DECLARE(type) /**/ type 00047 #define SPAN_DECLARE_NONSTD(type) /**/ type 00048 #define SPAN_DECLARE_DATA /**/ 00049 #endif 00050 00051 #define SAMPLE_RATE 8000 00052 00053 /* This is based on A-law, but u-law is only 0.03dB different */ 00054 #define DBM0_MAX_POWER (3.14f + 3.02f) 00055 #define DBM0_MAX_SINE_POWER (3.14f) 00056 /* This is based on the ITU definition of dbOv in G.100.1 */ 00057 #define DBOV_MAX_POWER (0.0f) 00058 #define DBOV_MAX_SINE_POWER (-3.02f) 00059 00060 /*! \brief A handler for pure receive. The buffer cannot be altered. */ 00061 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); 00062 00063 /*! \brief A handler for receive, where the buffer can be altered. */ 00064 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); 00065 00066 /*! \brief A handler for missing receive data fill-in. */ 00067 typedef int (span_rx_fillin_handler_t)(void *s, int len); 00068 00069 /*! \brief A handler for transmit, where the buffer will be filled. */ 00070 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len); 00071 00072 #define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000)) 00073 #define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE)) 00074 00075 #if !defined(FALSE) 00076 #define FALSE 0 00077 #endif 00078 #if !defined(TRUE) 00079 #define TRUE (!FALSE) 00080 #endif 00081 00082 #if defined(__cplusplus) 00083 /* C++ doesn't seem to have sane rounding functions/macros yet */ 00084 #if !defined(WIN32) 00085 #define lrint(x) ((long int) (x)) 00086 #define lrintf(x) ((long int) (x)) 00087 #endif 00088 #endif 00089 00090 #endif 00091 /*- End of file ------------------------------------------------------------*/