1 #ifndef _AL_AUXEFFECTSLOT_H_
2 #define _AL_AUXEFFECTSLOT_H_
17 ALfloat (*mOutBuffer
)[BUFFERSIZE
]{nullptr};
18 ALsizei mOutChannels
{0};
21 virtual ~EffectState() = default;
23 virtual ALboolean
deviceUpdate(ALCdevice
*device
) = 0;
24 virtual void update(const ALCcontext
*context
, const ALeffectslot
*slot
, const ALeffectProps
*props
) = 0;
25 virtual void process(ALsizei samplesToDo
, const ALfloat (*RESTRICT samplesIn
)[BUFFERSIZE
], ALfloat (*RESTRICT samplesOut
)[BUFFERSIZE
], ALsizei numChannels
) = 0;
27 void IncRef() noexcept
;
28 void DecRef() noexcept
;
32 struct EffectStateFactory
{
33 virtual ~EffectStateFactory() { }
35 virtual EffectState
*create() = 0;
39 #define MAX_EFFECT_CHANNELS (4)
42 struct ALeffectslotArray
{
44 struct ALeffectslot
*slot
[];
48 struct ALeffectslotProps
{
50 ALboolean AuxSendAuto
;
57 ATOMIC(struct ALeffectslotProps
*) next
;
63 ALboolean AuxSendAuto
{AL_TRUE
};
66 ALenum Type
{AL_EFFECT_NULL
};
67 ALeffectProps Props
{};
69 EffectState
*State
{nullptr};
72 std::atomic_flag PropsClean
{true};
76 ATOMIC(struct ALeffectslotProps
*) Update
{nullptr};
80 ALboolean AuxSendAuto
{AL_TRUE
};
82 ALenum EffectType
{AL_EFFECT_NULL
};
83 ALeffectProps EffectProps
{};
84 EffectState
*mEffectState
{nullptr};
86 ALfloat RoomRolloff
{0.0f
}; /* Added to the source's room rolloff, not multiplied. */
87 ALfloat DecayTime
{0.0f
};
88 ALfloat DecayLFRatio
{0.0f
};
89 ALfloat DecayHFRatio
{0.0f
};
90 ALboolean DecayHFLimit
{AL_FALSE
};
91 ALfloat AirAbsorptionGainHF
{1.0f
};
97 ALsizei NumChannels
{};
98 BFChannelConfig ChanMap
[MAX_EFFECT_CHANNELS
];
99 /* Wet buffer configuration is ACN channel order with N3D scaling:
100 * * Channel 0 is the unattenuated mono signal.
101 * * Channel 1 is OpenAL -X * sqrt(3)
102 * * Channel 2 is OpenAL Y * sqrt(3)
103 * * Channel 3 is OpenAL -Z * sqrt(3)
104 * Consequently, effects that only want to work with mono input can use
105 * channel 0 by itself. Effects that want multichannel can process the
106 * ambisonics signal and make a B-Format source pan for first-order device
109 alignas(16) ALfloat WetBuffer
[MAX_EFFECT_CHANNELS
][BUFFERSIZE
];
111 ALeffectslot() = default;
112 ALeffectslot(const ALeffectslot
&) = delete;
113 ALeffectslot
& operator=(const ALeffectslot
&) = delete;
116 DEF_NEWDEL(ALeffectslot
)
119 ALenum
InitEffectSlot(ALeffectslot
*slot
);
120 void UpdateEffectSlotProps(ALeffectslot
*slot
, ALCcontext
*context
);
121 void UpdateAllEffectSlotProps(ALCcontext
*context
);
124 EffectStateFactory
*NullStateFactory_getFactory(void);
125 EffectStateFactory
*ReverbStateFactory_getFactory(void);
126 EffectStateFactory
*AutowahStateFactory_getFactory(void);
127 EffectStateFactory
*ChorusStateFactory_getFactory(void);
128 EffectStateFactory
*CompressorStateFactory_getFactory(void);
129 EffectStateFactory
*DistortionStateFactory_getFactory(void);
130 EffectStateFactory
*EchoStateFactory_getFactory(void);
131 EffectStateFactory
*EqualizerStateFactory_getFactory(void);
132 EffectStateFactory
*FlangerStateFactory_getFactory(void);
133 EffectStateFactory
*FshifterStateFactory_getFactory(void);
134 EffectStateFactory
*ModulatorStateFactory_getFactory(void);
135 EffectStateFactory
*PshifterStateFactory_getFactory(void);
137 EffectStateFactory
*DedicatedStateFactory_getFactory(void);
140 ALenum
InitializeEffect(ALCcontext
*Context
, ALeffectslot
*EffectSlot
, ALeffect
*effect
);