1 #ifndef CORE_EFFECTS_BASE_H
2 #define CORE_EFFECTS_BASE_H
9 #include "core/bufferline.h"
10 #include "intrusive_ptr.h"
11 #include "opthelpers.h"
21 /** Target gain for the reverb decay feedback reaching the decay time. */
22 inline constexpr float ReverbDecayGain
{0.001f
}; /* -60 dB */
24 inline constexpr float ReverbMaxReflectionsDelay
{0.3f
};
25 inline constexpr float ReverbMaxLateReverbDelay
{0.1f
};
27 enum class ChorusWaveform
{
32 inline constexpr float ChorusMaxDelay
{0.016f
};
33 inline constexpr float FlangerMaxDelay
{0.004f
};
35 inline constexpr float EchoMaxDelay
{0.207f
};
36 inline constexpr float EchoMaxLRDelay
{0.404f
};
38 enum class FShifterDirection
{
44 enum class ModulatorWaveform
{
50 enum class VMorpherPhenome
{
52 AA
, AE
, AH
, AO
, EH
, ER
, IH
, IY
, UH
, UW
,
53 B
, D
, F
, G
, J
, K
, L
, M
, N
, P
, R
, S
, T
, V
, Z
56 enum class VMorpherWaveform
{
71 float ReflectionsGain
;
72 float ReflectionsDelay
;
73 std::array
<float,3> ReflectionsPan
;
75 float LateReverbDelay
;
76 std::array
<float,3> LateReverbPan
;
80 float ModulationDepth
;
81 float AirAbsorptionGainHF
;
84 float RoomRolloffFactor
;
96 ChorusWaveform Waveform
;
104 struct CompressorProps
{
108 struct DistortionProps
{
126 struct EqualizerProps
{
139 struct FshifterProps
{
141 FShifterDirection LeftDirection
;
142 FShifterDirection RightDirection
;
145 struct ModulatorProps
{
147 float HighPassCutoff
;
148 ModulatorWaveform Waveform
;
151 struct PshifterProps
{
156 struct VmorpherProps
{
158 VMorpherPhenome PhonemeA
;
159 VMorpherPhenome PhonemeB
;
160 int PhonemeACoarseTuning
;
161 int PhonemeBCoarseTuning
;
162 VMorpherWaveform Waveform
;
165 struct DedicatedProps
{
166 enum TargetType
: bool { Dialog
, Lfe
};
171 struct ConvolutionProps
{
172 std::array
<float,3> OrientAt
;
173 std::array
<float,3> OrientUp
;
176 using EffectProps
= std::variant
<std::monostate
,
192 struct EffectTarget
{
194 RealMixParams
*RealOut
;
197 struct SIMDALIGN EffectState
: public al::intrusive_ref
<EffectState
> {
198 al::span
<FloatBufferLine
> mOutTarget
;
201 virtual ~EffectState() = default;
203 virtual void deviceUpdate(const DeviceBase
*device
, const BufferStorage
*buffer
) = 0;
204 virtual void update(const ContextBase
*context
, const EffectSlot
*slot
,
205 const EffectProps
*props
, const EffectTarget target
) = 0;
206 virtual void process(const size_t samplesToDo
, const al::span
<const FloatBufferLine
> samplesIn
,
207 const al::span
<FloatBufferLine
> samplesOut
) = 0;
211 struct EffectStateFactory
{
212 EffectStateFactory() = default;
213 EffectStateFactory(const EffectStateFactory
&) = delete;
214 EffectStateFactory(EffectStateFactory
&&) = delete;
215 virtual ~EffectStateFactory() = default;
217 void operator=(const EffectStateFactory
&) = delete;
218 void operator=(EffectStateFactory
&&) = delete;
220 virtual al::intrusive_ptr
<EffectState
> create() = 0;
223 #endif /* CORE_EFFECTS_BASE_H */