~ubuntu-branches/ubuntu/vivid/openal-soft/vivid

« back to all changes in this revision

Viewing changes to OpenAL32/Include/alSource.h

  • Committer: Package Import Robot
  • Author(s): Bret Curtis
  • Date: 2014-07-16 08:35:25 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140716083525-5rldbuk4mo211l1a
Tags: 1:1.15.1-1
* Added openal-info binary. (Closes: 659198)
* Added makehrtf binary.
* Added 'audio' to short description. (Closes: 598064) 
* Added FLAGS fixes for cmake in rules for hardening.
* Added man pages for the two binaries.
* New upstream release. (Closes: 731159)
* Removed libsndio-dlopen-change.patch, no longer required.
* Removed no-fpuextended.patch, macros no longer used.
* Removed need for lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#define MAX_SENDS                 4
5
5
 
 
6
#include "alMain.h"
 
7
#include "alu.h"
6
8
#include "alFilter.h"
7
 
#include "alu.h"
8
 
#include "AL/al.h"
9
9
 
10
10
#ifdef __cplusplus
11
11
extern "C" {
28
28
    struct ALbufferlistitem *prev;
29
29
} ALbufferlistitem;
30
30
 
 
31
typedef struct HrtfState {
 
32
    ALboolean Moving;
 
33
    ALuint Counter;
 
34
    ALIGN(16) ALfloat History[MaxChannels][SRC_HISTORY_LENGTH];
 
35
    ALIGN(16) ALfloat Values[MaxChannels][HRIR_LENGTH][2];
 
36
    ALuint Offset;
 
37
} HrtfState;
 
38
 
 
39
typedef struct HrtfParams {
 
40
    ALfloat Gain;
 
41
    ALfloat Dir[3];
 
42
    ALIGN(16) ALfloat Coeffs[MaxChannels][HRIR_LENGTH][2];
 
43
    ALIGN(16) ALfloat CoeffStep[HRIR_LENGTH][2];
 
44
    ALuint Delay[MaxChannels][2];
 
45
    ALint DelayStep[2];
 
46
    ALuint IrSize;
 
47
} HrtfParams;
 
48
 
 
49
typedef struct DirectParams {
 
50
    ALfloat (*OutBuffer)[BUFFERSIZE];
 
51
    ALfloat *ClickRemoval;
 
52
    ALfloat *PendingClicks;
 
53
 
 
54
    struct {
 
55
        HrtfParams Params;
 
56
        HrtfState *State;
 
57
    } Hrtf;
 
58
 
 
59
    /* A mixing matrix. First subscript is the channel number of the input data
 
60
     * (regardless of channel configuration) and the second is the channel
 
61
     * target (eg. FrontLeft). Not used with HRTF. */
 
62
    ALfloat Gains[MaxChannels][MaxChannels];
 
63
 
 
64
    /* A low-pass filter, using 2 chained one-pole filters. */
 
65
    FILTER iirFilter;
 
66
    ALfloat history[MaxChannels*2];
 
67
} DirectParams;
 
68
 
 
69
typedef struct SendParams {
 
70
    struct ALeffectslot *Slot;
 
71
 
 
72
    /* Gain control, which applies to all input channels to a single (mono)
 
73
     * output buffer. */
 
74
    ALfloat Gain;
 
75
 
 
76
    /* A low-pass filter, using 2 chained one-pole filters. */
 
77
    FILTER iirFilter;
 
78
    ALfloat history[MaxChannels*2];
 
79
} SendParams;
 
80
 
 
81
 
