aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/chorus.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/effects/chorus.cpp')
-rw-r--r--Alc/effects/chorus.cpp49
1 files changed, 42 insertions, 7 deletions
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp
index 758d521c..bd32a3d1 100644
--- a/Alc/effects/chorus.cpp
+++ b/Alc/effects/chorus.cpp
@@ -258,11 +258,47 @@ void ChorusState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI
struct ChorusStateFactory final : public EffectStateFactory {
EffectState *create() override;
+ ALeffectProps getDefaultProps() const noexcept override;
};
EffectState *ChorusStateFactory::create()
{ return new ChorusState{}; }
+ALeffectProps ChorusStateFactory::getDefaultProps() const noexcept
+{
+ ALeffectProps props{};
+ props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM;
+ props.Chorus.Phase = AL_CHORUS_DEFAULT_PHASE;
+ props.Chorus.Rate = AL_CHORUS_DEFAULT_RATE;
+ props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH;
+ props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK;
+ props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY;
+ return props;
+}
+
+/* Flanger is basically a chorus with a really short delay. They can both use
+ * the same processing functions, so piggyback flanger on the chorus functions.
+ */
+struct FlangerStateFactory final : public EffectStateFactory {
+ EffectState *create() override;
+ ALeffectProps getDefaultProps() const noexcept override;
+};
+
+EffectState *FlangerStateFactory::create()
+{ return new ChorusState{}; }
+
+ALeffectProps FlangerStateFactory::getDefaultProps() const noexcept
+{
+ ALeffectProps props{};
+ props.Chorus.Waveform = AL_FLANGER_DEFAULT_WAVEFORM;
+ props.Chorus.Phase = AL_FLANGER_DEFAULT_PHASE;
+ props.Chorus.Rate = AL_FLANGER_DEFAULT_RATE;
+ props.Chorus.Depth = AL_FLANGER_DEFAULT_DEPTH;
+ props.Chorus.Feedback = AL_FLANGER_DEFAULT_FEEDBACK;
+ props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY;
+ return props;
+}
+
} // namespace
EffectStateFactory *ChorusStateFactory_getFactory()
@@ -271,6 +307,12 @@ EffectStateFactory *ChorusStateFactory_getFactory()
return &ChorusFactory;
}
+EffectStateFactory *FlangerStateFactory_getFactory()
+{
+ static FlangerStateFactory FlangerFactory{};
+ return &FlangerFactory;
+}
+
void ALchorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
{
@@ -381,13 +423,6 @@ void ALchorus_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum par
DEFINE_ALEFFECT_VTABLE(ALchorus);
-/* Flanger is basically a chorus with a really short delay. They can both use
- * the same processing functions, so piggyback flanger on the chorus functions.
- */
-EffectStateFactory *FlangerStateFactory_getFactory()
-{ return ChorusStateFactory_getFactory(); }
-
-
void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
{
ALeffectProps *props = &effect->Props;