1 #ifndef AL_AUXEFFECTSLOT_H
2 #define AL_AUXEFFECTSLOT_H
14 #include "effects/base.h"
15 #include "intrusive_ptr.h"
23 using ALeffectslotArray
= al::FlexArray
<ALeffectslot
*>;
26 struct ALeffectslotProps
{
34 al::intrusive_ptr
<EffectState
> State
;
36 std::atomic
<ALeffectslotProps
*> next
;
38 DEF_NEWDEL(ALeffectslotProps
)
42 enum class SlotState
: ALenum
{
50 bool AuxSendAuto
{true};
51 ALeffectslot
*Target
{nullptr};
52 ALbuffer
*Buffer
{nullptr};
55 ALenum Type
{AL_EFFECT_NULL
};
58 al::intrusive_ptr
<EffectState
> State
;
61 std::atomic_flag PropsClean
;
63 SlotState mState
{SlotState::Initial
};
68 std::atomic
<ALeffectslotProps
*> Update
{nullptr};
71 bool AuxSendAuto
{true};
72 ALeffectslot
*Target
{nullptr};
74 ALenum EffectType
{AL_EFFECT_NULL
};
75 EffectProps mEffectProps
{};
76 EffectState
*mEffectState
{nullptr};
78 float RoomRolloff
{0.0f
}; /* Added to the source's room rolloff, not multiplied. */
79 float DecayTime
{0.0f
};
80 float DecayLFRatio
{0.0f
};
81 float DecayHFRatio
{0.0f
};
82 bool DecayHFLimit
{false};
83 float AirAbsorptionGainHF
{1.0f
};
89 /* Mixing buffer used by the Wet mix. */
90 al::vector
<FloatBufferLine
, 16> MixBuffer
;
92 /* Wet buffer configuration is ACN channel order with N3D scaling.
93 * Consequently, effects that only want to work with mono input can use
94 * channel 0 by itself. Effects that want multichannel can process the
95 * ambisonics signal and make a B-Format source pan.
99 ALeffectslot() { PropsClean
.test_and_set(std::memory_order_relaxed
); }
100 ALeffectslot(const ALeffectslot
&) = delete;
101 ALeffectslot
& operator=(const ALeffectslot
&) = delete;
105 ALenum
initEffect(ALeffect
*effect
, ALCcontext
*context
);
106 void updateProps(ALCcontext
*context
);
108 static ALeffectslotArray
*CreatePtrArray(size_t count
) noexcept
;
110 /* This can be new'd for the context's default effect slot. */
111 DEF_NEWDEL(ALeffectslot
)
114 void UpdateAllEffectSlotProps(ALCcontext
*context
);