annotate ext/openal-soft/OpenAL32/Include/bs2b.h @ 335:162662bf5c8a

PyChan fixes: * Fixed stupidity.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 24 Aug 2009 14:53:17 +0000
parents fa33cda75471
children
rev   line source
89
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 /*-
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 * Copyright (c) 2005 Boris Mikhaylov
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 *
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 * Permission is hereby granted, free of charge, to any person obtaining
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 * a copy of this software and associated documentation files (the
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 * "Software"), to deal in the Software without restriction, including
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 * without limitation the rights to use, copy, modify, merge, publish,
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 * distribute, sublicense, and/or sell copies of the Software, and to
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 * permit persons to whom the Software is furnished to do so, subject to
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 * the following conditions:
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 *
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 * The above copyright notice and this permission notice shall be
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 * included in all copies or substantial portions of the Software.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 *
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 #ifndef BS2B_H
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25 #define BS2B_H
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27 /* Number of crossfeed levels */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 #define BS2B_CLEVELS 3
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 /* Normal crossfeed levels */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31 #define BS2B_HIGH_CLEVEL 3
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 #define BS2B_MIDDLE_CLEVEL 2
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 #define BS2B_LOW_CLEVEL 1
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 /* Easy crossfeed levels */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 #define BS2B_HIGH_ECLEVEL BS2B_HIGH_CLEVEL + BS2B_CLEVELS
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 #define BS2B_MIDDLE_ECLEVEL BS2B_MIDDLE_CLEVEL + BS2B_CLEVELS
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 #define BS2B_LOW_ECLEVEL BS2B_LOW_CLEVEL + BS2B_CLEVELS
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40 /* Default crossfeed levels */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 #define BS2B_DEFAULT_CLEVEL BS2B_HIGH_ECLEVEL
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 /* Default sample rate (Hz) */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 #define BS2B_DEFAULT_SRATE 44100
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 #ifdef __cplusplus
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46 extern "C" {
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47 #endif /* __cplusplus */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49 struct bs2b {
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 int level; /* Crossfeed level */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51 int srate; /* Sample rate (Hz) */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
53 /* Lowpass IIR filter coefficients */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
54 double a0_lo;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
55 double b1_lo;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
56
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
57 /* Highboost IIR filter coefficients */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
58 double a0_hi;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59 double a1_hi;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 double b1_hi;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
61
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
62 /* Global gain against overloading */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
63 double gain;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
64
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
65 /* Buffer of last filtered sample.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
66 * [0] - first channel, [1] - second channel
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
67 */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 struct t_last_sample {
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69 double asis[2];
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 double lo[2];
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 double hi[2];
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 } last_sample;
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73 };
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75 /* Clear buffers and set new coefficients with new crossfeed level value.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
76 * level - crossfeed level of *LEVEL values.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
77 */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
78 void bs2b_set_level(struct bs2b *bs2b, int level);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
79
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 /* Return current crossfeed level value */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81 int bs2b_get_level(struct bs2b *bs2b);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
82
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
83 /* Clear buffers and set new coefficients with new sample rate value.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
84 * srate - sample rate by Hz.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
85 */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
86 void bs2b_set_srate(struct bs2b *bs2b, int srate);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
87
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
88 /* Return current sample rate value */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
89 int bs2b_get_srate(struct bs2b *bs2b);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
90
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
91 /* Clear buffer */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
92 void bs2b_clear(struct bs2b *bs2b);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
94 /* Return 1 if buffer is clear */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
95 int bs2b_is_clear(struct bs2b *bs2b);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
96
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
97 /* Crossfeeds one stereo sample that are pointed by sample.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 * [0] - first channel, [1] - second channel.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99 * Returns crossfided samle by sample pointer.
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
100 */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102 /* sample poits to floats */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 void bs2b_cross_feed(struct bs2b *bs2b, float *sample);
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
104
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
105 #ifdef __cplusplus
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
106 } /* extern "C" */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 #endif /* __cplusplus */
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108
fa33cda75471 * Reverting back to 2543 as requested by sleek
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109 #endif /* BS2B_H */