Partially sync files.el from XEmacs 21.5 for wildcard support.
[sxemacs] / src / libst.h
1 /* libst.h - include file for portable sound tools library
2 **
3 ** Copyright (C) 1989 by Jef Poskanzer.
4 **
5 ** Permission to use, copy, modify, and distribute this software and its
6 ** documentation for any purpose and without fee is hereby granted, provided
7 ** that the above copyright notice appear in all copies and that both that
8 ** copyright notice and this permission notice appear in supporting
9 ** documentation.  This software is provided "as is" without express or
10 ** implied warranty.
11 */
12
13 /* Synched up with: Not in FSF. */
14
15 #ifndef INCLUDED_libst_h_
16 #define INCLUDED_libst_h_
17
18 #define SAMPLES_PER_SECOND 8192
19
20 #define MINLIN -32768
21 #define MAXLIN 32767
22 #define LINCLIP(x) do { if ( x < MINLIN ) x = MINLIN ; else if ( x > MAXLIN ) x = MAXLIN; } while ( 0 )
23
24 unsigned char st_linear_to_ulaw( /* int sample */ );
25 int st_ulaw_to_linear_slow( /* unsigned char ulawbyte */ );
26
27 /*
28 ** This macro converts from ulaw to 16 bit linear, faster.
29 **
30 ** Jef Poskanzer
31 ** 23 October 1989
32 **
33 ** Input: 8 bit ulaw sample
34 ** Output: signed 16 bit linear sample
35 */
36 #define st_ulaw_to_linear(ulawbyte) ulaw_table[ulawbyte]
37
38 static int ulaw_table[256] = {
39         -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
40         -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
41         -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
42         -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
43         -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
44         -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
45         -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
46         -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
47         -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
48         -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
49         -876, -844, -812, -780, -748, -716, -684, -652,
50         -620, -588, -556, -524, -492, -460, -428, -396,
51         -372, -356, -340, -324, -308, -292, -276, -260,
52         -244, -228, -212, -196, -180, -164, -148, -132,
53         -120, -112, -104, -96, -88, -80, -72, -64,
54         -56, -48, -40, -32, -24, -16, -8, 0,
55         32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
56         23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
57         15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
58         11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
59         7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
60         5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
61         3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
62         2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
63         1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
64         1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
65         876, 844, 812, 780, 748, 716, 684, 652,
66         620, 588, 556, 524, 492, 460, 428, 396,
67         372, 356, 340, 324, 308, 292, 276, 260,
68         244, 228, 212, 196, 180, 164, 148, 132,
69         120, 112, 104, 96, 88, 80, 72, 64,
70         56, 48, 40, 32, 24, 16, 8, 0
71 };
72
73 #endif                          /* INCLUDED_libst_h_ */