1 #ifndef CORE_EFFECTS_BASE_H
2 #define CORE_EFFECTS_BASE_H
10 #include "core/bufferline.h"
11 #include "intrusive_ptr.h"
21 /** Target gain for the reverb decay feedback reaching the decay time. */
22 constexpr float ReverbDecayGain
{0.001f
}; /* -60 dB */
24 constexpr float ReverbMaxReflectionsDelay
{0.3f
};
25 constexpr float ReverbMaxLateReverbDelay
{0.1f
};
27 enum class ChorusWaveform
{
32 constexpr float ChorusMaxDelay
{0.016f
};
33 constexpr float FlangerMaxDelay
{0.004f
};
35 constexpr float EchoMaxDelay
{0.207f
};
36 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
{
64 // Shared Reverb Properties
71 float ReflectionsGain
;
72 float ReflectionsDelay
;
74 float LateReverbDelay
;
75 float AirAbsorptionGainHF
;
76 float RoomRolloffFactor
;
79 // Additional EAX Reverb Properties
82 float ReflectionsPan
[3];
83 float LateReverbPan
[3];
87 float ModulationDepth
;
100 ChorusWaveform Waveform
;
106 } Chorus
; /* Also Flanger */
145 FShifterDirection LeftDirection
;
146 FShifterDirection RightDirection
;
151 float HighPassCutoff
;
152 ModulatorWaveform Waveform
;
162 VMorpherPhenome PhonemeA
;
163 VMorpherPhenome PhonemeB
;
164 int PhonemeACoarseTuning
;
165 int PhonemeBCoarseTuning
;
166 VMorpherWaveform Waveform
;
175 struct EffectTarget
{
177 RealMixParams
*RealOut
;
180 struct EffectState
: public al::intrusive_ref
<EffectState
> {
182 const BufferStorage
*storage
;
183 al::span
<const al::byte
> samples
;
186 al::span
<FloatBufferLine
> mOutTarget
;
189 virtual ~EffectState() = default;
191 virtual void deviceUpdate(const DeviceBase
*device
, const Buffer
&buffer
) = 0;
192 virtual void update(const ContextBase
*context
, const EffectSlot
*slot
,
193 const EffectProps
*props
, const EffectTarget target
) = 0;
194 virtual void process(const size_t samplesToDo
, const al::span
<const FloatBufferLine
> samplesIn
,
195 const al::span
<FloatBufferLine
> samplesOut
) = 0;
199 struct EffectStateFactory
{
200 virtual ~EffectStateFactory() = default;
202 virtual al::intrusive_ptr
<EffectState
> create() = 0;
205 #endif /* CORE_EFFECTS_BASE_H */