31
82
typedef struct ALsource
32
83
{
33
 
    volatile ALfloat   flPitch;
34
 
    volatile ALfloat   flGain;
35
 
    volatile ALfloat   flOuterGain;
36
 
    volatile ALfloat   flMinGain;
37
 
    volatile ALfloat   flMaxGain;
38
 
    volatile ALfloat   flInnerAngle;
39
 
    volatile ALfloat   flOuterAngle;
40
 
    volatile ALfloat   flRefDistance;
41
 
    volatile ALfloat   flMaxDistance;
42
 
    volatile ALfloat   flRollOffFactor;
43
 
    volatile ALfloat   vPosition[3];
44
 
    volatile ALfloat   vVelocity[3];
45
 
    volatile ALfloat   vOrientation[3];
46
 
    volatile ALboolean bHeadRelative;
47
 
    volatile ALboolean bLooping;
 
84
    /** Source properties. */
 
85
    volatile ALfloat   Pitch;
 
86
    volatile ALfloat   Gain;
 
87
    volatile ALfloat   OuterGain;
 
88
    volatile ALfloat   MinGain;
 
89
    volatile ALfloat   MaxGain;
 
90
    volatile ALfloat   InnerAngle;
 
91
    volatile ALfloat   OuterAngle;
 
92
    volatile ALfloat   RefDistance;
 
93
    volatile ALfloat   MaxDistance;
 
94
    volatile ALfloat   RollOffFactor;
 
95
    volatile ALfloat   Position[3];
 
96
    volatile ALfloat   Velocity[3];
 
97
    volatile ALfloat   Orientation[3];
 
98
    volatile ALboolean HeadRelative;
 
99
    volatile ALboolean Looping;
48
100
    volatile enum DistanceModel DistanceModel;
49
101
    volatile ALboolean DirectChannels;
50
102
 
 
103
    volatile ALboolean DryGainHFAuto;
 
104
    volatile ALboolean WetGainAuto;
 
105
    volatile ALboolean WetGainHFAuto;
 
106
    volatile ALfloat   OuterGainHF;
 
107
 
 
108
    volatile ALfloat AirAbsorptionFactor;
 
109
    volatile ALfloat RoomRolloffFactor;
 
110
    volatile ALfloat DopplerFactor;
 
111
 
51
112
    enum Resampler Resampler;
52
113
 
 
114
    /**
 
115
     * Last user-specified offset, and the offset type (bytes, samples, or
 
116
     * seconds).
 
117
     */
 
118
    ALdouble Offset;
 
119
    ALenum   OffsetType;
 
120
 
 
121
    /** Source type (static, streaming, or undetermined) */
 
122
    volatile ALint SourceType;
 
123
 
 
124
    /** Source state (initial, playing, paused, or stopped) */
53
125
    volatile ALenum state;
54
126
    ALenum new_state;
 
127
 
 
128
    /**
 
129
     * Source offset in samples, relative to the currently playing buffer, NOT
 
130
     * the whole queue, and the fractional (fixed-point) offset to the next
 
131
     * sample.
 
132
     */
55
133
    ALuint position;
56
134
    ALuint position_fraction;
57
135
 
58
 
    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
61
 
 
 
136
    /** Source Buffer Queue info. */
 
137
    ALbufferlistitem *queue;
 
138
    ALuint BuffersInQueue;
 
139
    ALuint BuffersPlayed;
 
140
 
 
141
    /** Current buffer sample info. */
 
142
    ALuint NumChannels;
 
143
    ALuint SampleSize;
 
144
 
 
145
    /** Direct filter and auxiliary send info. */
62
146
    ALfloat DirectGain;
63
147
    ALfloat DirectGainHF;
64
148
 
65
149
    struct {
66
150
        struct ALeffectslot *Slot;
67
 
        ALfloat WetGain;
68
 
        ALfloat WetGainHF;
 
151
        ALfloat Gain;
 
152
        ALfloat GainHF;
69
153
    } Send[MAX_SENDS];
70
154
 
71
 
    volatile ALboolean DryGainHFAuto;
72
 
    volatile ALboolean WetGainAuto;
73
 
    volatile ALboolean WetGainHFAuto;
74
 
    volatile ALfloat   OuterGainHF;
75
 
 
76
 
    volatile ALfloat AirAbsorptionFactor;
77
 
    volatile ALfloat RoomRolloffFactor;
78
 
    volatile ALfloat DopplerFactor;
79
 
 
80
 
    ALint lOffset;
81
 
    ALint lOffsetType;
82
 
 
83
 
    // Source Type (Static, Streaming, or Undetermined)
84
 
    volatile 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 */
 
155
    /** HRTF info. */
 
156
    HrtfState Hrtf;
 
157
 
 
158
    /** Current target parameters used for mixing. */
97
159
    struct {
98
 
        MixerFunc DoMix;
 
160
        ResamplerFunc Resample;
 
161
        DryMixerFunc DryMix;
 
162
        WetMixerFunc WetMix;
99
163
 
100
164
        ALint Step;
101
165
 
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];
 
166
        DirectParams Direct;
 
167
 
 
168
        SendParams Send[MAX_SENDS];
123
169
    } Params;
 
170
    /** Source needs to update its mixing parameters. */
124
171
    volatile ALenum NeedsUpdate;
125
172
 
 
173
    /** Method to update mixing parameters. */
126
174
    ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
127
175
 
128
 
    // Index to itself
129
 
    ALuint source;
 
176
    /** Self ID */
 
177
    ALuint id;
130
178
} ALsource;
131
179
#define ALsource_Update(s,a)                 ((s)->Update(s,a))
132
180