view OpenAL32/Include/alSource.h @ 32:b8bc24918d63

moved ear.org into cortex
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 01:43:33 -0700
parents f9476ff7637e
children
line wrap: on
line source
1 #ifndef _AL_SOURCE_H_
2 #define _AL_SOURCE_H_
4 #define MAX_SENDS 4
6 #include "alFilter.h"
7 #include "alu.h"
8 #include "AL/al.h"
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
14 #define SRC_HISTORY_BITS (6)
15 #define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
16 #define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
18 extern enum Resampler DefaultResampler;
20 extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
21 extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
24 typedef struct ALbufferlistitem
25 {
26 struct ALbuffer *buffer;
27 struct ALbufferlistitem *next;
28 struct ALbufferlistitem *prev;
29 } ALbufferlistitem;
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;
51 enum Resampler Resampler;
53 ALenum state;
54 ALenum new_state;
55 ALuint position;
56 ALuint position_fraction;
58 struct ALbuffer *Buffer;
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
64 ALfilter DirectFilter;
66 struct {
67 struct ALeffectslot *Slot;
68 ALfilter WetFilter;
69 } Send[MAX_SENDS];
71 ALboolean DryGainHFAuto;
72 ALboolean WetGainAuto;
73 ALboolean WetGainHFAuto;
74 ALfloat OuterGainHF;
76 ALfloat AirAbsorptionFactor;
77 ALfloat RoomRolloffFactor;
78 ALfloat DopplerFactor;
80 ALint lOffset;
81 ALint lOffsetType;
83 // Source Type (Static, Streaming, or Undetermined)
84 ALint lSourceType;
86 ALuint NumChannels;
87 ALuint SampleSize;
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;
96 /* Current target parameters used for mixing */
97 struct {
98 MixerFunc DoMix;
100 ALint Step;
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];
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];
114 FILTER iirFilter;
115 ALfloat history[MAXCHANNELS*2];
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;
126 ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
128 // Index to itself
129 ALuint source;
130 } ALsource;
131 #define ALsource_Update(s,a) ((s)->Update(s,a))
133 ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
134 ALboolean ApplyOffset(ALsource *Source);
136 ALvoid ReleaseALSources(ALCcontext *Context);
138 #ifdef __cplusplus
139 }
140 #endif
142 #endif