]> git.tdb.fi Git - ext/openal.git/blob - core/effectslot.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / core / effectslot.h
1 #ifndef CORE_EFFECTSLOT_H
2 #define CORE_EFFECTSLOT_H
3
4 #include <atomic>
5
6 #include "almalloc.h"
7 #include "device.h"
8 #include "effects/base.h"
9 #include "intrusive_ptr.h"
10
11 struct EffectSlot;
12 struct WetBuffer;
13
14 using EffectSlotArray = al::FlexArray<EffectSlot*>;
15
16
17 enum class EffectSlotType : unsigned char {
18     None,
19     Reverb,
20     Chorus,
21     Distortion,
22     Echo,
23     Flanger,
24     FrequencyShifter,
25     VocalMorpher,
26     PitchShifter,
27     RingModulator,
28     Autowah,
29     Compressor,
30     Equalizer,
31     EAXReverb,
32     DedicatedLFE,
33     DedicatedDialog,
34     Convolution
35 };
36
37 struct EffectSlotProps {
38     float Gain;
39     bool  AuxSendAuto;
40     EffectSlot *Target;
41
42     EffectSlotType Type;
43     EffectProps Props;
44
45     al::intrusive_ptr<EffectState> State;
46
47     std::atomic<EffectSlotProps*> next;
48
49     DEF_NEWDEL(EffectSlotProps)
50 };
51
52
53 struct EffectSlot {
54     bool InUse{false};
55
56     std::atomic<EffectSlotProps*> Update{nullptr};
57
58     /* Wet buffer configuration is ACN channel order with N3D scaling.
59      * Consequently, effects that only want to work with mono input can use
60      * channel 0 by itself. Effects that want multichannel can process the
61      * ambisonics signal and make a B-Format source pan.
62      */
63     MixParams Wet;
64
65     float Gain{1.0f};
66     bool  AuxSendAuto{true};
67     EffectSlot *Target{nullptr};
68
69     EffectSlotType EffectType{EffectSlotType::None};
70     EffectProps mEffectProps{};
71     al::intrusive_ptr<EffectState> mEffectState;
72
73     float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
74     float DecayTime{0.0f};
75     float DecayLFRatio{0.0f};
76     float DecayHFRatio{0.0f};
77     bool DecayHFLimit{false};
78     float AirAbsorptionGainHF{1.0f};
79
80     /* Mixing buffer used by the Wet mix. */
81     al::vector<FloatBufferLine,16> mWetBuffer;
82
83
84     static EffectSlotArray *CreatePtrArray(size_t count) noexcept;
85
86     DEF_NEWDEL(EffectSlot)
87 };
88
89 #endif /* CORE_EFFECTSLOT_H */