diff options
author | Chris Robinson <[email protected]> | 2018-11-19 06:43:37 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-19 06:43:37 -0800 |
commit | c5c537cc5f5cb466cdf6679c9af9768301e32cc3 (patch) | |
tree | 6e9252e69132430c35e853132df5e42f5c1fae4d /Alc/effects/chorus.cpp | |
parent | f0cc34a60e65b7120a8d2d2bd5f76aebb3352685 (diff) |
Use proper inheritence for EffectStateFactory
Diffstat (limited to 'Alc/effects/chorus.cpp')
-rw-r--r-- | Alc/effects/chorus.cpp | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp index 411ba6a5..62691887 100644 --- a/Alc/effects/chorus.cpp +++ b/Alc/effects/chorus.cpp @@ -286,30 +286,20 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c struct ChorusStateFactory final : public EffectStateFactory { - ChorusStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *ChorusStateFactory_create(ChorusStateFactory *UNUSED(factory)) +ALeffectState *ChorusStateFactory::create() { ALchorusState *state; - NEW_OBJ0(state, ALchorusState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(ChorusStateFactory); - -ChorusStateFactory::ChorusStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(ChorusStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *ChorusStateFactory_getFactory(void) { static ChorusStateFactory ChorusFactory{}; - return STATIC_CAST(EffectStateFactory, &ChorusFactory); + return &ChorusFactory; } @@ -426,30 +416,20 @@ DEFINE_ALEFFECT_VTABLE(ALchorus); * the same processing functions, so piggyback flanger on the chorus functions. */ struct FlangerStateFactory final : public EffectStateFactory { - FlangerStateFactory() noexcept; + ALeffectState *create() override; }; -ALeffectState *FlangerStateFactory_create(FlangerStateFactory *UNUSED(factory)) +ALeffectState *FlangerStateFactory::create() { ALchorusState *state; - NEW_OBJ0(state, ALchorusState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(FlangerStateFactory); - -FlangerStateFactory::FlangerStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(FlangerStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *FlangerStateFactory_getFactory(void) { static FlangerStateFactory FlangerFactory{}; - return STATIC_CAST(EffectStateFactory, &FlangerFactory); + return &FlangerFactory; } |