Avoid a stateful unique_ptr deleter
[openal-soft.git] / core / effectslot.h
blob8b7b977ca3893b21f1fed12f6d2e6382b2518253
1 #ifndef CORE_EFFECTSLOT_H
2 #define CORE_EFFECTSLOT_H
4 #include <atomic>
6 #include "almalloc.h"
7 #include "device.h"
8 #include "effects/base.h"
9 #include "intrusive_ptr.h"
11 struct EffectSlot;
12 struct WetBuffer;
14 using EffectSlotArray = al::FlexArray<EffectSlot*>;
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
37 struct EffectSlotProps {
38 float Gain;
39 bool AuxSendAuto;
40 EffectSlot *Target;
42 EffectSlotType Type;
43 EffectProps Props;
45 al::intrusive_ptr<EffectState> State;
47 std::atomic<EffectSlotProps*> next;
49 DEF_NEWDEL(EffectSlotProps)
53 struct EffectSlot {
54 std::atomic<EffectSlotProps*> Update{nullptr};
56 /* Wet buffer configuration is ACN channel order with N3D scaling.
57 * Consequently, effects that only want to work with mono input can use
58 * channel 0 by itself. Effects that want multichannel can process the
59 * ambisonics signal and make a B-Format source pan.
61 MixParams Wet;
63 float Gain{1.0f};
64 bool AuxSendAuto{true};
65 EffectSlot *Target{nullptr};
67 EffectSlotType EffectType{EffectSlotType::None};
68 EffectProps mEffectProps{};
69 EffectState *mEffectState{nullptr};
71 float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
72 float DecayTime{0.0f};
73 float DecayLFRatio{0.0f};
74 float DecayHFRatio{0.0f};
75 bool DecayHFLimit{false};
76 float AirAbsorptionGainHF{1.0f};
78 /* Mixing buffer used by the Wet mix. */
79 WetBuffer *mWetBuffer{nullptr};
81 ~EffectSlot();
83 static EffectSlotArray *CreatePtrArray(size_t count) noexcept;
85 DISABLE_ALLOC()
88 #endif /* CORE_EFFECTSLOT_H */