Make the buffer queue a double-linked list
[openal-soft.git] / OpenAL32 / Include / alSource.h
blob96e5393c1896af0128d5df7d6d904b44e43110e5
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 typedef enum {
15 POINT_RESAMPLER = 0,
16 LINEAR_RESAMPLER,
18 RESAMPLER_MAX,
19 RESAMPLER_MIN = -1,
20 RESAMPLER_DEFAULT = LINEAR_RESAMPLER
21 } resampler_t;
22 extern resampler_t DefaultResampler;
24 typedef struct ALbufferlistitem
26 struct ALbuffer *buffer;
27 struct ALbufferlistitem *next;
28 struct ALbufferlistitem *prev;
29 } ALbufferlistitem;
31 typedef struct ALsource
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 ALenum DistanceModel;
50 resampler_t Resampler;
52 ALenum state;
53 ALuint position;
54 ALuint position_fraction;
56 struct ALbuffer *Buffer;
58 struct ALbufferlistitem *queue; // Linked list of buffers in queue
59 ALuint BuffersInQueue; // Number of buffers in queue
60 ALuint BuffersPlayed; // Number of buffers played on this loop
62 ALfilter DirectFilter;
64 struct {
65 struct ALeffectslot *Slot;
66 ALfilter WetFilter;
67 } Send[MAX_SENDS];
69 ALboolean DryGainHFAuto;
70 ALboolean WetGainAuto;
71 ALboolean WetGainHFAuto;
72 ALfloat OuterGainHF;
74 ALfloat AirAbsorptionFactor;
75 ALfloat RoomRolloffFactor;
76 ALfloat DopplerFactor;
78 ALint lOffset;
79 ALint lOffsetType;
81 // Source Type (Static, Streaming, or Undetermined)
82 ALint lSourceType;
84 // Current target parameters used for mixing
85 ALboolean NeedsUpdate;
86 struct {
87 ALint Step;
89 ALfloat DryGains[OUTPUTCHANNELS];
90 FILTER iirFilter;
91 ALfloat history[OUTPUTCHANNELS*2];
93 struct {
94 ALfloat WetGain;
95 FILTER iirFilter;
96 ALfloat history[OUTPUTCHANNELS];
97 } Send[MAX_SENDS];
98 } Params;
100 ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
101 ALvoid (*Mix)(struct ALsource *self, ALCdevice *Device, ALuint SamplesToDo);
103 // Index to itself
104 ALuint source;
105 } ALsource;
106 #define ALsource_Update(s,a) ((s)->Update(s,a))
107 #define ALsource_Mix(s,a,b) ((s)->Mix(s,a,b))
109 ALvoid ReleaseALSources(ALCcontext *Context);
111 #ifdef __cplusplus
113 #endif
115 #endif