telephony.h

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.12 2008/04/17 14:27:01 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_TELEPHONY_H_)
00029 #define _SPANDSP_TELEPHONY_H_
00030 
00031 #define SAMPLE_RATE             8000
00032 
00033 /* This is based on A-law, but u-law is only 0.03dB different */
00034 #define DBM0_MAX_POWER          (3.14f + 3.02f)
00035 #define DBM0_MAX_SINE_POWER     (3.14f)
00036 /* This is based on the ITU definition of dbOv in G.100.1 */
00037 #define DBOV_MAX_POWER          (0.0f)
00038 #define DBOV_MAX_SINE_POWER     (-3.02f)
00039 
00040 /*! \brief A handler for pure receive. The buffer cannot be altered. */
00041 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len);
00042 
00043 /*! \brief A handler for receive, where the buffer can be altered. */
00044 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len);
00045 
00046 /*! \brief A handler for transmit, where the buffer will be filled. */
00047 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len);
00048 
00049 #define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
00050 
00051 #if !defined(FALSE)
00052 #define FALSE 0
00053 #endif
00054 #if !defined(TRUE)
00055 #define TRUE (!FALSE)
00056 #endif
00057 
00058 #if defined(__cplusplus)
00059 /* C++ doesn't seem to have sane rounding functions/macros yet */
00060 #ifndef _MSC_VER
00061 #define lrint(x) ((long int) (x))
00062 #define lrintf(x) ((long int) (x))
00063 #endif
00064 #endif
00065 
00066 #endif
00067 /*- End of file ------------------------------------------------------------*/

Generated on Tue Oct 7 20:25:49 2008 for spandsp by  doxygen 1.5.6