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