zenilib: zenilib/jni/external/openal-soft/OpenAL32/Include/bs2b.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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