Enable proper full C++ exception handling on MSVC
[openal-soft.git] / core / effectslot.h
blob70dbbbad417e080e7dc63daffd59a1d098d03543
1 #ifndef CORE_EFFECTSLOT_H
2 #define CORE_EFFECTSLOT_H
4 #include <atomic>
5 #include <memory>
7 #include "device.h"
8 #include "effects/base.h"
9 #include "flexarray.h"
10 #include "intrusive_ptr.h"
12 struct EffectSlot;
13 struct WetBuffer;
15 using EffectSlotArray = al::FlexArray<EffectSlot*>;
18 enum class EffectSlotType : unsigned char {
19 None,
20 Reverb,
21 Chorus,
22 Autowah,
23 Compressor,
24 Convolution,
25 Dedicated,
26 Distortion,
27 Echo,
28 Equalizer,
29 Flanger,
30 FrequencyShifter,
31 PitchShifter,
32 RingModulator,
33 VocalMorpher,
36 struct EffectSlotProps {
37 float Gain;
38 bool AuxSendAuto;
39 EffectSlot *Target;
41 EffectSlotType Type;
42 EffectProps Props;
44 al::intrusive_ptr<EffectState> State;
46 std::atomic<EffectSlotProps*> next;
50 struct EffectSlot {
51 bool InUse{false};
53 std::atomic<EffectSlotProps*> Update{nullptr};
55 /* Wet buffer configuration is ACN channel order with N3D scaling.
56 * Consequently, effects that only want to work with mono input can use
57 * channel 0 by itself. Effects that want multichannel can process the
58 * ambisonics signal and make a B-Format source pan.
60 MixParams Wet;
62 float Gain{1.0f};
63 bool AuxSendAuto{true};
64 EffectSlot *Target{nullptr};
66 EffectSlotType EffectType{EffectSlotType::None};
67 EffectProps mEffectProps{};
68 al::intrusive_ptr<EffectState> mEffectState;
70 float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
71 float DecayTime{0.0f};
72 float DecayLFRatio{0.0f};
73 float DecayHFRatio{0.0f};
74 bool DecayHFLimit{false};
75 float AirAbsorptionGainHF{1.0f};
77 /* Mixing buffer used by the Wet mix. */
78 al::vector<FloatBufferLine,16> mWetBuffer;
81 static std::unique_ptr<EffectSlotArray> CreatePtrArray(size_t count);
84 #endif /* CORE_EFFECTSLOT_H */