aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effectslot.h
blob: 2bef547782f0440c415fdd9b00a5dec36f3153a1 (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
#ifndef EFFECTSLOT_H
#define EFFECTSLOT_H

#include <atomic.h>

#include "almalloc.h"
#include "alcmain.h"
#include "effects/base.h"
#include "intrusive_ptr.h"


struct EffectSlot;

using EffectSlotArray = al::FlexArray<EffectSlot*>;


struct EffectSlotProps {
    float Gain;
    bool  AuxSendAuto;
    EffectSlot *Target;

    ALenum Type;
    EffectProps Props;

    al::intrusive_ptr<EffectState> State;

    std::atomic<EffectSlotProps*> next;

    DEF_NEWDEL(EffectSlotProps)
};


struct EffectSlot {
    std::atomic<EffectSlotProps*> Update{nullptr};

    /* 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;

    float Gain{1.0f};
    bool  AuxSendAuto{true};
    EffectSlot *Target{nullptr};

    ALenum EffectType{};
    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};

    static EffectSlotArray *CreatePtrArray(size_t count) noexcept;

    DISABLE_ALLOC()
};

#endif /* EFFECTSLOT_H */