blob: 12411ede9ec00db966b1ddede8d9695ea2d307e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#ifndef AL_AUXEFFECTSLOT_H
#define AL_AUXEFFECTSLOT_H
#include <atomic>
#include <cstddef>
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/efx.h"
#include "alcmain.h"
#include "almalloc.h"
#include "atomic.h"
#include "effects/base.h"
#include "intrusive_ptr.h"
#include "vector.h"
struct ALeffect;
struct ALeffectslot;
using ALeffectslotArray = al::FlexArray<ALeffectslot*>;
struct ALeffectslotProps {
float Gain;
bool AuxSendAuto;
ALeffectslot *Target;
ALenum Type;
EffectProps Props;
al::intrusive_ptr<EffectState> State;
std::atomic<ALeffectslotProps*> next;
DEF_NEWDEL(ALeffectslotProps)
};
struct ALeffectslot {
float Gain{1.0f};
bool AuxSendAuto{true};
ALeffectslot *Target{nullptr};
struct {
ALenum Type{AL_EFFECT_NULL};
EffectProps Props{};
EffectState *State{nullptr};
} Effect;
std::atomic_flag PropsClean;
RefCount ref{0u};
struct {
std::atomic<ALeffectslotProps*> Update{nullptr};
float Gain{1.0f};
bool AuxSendAuto{true};
ALeffectslot *Target{nullptr};
ALenum EffectType{AL_EFFECT_NULL};
EffectProps mEffectProps{};
EffectState *mEffectState{nullptr};
float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
float DecayTime{0.0f};
float DecayLFRatio{0.0f};
float DecayHFRatio{0.0f};
bool DecayHFLimit{false};
float AirAbsorptionGainHF{1.0f};
} Params;
/* Self ID */
ALuint id{};
/* Mixing buffer used by the Wet mix. */
al::vector<FloatBufferLine, 16> MixBuffer;
/* Wet buffer configuration is ACN channel order with N3D scaling.
* Consequently, effects that only want to work with mono input can use
* channel 0 by itself. Effects that want multichannel can process the
* ambisonics signal and make a B-Format source pan.
*/
MixParams Wet;
ALeffectslot() { PropsClean.test_and_set(std::memory_order_relaxed); }
ALeffectslot(const ALeffectslot&) = delete;
ALeffectslot& operator=(const ALeffectslot&) = delete;
~ALeffectslot();
ALenum init();
ALenum initEffect(ALeffect *effect, ALCcontext *context);
void updateProps(ALCcontext *context);
static ALeffectslotArray *CreatePtrArray(size_t count) noexcept;
/* This can be new'd for the context's default effect slot. */
DEF_NEWDEL(ALeffectslot)
};
void UpdateAllEffectSlotProps(ALCcontext *context);
#endif
|