Free Electron
alSource.h
1 #ifndef _AL_SOURCE_H_
2 #define _AL_SOURCE_H_
3 
4 #include "bool.h"
5 #include "alMain.h"
6 #include "alu.h"
7 #include "hrtf.h"
8 #include "atomic.h"
9 
10 #define MAX_SENDS 16
11 #define DEFAULT_SENDS 2
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 struct ALbuffer;
18 struct ALsource;
19 
20 
21 typedef struct ALbufferlistitem {
22  ATOMIC(struct ALbufferlistitem*) next;
23  ALsizei max_samples;
24  ALsizei num_buffers;
25  struct ALbuffer *buffers[];
26 } ALbufferlistitem;
27 
28 
29 typedef struct ALsource {
30  /** Source properties. */
31  ALfloat Pitch;
32  ALfloat Gain;
33  ALfloat OuterGain;
34  ALfloat MinGain;
35  ALfloat MaxGain;
36  ALfloat InnerAngle;
37  ALfloat OuterAngle;
38  ALfloat RefDistance;
39  ALfloat MaxDistance;
40  ALfloat RolloffFactor;
41  ALfloat Position[3];
42  ALfloat Velocity[3];
43  ALfloat Direction[3];
44  ALfloat Orientation[2][3];
45  ALboolean HeadRelative;
46  ALboolean Looping;
47  enum DistanceModel DistanceModel;
48  enum Resampler Resampler;
49  ALboolean DirectChannels;
50  enum SpatializeMode Spatialize;
51 
52  ALboolean DryGainHFAuto;
53  ALboolean WetGainAuto;
54  ALboolean WetGainHFAuto;
55  ALfloat OuterGainHF;
56 
57  ALfloat AirAbsorptionFactor;
58  ALfloat RoomRolloffFactor;
59  ALfloat DopplerFactor;
60 
61  /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
62  * rather than clockwise.
63  */
64  ALfloat StereoPan[2];
65 
66  ALfloat Radius;
67 
68  /** Direct filter and auxiliary send info. */
69  struct {
70  ALfloat Gain;
71  ALfloat GainHF;
72  ALfloat HFReference;
73  ALfloat GainLF;
74  ALfloat LFReference;
75  } Direct;
76  struct {
77  struct ALeffectslot *Slot;
78  ALfloat Gain;
79  ALfloat GainHF;
80  ALfloat HFReference;
81  ALfloat GainLF;
82  ALfloat LFReference;
83  } *Send;
84 
85  /**
86  * Last user-specified offset, and the offset type (bytes, samples, or
87  * seconds).
88  */
89  ALdouble Offset;
90  ALenum OffsetType;
91 
92  /** Source type (static, streaming, or undetermined) */
93  ALint SourceType;
94 
95  /** Source state (initial, playing, paused, or stopped) */
96  ALenum state;
97 
98  /** Source Buffer Queue head. */
99  ALbufferlistitem *queue;
100 
101  ATOMIC_FLAG PropsClean;
102 
103  /* Index into the context's Voices array. Lazily updated, only checked and
104  * reset when looking up the voice.
105  */
106  ALint VoiceIdx;
107 
108  /** Self ID */
109  ALuint id;
110 } ALsource;
111 
112 void UpdateAllSourceProps(ALCcontext *context);
113 
114 ALvoid ReleaseALSources(ALCcontext *Context);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif