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