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