Mercurial > hg > xemacs-beta
comparison src/libst.h @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
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 #define SAMPLES_PER_SECOND 8192 | |
16 | |
17 #define MINLIN -32768 | |
18 #define MAXLIN 32767 | |
19 #define LINCLIP(x) do { if ( x < MINLIN ) x = MINLIN ; else if ( x > MAXLIN ) x = MAXLIN; } while ( 0 ) | |
20 | |
21 unsigned char st_linear_to_ulaw( /* int sample */ ); | |
22 int st_ulaw_to_linear_slow( /* unsigned char ulawbyte */ ); | |
23 | |
24 /* | |
25 ** This macro converts from ulaw to 16 bit linear, faster. | |
26 ** | |
27 ** Jef Poskanzer | |
28 ** 23 October 1989 | |
29 ** | |
30 ** Input: 8 bit ulaw sample | |
31 ** Output: signed 16 bit linear sample | |
32 */ | |
33 #define st_ulaw_to_linear(ulawbyte) ulaw_table[ulawbyte] | |
34 | |
35 static int ulaw_table[256] = { | |
36 -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, | |
37 -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, | |
38 -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412, | |
39 -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, | |
40 -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, | |
41 -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, | |
42 -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, | |
43 -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, | |
44 -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, | |
45 -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, | |
46 -876, -844, -812, -780, -748, -716, -684, -652, | |
47 -620, -588, -556, -524, -492, -460, -428, -396, | |
48 -372, -356, -340, -324, -308, -292, -276, -260, | |
49 -244, -228, -212, -196, -180, -164, -148, -132, | |
50 -120, -112, -104, -96, -88, -80, -72, -64, | |
51 -56, -48, -40, -32, -24, -16, -8, 0, | |
52 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, | |
53 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, | |
54 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, | |
55 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, | |
56 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, | |
57 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, | |
58 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, | |
59 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, | |
60 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, | |
61 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, | |
62 876, 844, 812, 780, 748, 716, 684, 652, | |
63 620, 588, 556, 524, 492, 460, 428, 396, | |
64 372, 356, 340, 324, 308, 292, 276, 260, | |
65 244, 228, 212, 196, 180, 164, 148, 132, | |
66 120, 112, 104, 96, 88, 80, 72, 64, | |
67 56, 48, 40, 32, 24, 16, 8, 0 }; |