1 #ifndef CORE_EFFECTS_BASE_H
2 #define CORE_EFFECTS_BASE_H
9 #include "core/bufferline.h"
10 #include "intrusive_ptr.h"
20 /** Target gain for the reverb decay feedback reaching the decay time. */
21 inline constexpr float ReverbDecayGain
{0.001f
}; /* -60 dB */
23 inline constexpr float ReverbMaxReflectionsDelay
{0.3f
};
24 inline constexpr float ReverbMaxLateReverbDelay
{0.1f
};
26 enum class ChorusWaveform
{
31 inline constexpr float ChorusMaxDelay
{0.016f
};
32 inline constexpr float FlangerMaxDelay
{0.004f
};
34 inline constexpr float EchoMaxDelay
{0.207f
};
35 inline constexpr float EchoMaxLRDelay
{0.404f
};
37 enum class FShifterDirection
{
43 enum class ModulatorWaveform
{
49 enum class VMorpherPhenome
{
51 AA
, AE
, AH
, AO
, EH
, ER
, IH
, IY
, UH
, UW
,
52 B
, D
, F
, G
, J
, K
, L
, M
, N
, P
, R
, S
, T
, V
, Z
55 enum class VMorpherWaveform
{
70 float ReflectionsGain
;
71 float ReflectionsDelay
;
72 std::array
<float,3> ReflectionsPan
;
74 float LateReverbDelay
;
75 std::array
<float,3> LateReverbPan
;
79 float ModulationDepth
;
80 float AirAbsorptionGainHF
;
83 float RoomRolloffFactor
;
95 ChorusWaveform Waveform
;
103 struct CompressorProps
{
107 struct DistortionProps
{
125 struct EqualizerProps
{
138 struct FshifterProps
{
140 FShifterDirection LeftDirection
;
141 FShifterDirection RightDirection
;
144 struct ModulatorProps
{
146 float HighPassCutoff
;
147 ModulatorWaveform Waveform
;
150 struct PshifterProps
{
155 struct VmorpherProps
{
157 VMorpherPhenome PhonemeA
;
158 VMorpherPhenome PhonemeB
;
159 int PhonemeACoarseTuning
;
160 int PhonemeBCoarseTuning
;
161 VMorpherWaveform Waveform
;
164 struct DedicatedProps
{
165 enum TargetType
: bool { Dialog
, Lfe
};
170 struct ConvolutionProps
{
171 std::array
<float,3> OrientAt
;
172 std::array
<float,3> OrientUp
;
175 using EffectProps
= std::variant
<std::monostate
,
191 struct EffectTarget
{
193 RealMixParams
*RealOut
;
196 struct EffectState
: public al::intrusive_ref
<EffectState
> {
197 al::span
<FloatBufferLine
> mOutTarget
;
200 virtual ~EffectState() = default;
202 virtual void deviceUpdate(const DeviceBase
*device
, const BufferStorage
*buffer
) = 0;
203 virtual void update(const ContextBase
*context
, const EffectSlot
*slot
,
204 const EffectProps
*props
, const EffectTarget target
) = 0;
205 virtual void process(const size_t samplesToDo
, const al::span
<const FloatBufferLine
> samplesIn
,
206 const al::span
<FloatBufferLine
> samplesOut
) = 0;
210 struct EffectStateFactory
{
211 virtual ~EffectStateFactory() = default;
213 virtual al::intrusive_ptr
<EffectState
> create() = 0;
216 #endif /* CORE_EFFECTS_BASE_H */