1 |
1626 |
jcastillo |
/* $Id: isdn_audio.h,v 1.1 2005-12-20 10:16:56 jcastillo Exp $
|
2 |
|
|
|
3 |
|
|
* Linux ISDN subsystem, audio conversion and compression (linklevel).
|
4 |
|
|
*
|
5 |
|
|
* Copyright 1994-1998 by Fritz Elfert (fritz@isdn4linux.de)
|
6 |
|
|
*
|
7 |
|
|
* This program is free software; you can redistribute it and/or modify
|
8 |
|
|
* it under the terms of the GNU General Public License as published by
|
9 |
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
10 |
|
|
* any later version.
|
11 |
|
|
*
|
12 |
|
|
* This program is distributed in the hope that it will be useful,
|
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU General Public License
|
18 |
|
|
* along with this program; if not, write to the Free Software
|
19 |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
20 |
|
|
*
|
21 |
|
|
* $Log: not supported by cvs2svn $
|
22 |
|
|
* Revision 1.1.1.1 2001/09/10 07:44:18 simons
|
23 |
|
|
* Initial import
|
24 |
|
|
*
|
25 |
|
|
* Revision 1.1.1.1 2001/07/02 17:58:31 simons
|
26 |
|
|
* Initial revision
|
27 |
|
|
*
|
28 |
|
|
* Revision 1.5.2.2 1998/11/05 22:11:39 fritz
|
29 |
|
|
* Changed mail-address.
|
30 |
|
|
*
|
31 |
|
|
* Revision 1.5.2.1 1998/08/22 16:43:06 armin
|
32 |
|
|
* Added silence detection in audio receive mode (AT+VSD).
|
33 |
|
|
*
|
34 |
|
|
* Revision 1.5 1997/02/03 22:45:21 fritz
|
35 |
|
|
* Reformatted according CodingStyle
|
36 |
|
|
*
|
37 |
|
|
* Revision 1.4 1996/06/06 14:43:32 fritz
|
38 |
|
|
* Changed to support DTMF decoding on audio playback also.
|
39 |
|
|
*
|
40 |
|
|
* Revision 1.3 1996/06/05 02:24:09 fritz
|
41 |
|
|
* Added DTMF decoder for audio mode.
|
42 |
|
|
*
|
43 |
|
|
* Revision 1.2 1996/05/10 08:48:32 fritz
|
44 |
|
|
* Corrected adpcm bugs.
|
45 |
|
|
*
|
46 |
|
|
* Revision 1.1 1996/04/30 09:29:06 fritz
|
47 |
|
|
* Taken under CVS control.
|
48 |
|
|
*
|
49 |
|
|
*/
|
50 |
|
|
|
51 |
|
|
#define DTMF_NPOINTS 205 /* Number of samples for DTMF recognition */
|
52 |
|
|
typedef struct adpcm_state {
|
53 |
|
|
int a;
|
54 |
|
|
int d;
|
55 |
|
|
int word;
|
56 |
|
|
int nleft;
|
57 |
|
|
int nbits;
|
58 |
|
|
} adpcm_state;
|
59 |
|
|
|
60 |
|
|
typedef struct dtmf_state {
|
61 |
|
|
char last;
|
62 |
|
|
int idx;
|
63 |
|
|
int buf[DTMF_NPOINTS];
|
64 |
|
|
} dtmf_state;
|
65 |
|
|
|
66 |
|
|
typedef struct silence_state {
|
67 |
|
|
int state;
|
68 |
|
|
unsigned int idx;
|
69 |
|
|
} silence_state;
|
70 |
|
|
|
71 |
|
|
extern void isdn_audio_ulaw2alaw(unsigned char *, unsigned long);
|
72 |
|
|
extern void isdn_audio_alaw2ulaw(unsigned char *, unsigned long);
|
73 |
|
|
extern adpcm_state *isdn_audio_adpcm_init(adpcm_state *, int);
|
74 |
|
|
extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int);
|
75 |
|
|
extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int);
|
76 |
|
|
extern int isdn_audio_2adpcm_flush(adpcm_state * s, unsigned char *out);
|
77 |
|
|
extern void isdn_audio_calc_dtmf(modem_info *, unsigned char *, int, int);
|
78 |
|
|
extern void isdn_audio_eval_dtmf(modem_info *);
|
79 |
|
|
dtmf_state *isdn_audio_dtmf_init(dtmf_state *);
|
80 |
|
|
extern void isdn_audio_calc_silence(modem_info *, unsigned char *, int, int);
|
81 |
|
|
extern void isdn_audio_eval_silence(modem_info *);
|
82 |
|
|
silence_state *isdn_audio_silence_init(silence_state *);
|