rlm@0
|
1 #ifndef _AL_SOURCE_H_
|
rlm@0
|
2 #define _AL_SOURCE_H_
|
rlm@0
|
3
|
rlm@0
|
4 #define MAX_SENDS 4
|
rlm@0
|
5
|
rlm@0
|
6 #include "alFilter.h"
|
rlm@0
|
7 #include "alu.h"
|
rlm@0
|
8 #include "AL/al.h"
|
rlm@0
|
9
|
rlm@0
|
10 #ifdef __cplusplus
|
rlm@0
|
11 extern "C" {
|
rlm@0
|
12 #endif
|
rlm@0
|
13
|
rlm@0
|
14 #define SRC_HISTORY_BITS (6)
|
rlm@0
|
15 #define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
|
rlm@0
|
16 #define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
|
rlm@0
|
17
|
rlm@0
|
18 extern enum Resampler DefaultResampler;
|
rlm@0
|
19
|
rlm@0
|
20 extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
|
rlm@0
|
21 extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
|
rlm@0
|
22
|
rlm@0
|
23
|
rlm@0
|
24 typedef struct ALbufferlistitem
|
rlm@0
|
25 {
|
rlm@0
|
26 struct ALbuffer *buffer;
|
rlm@0
|
27 struct ALbufferlistitem *next;
|
rlm@0
|
28 struct ALbufferlistitem *prev;
|
rlm@0
|
29 } ALbufferlistitem;
|
rlm@0
|
30
|
rlm@0
|
31 typedef struct ALsource
|
rlm@0
|
32 {
|
rlm@0
|
33 ALfloat flPitch;
|
rlm@0
|
34 ALfloat flGain;
|
rlm@0
|
35 ALfloat flOuterGain;
|
rlm@0
|
36 ALfloat flMinGain;
|
rlm@0
|
37 ALfloat flMaxGain;
|
rlm@0
|
38 ALfloat flInnerAngle;
|
rlm@0
|
39 ALfloat flOuterAngle;
|
rlm@0
|
40 ALfloat flRefDistance;
|
rlm@0
|
41 ALfloat flMaxDistance;
|
rlm@0
|
42 ALfloat flRollOffFactor;
|
rlm@0
|
43 ALfloat vPosition[3];
|
rlm@0
|
44 ALfloat vVelocity[3];
|
rlm@0
|
45 ALfloat vOrientation[3];
|
rlm@0
|
46 ALboolean bHeadRelative;
|
rlm@0
|
47 ALboolean bLooping;
|
rlm@0
|
48 enum DistanceModel DistanceModel;
|
rlm@0
|
49 ALboolean VirtualChannels;
|
rlm@0
|
50
|
rlm@0
|
51 enum Resampler Resampler;
|
rlm@0
|
52
|
rlm@0
|
53 ALenum state;
|
rlm@0
|
54 ALenum new_state;
|
rlm@0
|
55 ALuint position;
|
rlm@0
|
56 ALuint position_fraction;
|
rlm@0
|
57
|
rlm@0
|
58 struct ALbuffer *Buffer;
|
rlm@0
|
59
|
rlm@0
|
60 ALbufferlistitem *queue; // Linked list of buffers in queue
|
rlm@0
|
61 ALuint BuffersInQueue; // Number of buffers in queue
|
rlm@0
|
62 ALuint BuffersPlayed; // Number of buffers played on this loop
|
rlm@0
|
63
|
rlm@0
|
64 ALfilter DirectFilter;
|
rlm@0
|
65
|
rlm@0
|
66 struct {
|
rlm@0
|
67 struct ALeffectslot *Slot;
|
rlm@0
|
68 ALfilter WetFilter;
|
rlm@0
|
69 } Send[MAX_SENDS];
|
rlm@0
|
70
|
rlm@0
|
71 ALboolean DryGainHFAuto;
|
rlm@0
|
72 ALboolean WetGainAuto;
|
rlm@0
|
73 ALboolean WetGainHFAuto;
|
rlm@0
|
74 ALfloat OuterGainHF;
|
rlm@0
|
75
|
rlm@0
|
76 ALfloat AirAbsorptionFactor;
|
rlm@0
|
77 ALfloat RoomRolloffFactor;
|
rlm@0
|
78 ALfloat DopplerFactor;
|
rlm@0
|
79
|
rlm@0
|
80 ALint lOffset;
|
rlm@0
|
81 ALint lOffsetType;
|
rlm@0
|
82
|
rlm@0
|
83 // Source Type (Static, Streaming, or Undetermined)
|
rlm@0
|
84 ALint lSourceType;
|
rlm@0
|
85
|
rlm@0
|
86 ALuint NumChannels;
|
rlm@0
|
87 ALuint SampleSize;
|
rlm@0
|
88
|
rlm@0
|
89 /* HRTF info */
|
rlm@0
|
90 ALboolean HrtfMoving;
|
rlm@0
|
91 ALuint HrtfCounter;
|
rlm@0
|
92 ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
|
rlm@0
|
93 ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
|
rlm@0
|
94 ALuint HrtfOffset;
|
rlm@0
|
95
|
rlm@0
|
96 /* Current target parameters used for mixing */
|
rlm@0
|
97 struct {
|
rlm@0
|
98 MixerFunc DoMix;
|
rlm@0
|
99
|
rlm@0
|
100 ALint Step;
|
rlm@0
|
101
|
rlm@0
|
102 ALfloat HrtfGain;
|
rlm@0
|
103 ALfloat HrtfDir[3];
|
rlm@0
|
104 ALfloat HrtfCoeffs[MAXCHANNELS][HRIR_LENGTH][2];
|
rlm@0
|
105 ALuint HrtfDelay[MAXCHANNELS][2];
|
rlm@0
|
106 ALfloat HrtfCoeffStep[HRIR_LENGTH][2];
|
rlm@0
|
107 ALint HrtfDelayStep[2];
|
rlm@0
|
108
|
rlm@0
|
109 /* A mixing matrix. First subscript is the channel number of the input
|
rlm@0
|
110 * data (regardless of channel configuration) and the second is the
|
rlm@0
|
111 * channel target (eg. FRONT_LEFT) */
|
rlm@0
|
112 ALfloat DryGains[MAXCHANNELS][MAXCHANNELS];
|
rlm@0
|
113
|
rlm@0
|
114 FILTER iirFilter;
|
rlm@0
|
115 ALfloat history[MAXCHANNELS*2];
|
rlm@0
|
116
|
rlm@0
|
117 struct {
|
rlm@0
|
118 struct ALeffectslot *Slot;
|
rlm@0
|
119 ALfloat WetGain;
|
rlm@0
|
120 FILTER iirFilter;
|
rlm@0
|
121 ALfloat history[MAXCHANNELS];
|
rlm@0
|
122 } Send[MAX_SENDS];
|
rlm@0
|
123 } Params;
|
rlm@0
|
124 ALboolean NeedsUpdate;
|
rlm@0
|
125
|
rlm@0
|
126 ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
|
rlm@0
|
127
|
rlm@0
|
128 // Index to itself
|
rlm@0
|
129 ALuint source;
|
rlm@0
|
130 } ALsource;
|
rlm@0
|
131 #define ALsource_Update(s,a) ((s)->Update(s,a))
|
rlm@0
|
132
|
rlm@0
|
133 ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
|
rlm@0
|
134 ALboolean ApplyOffset(ALsource *Source);
|
rlm@0
|
135
|
rlm@0
|
136 ALvoid ReleaseALSources(ALCcontext *Context);
|
rlm@0
|
137
|
rlm@0
|
138 #ifdef __cplusplus
|
rlm@0
|
139 }
|
rlm@0
|
140 #endif
|
rlm@0
|
141
|
rlm@0
|
142 #endif
|