Mercurial > hg > audiostuff
comparison spandsp-0.0.3/spandsp-0.0.3/src/spandsp/telephony.h @ 5:f762bf195c4b
import spandsp-0.0.3
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 16:00:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:26cd8f1ef0b1 | 5:f762bf195c4b |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * telephony.h - some very basic telephony definitions | |
5 * | |
6 * Written by Steve Underwood <steveu@coppice.org> | |
7 * | |
8 * Copyright (C) 2003 Steve Underwood | |
9 * | |
10 * All rights reserved. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License version 2, as | |
14 * published by the Free Software Foundation. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 * $Id: telephony.h,v 1.9 2006/11/28 16:59:57 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_TELEPHONY_H_) | |
29 #define _TELEPHONY_H_ | |
30 | |
31 #define SAMPLE_RATE 8000 | |
32 | |
33 /* This is based on A-law, but u-law is only 0.03dB different */ | |
34 #define DBM0_MAX_POWER (3.14f + 3.02f) | |
35 #define DBM0_MAX_SINE_POWER (3.14f) | |
36 /* This is based on the ITU definition of dbOv in G.100.1 */ | |
37 #define DBOV_MAX_POWER (0.0f) | |
38 #define DBOV_MAX_SINE_POWER (-3.02f) | |
39 | |
40 /*! \brief A handler for pure receive. The buffer cannot be altered. */ | |
41 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); | |
42 | |
43 /*! \brief A handler for receive, where the buffer can be altered. */ | |
44 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); | |
45 | |
46 /*! \brief A handler for transmit, where the buffer will be filled. */ | |
47 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len); | |
48 | |
49 #define ms_to_samples(t) (((t)*SAMPLE_RATE)/1000) | |
50 | |
51 #if !defined(FALSE) | |
52 #define FALSE 0 | |
53 #endif | |
54 #if !defined(TRUE) | |
55 #define TRUE (!FALSE) | |
56 #endif | |
57 | |
58 #if defined(__cplusplus) | |
59 /* C++ doesn't seem to have sane rounding functions/macros yet */ | |
60 #ifndef _MSC_VER | |
61 #define lrint(x) ((long int) (x)) | |
62 #define lrintf(x) ((long int) (x)) | |
63 #endif | |
64 #endif | |
65 | |
66 #endif | |
67 /*- End of file ------------------------------------------------------------*/ |