zenilib: zenilib/jni/external/openal-soft/OpenAL32/Include/alu.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
alu.h
Go to the documentation of this file.
1 #ifndef _ALU_H_
2 #define _ALU_H_
3
4 #include "alMain.h"
5
6 #include <limits.h>
7 #include <math.h>
8 #ifdef HAVE_FLOAT_H
9 #include <float.h>
10 #endif
11 #ifdef HAVE_IEEEFP_H
12 #include <ieeefp.h>
13 #endif
14
15
16 #define F_PI (3.14159265358979323846f) /* pi */
17 #define F_PI_2 (1.57079632679489661923f) /* pi/2 */
18
19 #ifndef FLT_EPSILON
20 #define FLT_EPSILON (1.19209290e-07f)
21 #endif
22
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 struct ALsource;
29 struct ALbuffer;
30 struct DirectParams;
31 struct SendParams;
32
33 typedef void (*ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment,
34 ALfloat *RESTRICT dst, ALuint dstlen);
35
36 typedef ALvoid (*DryMixerFunc)(const struct DirectParams *params,
37 const ALfloat *RESTRICT data, ALuint srcchan,
38 ALuint OutPos, ALuint SamplesToDo,
39 ALuint BufferSize);
40 typedef ALvoid (*WetMixerFunc)(const struct SendParams *params,
41 const ALfloat *RESTRICT data,
42 ALuint OutPos, ALuint SamplesToDo,
43 ALuint BufferSize);
44
45
46 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
47 #define AIRABSORBGAINHF (0.99426f) /* -0.05dB */
48
49 #define FRACTIONBITS (14)
50 #define FRACTIONONE (1<<FRACTIONBITS)
51 #define FRACTIONMASK (FRACTIONONE-1)
52
53
54 static __inline ALfloat minf(ALfloat a, ALfloat b)
55 { return ((a > b) ? b : a); }
56 static __inline ALfloat maxf(ALfloat a, ALfloat b)
57 { return ((a > b) ? a : b); }
58 static __inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max)
59 { return minf(max, maxf(min, val)); }
60
61 static __inline ALuint minu(ALuint a, ALuint b)
62 { return ((a > b) ? b : a); }
63 static __inline ALuint maxu(ALuint a, ALuint b)
64 { return ((a > b) ? a : b); }
65 static __inline ALuint clampu(ALuint val, ALuint min, ALuint max)
66 { return minu(max, maxu(min, val)); }
67
68 static __inline ALint mini(ALint a, ALint b)
69 { return ((a > b) ? b : a); }
70 static __inline ALint maxi(ALint a, ALint b)
71 { return ((a > b) ? a : b); }
72 static __inline ALint clampi(ALint val, ALint min, ALint max)
73 { return mini(max, maxi(min, val)); }
74
75 static __inline ALint64 mini64(ALint64 a, ALint64 b)
76 { return ((a > b) ? b : a); }
77 static __inline ALint64 maxi64(ALint64 a, ALint64 b)
78 { return ((a > b) ? a : b); }
79 static __inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max)
80 { return mini64(max, maxi64(min, val)); }
81
82 static __inline ALuint64 minu64(ALuint64 a, ALuint64 b)
83 { return ((a > b) ? b : a); }
84 static __inline ALuint64 maxu64(ALuint64 a, ALuint64 b)
85 { return ((a > b) ? a : b); }
86 static __inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
87 { return minu64(max, maxu64(min, val)); }
88
89
90 static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
91 {
92 return val1 + (val2-val1)*mu;
93 }
94 static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
95 {
96 ALfloat mu2 = mu*mu;
97 ALfloat a0 = -0.5f*val0 + 1.5f*val1 + -1.5f*val2 + 0.5f*val3;
98 ALfloat a1 = val0 + -2.5f*val1 + 2.0f*val2 + -0.5f*val3;
99 ALfloat a2 = -0.5f*val0 + 0.5f*val2;
100 ALfloat a3 = val1;
101
102 return a0*mu*mu2 + a1*mu2 + a2*mu + a3;
103 }
104
105
106 ALvoid aluInitPanning(ALCdevice *Device);
107
108 ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains);
109
110 ALvoid CalcSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
111 ALvoid CalcNonAttnSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
112
113 ALvoid MixSource(struct ALsource *Source, ALCdevice *Device, ALuint SamplesToDo);
114
115 ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size);
116 /* Caller must lock the device. */
117 ALvoid aluHandleDisconnect(ALCdevice *device);
118
119 extern ALfloat ConeScale;
120 extern ALfloat ZScale;
121
122 #ifdef __cplusplus
123 }
124 #endif
125
126 #endif
127
WetMixerFunc
ALvoid(* WetMixerFunc)(const struct SendParams *params, const ALfloat *RESTRICT data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
Definition: alu.h:40
val
GLuint const GLfloat * val
Definition: glew.h:2715
ALvoid
void ALvoid
Definition: al.h:74
clampu
static __inline ALuint clampu(ALuint val, ALuint min, ALuint max)
Definition: alu.h:65
DirectParams
Definition: alSource.h:49
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
lerp
static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
Definition: alu.h:90
angle
GLdouble angle
Definition: glew.h:8396
ConeScale
ALfloat ConeScale
Definition: ALu.c:46
ALsizei
int ALsizei
Definition: al.h:62
cubic
static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
Definition: alu.h:94
DryMixerFunc
ALvoid(* DryMixerFunc)(const struct DirectParams *params, const ALfloat *RESTRICT data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
Definition: alu.h:36
ALCdevice_struct
Definition: alMain.h:560
ALint
int ALint
Definition: al.h:56
aluMixData
ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
Definition: ALu.c:970
maxi
static __inline ALint maxi(ALint a, ALint b)
Definition: alu.h:70
a
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8736
mini64
static __inline ALint64 mini64(ALint64 a, ALint64 b)
Definition: alu.h:75
clampu64
static __inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
Definition: alu.h:86
clampi
static __inline ALint clampi(ALint val, ALint min, ALint max)
Definition: alu.h:72
clampf
static __inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max)
Definition: alu.h:58
maxf
static __inline ALfloat maxf(ALfloat a, ALfloat b)
Definition: alu.h:56
ALfloat
float ALfloat
Definition: al.h:68
aluHandleDisconnect
ALvoid aluHandleDisconnect(ALCdevice *device)
Definition: ALu.c:1176
params
GLenum GLvoid ** params
Definition: gl2ext.h:806
ALbuffer
Definition: alBuffer.h:69
buffer
EGLContext EGLenum EGLClientBuffer buffer
Definition: eglext.h:87
CalcSourceParams
ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
Definition: ALu.c:470
maxi64
static __inline ALint64 maxi64(ALint64 a, ALint64 b)
Definition: alu.h:77
dst
GLenum GLenum dst
Definition: glew.h:2396
alMain.h
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
MixSource
ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
Definition: mixer.c:97
ComputeAngleGains
ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains)
Definition: panning.c:149
ALuint
unsigned int ALuint
Definition: al.h:59
minu64
static __inline ALuint64 minu64(ALuint64 a, ALuint64 b)
Definition: alu.h:82
minu
static __inline ALuint minu(ALuint a, ALuint b)
Definition: alu.h:61
maxu64
static __inline ALuint64 maxu64(ALuint64 a, ALuint64 b)
Definition: alu.h:84
ZScale
ALfloat ZScale
Definition: ALu.c:49
aluInitPanning
ALvoid aluInitPanning(ALCdevice *Device)
Definition: panning.c:343
ALCcontext_struct
Definition: alMain.h:675
b
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
ALsource
Definition: alSource.h:82
minf
static __inline ALfloat minf(ALfloat a, ALfloat b)
Definition: alu.h:54
CalcNonAttnSourceParams
ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
Definition: ALu.c:193
mini
static __inline ALint mini(ALint a, ALint b)
Definition: alu.h:68
min
#define min(x, y)
Definition: os.h:75
src
GLenum src
Definition: glew.h:2396
clampi64
static __inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max)
Definition: alu.h:79
ResamplerFunc
void(* ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *RESTRICT dst, ALuint dstlen)
Definition: alu.h:33
max
#define max(x, y)
Definition: os.h:79
SendParams
Definition: alSource.h:69
maxu
static __inline ALuint maxu(ALuint a, ALuint b)
Definition: alu.h:63
size
GLsizei size
Definition: gl2ext.h:1467