1 |
199 |
simons |
/* $Id: isdn_audio.h,v 1.1.1.1 2001-09-10 07:44:18 simons 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/07/02 17:58:31 simons
|
23 |
|
|
* Initial revision
|
24 |
|
|
*
|
25 |
|
|
* Revision 1.5.2.2 1998/11/05 22:11:39 fritz
|
26 |
|
|
* Changed mail-address.
|
27 |
|
|
*
|
28 |
|
|
* Revision 1.5.2.1 1998/08/22 16:43:06 armin
|
29 |
|
|
* Added silence detection in audio receive mode (AT+VSD).
|
30 |
|
|
*
|
31 |
|
|
* Revision 1.5 1997/02/03 22:45:21 fritz
|
32 |
|
|
* Reformatted according CodingStyle
|
33 |
|
|
*
|
34 |
|
|
* Revision 1.4 1996/06/06 14:43:32 fritz
|
35 |
|
|
* Changed to support DTMF decoding on audio playback also.
|
36 |
|
|
*
|
37 |
|
|
* Revision 1.3 1996/06/05 02:24:09 fritz
|
38 |
|
|
* Added DTMF decoder for audio mode.
|
39 |
|
|
*
|
40 |
|
|
* Revision 1.2 1996/05/10 08:48:32 fritz
|
41 |
|
|
* Corrected adpcm bugs.
|
42 |
|
|
*
|
43 |
|
|
* Revision 1.1 1996/04/30 09:29:06 fritz
|
44 |
|
|
* Taken under CVS control.
|
45 |
|
|
*
|
46 |
|
|
*/
|
47 |
|
|
|
48 |
|
|
#define DTMF_NPOINTS 205 /* Number of samples for DTMF recognition */
|
49 |
|
|
typedef struct adpcm_state {
|
50 |
|
|
int a;
|
51 |
|
|
int d;
|
52 |
|
|
int word;
|
53 |
|
|
int nleft;
|
54 |
|
|
int nbits;
|
55 |
|
|
} adpcm_state;
|
56 |
|
|
|
57 |
|
|
typedef struct dtmf_state {
|
58 |
|
|
char last;
|
59 |
|
|
int idx;
|
60 |
|
|
int buf[DTMF_NPOINTS];
|
61 |
|
|
} dtmf_state;
|
62 |
|
|
|
63 |
|
|
typedef struct silence_state {
|
64 |
|
|
int state;
|
65 |
|
|
unsigned int idx;
|
66 |
|
|
} silence_state;
|
67 |
|
|
|
68 |
|
|
extern void isdn_audio_ulaw2alaw(unsigned char *, unsigned long);
|
69 |
|
|
extern void isdn_audio_alaw2ulaw(unsigned char *, unsigned long);
|
70 |
|
|
extern adpcm_state *isdn_audio_adpcm_init(adpcm_state *, int);
|
71 |
|
|
extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int);
|
72 |
|
|
extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int);
|
73 |
|
|
extern int isdn_audio_2adpcm_flush(adpcm_state * s, unsigned char *out);
|
74 |
|
|
extern void isdn_audio_calc_dtmf(modem_info *, unsigned char *, int, int);
|
75 |
|
|
extern void isdn_audio_eval_dtmf(modem_info *);
|
76 |
|
|
dtmf_state *isdn_audio_dtmf_init(dtmf_state *);
|
77 |
|
|
extern void isdn_audio_calc_silence(modem_info *, unsigned char *, int, int);
|
78 |
|
|
extern void isdn_audio_eval_silence(modem_info *);
|
79 |
|
|
silence_state *isdn_audio_silence_init(silence_state *);
|