diff options
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.cpp | 20 | ||||
-rw-r--r-- | Alc/effects/chorus.cpp | 36 | ||||
-rw-r--r-- | Alc/effects/compressor.cpp | 18 | ||||
-rw-r--r-- | Alc/effects/dedicated.cpp | 18 | ||||
-rw-r--r-- | Alc/effects/distortion.cpp | 18 | ||||
-rw-r--r-- | Alc/effects/echo.cpp | 18 | ||||
-rw-r--r-- | Alc/effects/equalizer.cpp | 18 | ||||
-rw-r--r-- | Alc/effects/fshifter.cpp | 19 | ||||
-rw-r--r-- | Alc/effects/modulator.cpp | 17 | ||||
-rw-r--r-- | Alc/effects/null.cpp | 20 | ||||
-rw-r--r-- | Alc/effects/pshifter.cpp | 19 | ||||
-rw-r--r-- | Alc/effects/reverb.cpp | 18 |
12 files changed, 54 insertions, 185 deletions
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp index a8e4fe6e..eb2696fe 100644 --- a/Alc/effects/autowah.cpp +++ b/Alc/effects/autowah.cpp @@ -207,33 +207,23 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALsizei SamplesToDo, } struct AutowahStateFactory final : public EffectStateFactory { - AutowahStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *AutowahStateFactory_create(AutowahStateFactory *UNUSED(factory)) +ALeffectState *AutowahStateFactory::create() { ALautowahState *state; - NEW_OBJ0(state, ALautowahState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(AutowahStateFactory); - -AutowahStateFactory::AutowahStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(AutowahStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *AutowahStateFactory_getFactory(void) { static AutowahStateFactory AutowahFactory{}; - - return STATIC_CAST(EffectStateFactory, &AutowahFactory); + return &AutowahFactory; } + void ALautowah_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; 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; } diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp index 464e98ec..cd6c72db 100644 --- a/Alc/effects/compressor.cpp +++ b/Alc/effects/compressor.cpp @@ -177,30 +177,20 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei Sample struct CompressorStateFactory final : public EffectStateFactory { - CompressorStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *CompressorStateFactory_create(CompressorStateFactory *UNUSED(factory)) +ALeffectState *CompressorStateFactory::create() { ALcompressorState *state; - NEW_OBJ0(state, ALcompressorState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(CompressorStateFactory); - -CompressorStateFactory::CompressorStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(CompressorStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *CompressorStateFactory_getFactory(void) { static CompressorStateFactory CompressorFactory{}; - return STATIC_CAST(EffectStateFactory, &CompressorFactory); + return &CompressorFactory; } diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp index 705f7d41..59f31b52 100644 --- a/Alc/effects/dedicated.cpp +++ b/Alc/effects/dedicated.cpp @@ -115,30 +115,20 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesT struct DedicatedStateFactory final : public EffectStateFactory { - DedicatedStateFactory() noexcept; + ALeffectState *create() override; }; -ALeffectState *DedicatedStateFactory_create(DedicatedStateFactory *UNUSED(factory)) +ALeffectState *DedicatedStateFactory::create() { ALdedicatedState *state; - NEW_OBJ0(state, ALdedicatedState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(DedicatedStateFactory); - -DedicatedStateFactory::DedicatedStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(DedicatedStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *DedicatedStateFactory_getFactory(void) { static DedicatedStateFactory DedicatedFactory{}; - return STATIC_CAST(EffectStateFactory, &DedicatedFactory); + return &DedicatedFactory; } diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp index 7dd15981..31f07de3 100644 --- a/Alc/effects/distortion.cpp +++ b/Alc/effects/distortion.cpp @@ -176,30 +176,20 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample struct DistortionStateFactory final : public EffectStateFactory { - DistortionStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *DistortionStateFactory_create(DistortionStateFactory *UNUSED(factory)) +ALeffectState *DistortionStateFactory::create() { ALdistortionState *state; - NEW_OBJ0(state, ALdistortionState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(DistortionStateFactory); - -DistortionStateFactory::DistortionStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(DistortionStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *DistortionStateFactory_getFactory(void) { static DistortionStateFactory DistortionFactory{}; - return STATIC_CAST(EffectStateFactory, &DistortionFactory); + return &DistortionFactory; } diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp index 492da6f6..47d21e6c 100644 --- a/Alc/effects/echo.cpp +++ b/Alc/effects/echo.cpp @@ -203,30 +203,20 @@ static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const struct EchoStateFactory final : public EffectStateFactory { - EchoStateFactory() noexcept; + ALeffectState *create() override; }; -ALeffectState *EchoStateFactory_create(EchoStateFactory *UNUSED(factory)) +ALeffectState *EchoStateFactory::create() { ALechoState *state; - NEW_OBJ0(state, ALechoState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(EchoStateFactory); - -EchoStateFactory::EchoStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(EchoStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *EchoStateFactory_getFactory(void) { static EchoStateFactory EchoFactory{}; - return STATIC_CAST(EffectStateFactory, &EchoFactory); + return &EchoFactory; } diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp index e8d50fad..17eee5b4 100644 --- a/Alc/effects/equalizer.cpp +++ b/Alc/effects/equalizer.cpp @@ -199,30 +199,20 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesT struct EqualizerStateFactory final : public EffectStateFactory { - EqualizerStateFactory() noexcept; + ALeffectState *create() override; }; -ALeffectState *EqualizerStateFactory_create(EqualizerStateFactory *UNUSED(factory)) +ALeffectState *EqualizerStateFactory::create() { ALequalizerState *state; - NEW_OBJ0(state, ALequalizerState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(EqualizerStateFactory); - -EqualizerStateFactory::EqualizerStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(EqualizerStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *EqualizerStateFactory_getFactory(void) { static EqualizerStateFactory EqualizerFactory{}; - return STATIC_CAST(EffectStateFactory, &EqualizerFactory); + return &EqualizerFactory; } diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp index f112c4c7..7775fafb 100644 --- a/Alc/effects/fshifter.cpp +++ b/Alc/effects/fshifter.cpp @@ -218,32 +218,23 @@ ALvoid ALfshifterState_process(ALfshifterState *state, ALsizei SamplesToDo, cons } // namespace struct FshifterStateFactory final : public EffectStateFactory { - FshifterStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *FshifterStateFactory_create(FshifterStateFactory *UNUSED(factory)) +ALeffectState *FshifterStateFactory::create() { ALfshifterState *state; - NEW_OBJ0(state, ALfshifterState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(FshifterStateFactory); - -FshifterStateFactory::FshifterStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(FshifterStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *FshifterStateFactory_getFactory(void) { static FshifterStateFactory FshifterFactory{}; - return STATIC_CAST(EffectStateFactory, &FshifterFactory); + return &FshifterFactory; } + void ALfshifter_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp index 9790af79..e96859f7 100644 --- a/Alc/effects/modulator.cpp +++ b/Alc/effects/modulator.cpp @@ -197,29 +197,20 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesT struct ModulatorStateFactory final : public EffectStateFactory { - ModulatorStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *ModulatorStateFactory_create(ModulatorStateFactory *UNUSED(factory)) +ALeffectState *ModulatorStateFactory::create() { ALmodulatorState *state; - NEW_OBJ0(state, ALmodulatorState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); + return state; } -DEFINE_EFFECTSTATEFACTORY_VTABLE(ModulatorStateFactory); - -ModulatorStateFactory::ModulatorStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(ModulatorStateFactory, EffectStateFactory)} -{ } - EffectStateFactory *ModulatorStateFactory_getFactory(void) { static ModulatorStateFactory ModulatorFactory{}; - return STATIC_CAST(EffectStateFactory, &ModulatorFactory); + return &ModulatorFactory; } diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp index 0d85d505..f5641e20 100644 --- a/Alc/effects/null.cpp +++ b/Alc/effects/null.cpp @@ -89,33 +89,21 @@ static void ALnullState_Delete(void *ptr) struct NullStateFactory final : public EffectStateFactory { - NullStateFactory() noexcept; + ALeffectState *create() override; }; /* Creates ALeffectState objects of the appropriate type. */ -ALeffectState *NullStateFactory_create(NullStateFactory *UNUSED(factory)) +ALeffectState *NullStateFactory::create() { ALnullState *state; - NEW_OBJ0(state, ALnullState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); + return state; } -/* Define the EffectStateFactory vtable for this type. */ -DEFINE_EFFECTSTATEFACTORY_VTABLE(NullStateFactory); - -NullStateFactory::NullStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(NullStateFactory, EffectStateFactory)} -{ -} - - EffectStateFactory *NullStateFactory_getFactory(void) { static NullStateFactory NullFactory{}; - return STATIC_CAST(EffectStateFactory, &NullFactory); + return &NullFactory; } diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp index 1199a19d..217b021e 100644 --- a/Alc/effects/pshifter.cpp +++ b/Alc/effects/pshifter.cpp @@ -335,31 +335,20 @@ ALvoid ALpshifterState_process(ALpshifterState *state, ALsizei SamplesToDo, cons } // namespace struct PshifterStateFactory final : public EffectStateFactory { - PshifterStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *PshifterStateFactory_create(PshifterStateFactory *UNUSED(factory)) +ALeffectState *PshifterStateFactory::create() { ALpshifterState *state; - NEW_OBJ0(state, ALpshifterState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(PshifterStateFactory); - - -PshifterStateFactory::PshifterStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(PshifterStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *PshifterStateFactory_getFactory(void) { static PshifterStateFactory PshifterFactory{}; - return STATIC_CAST(EffectStateFactory, &PshifterFactory); + return &PshifterFactory; } diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index 702a8cdd..d486e8b4 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -1586,30 +1586,20 @@ static ALvoid ReverbState_process(ReverbState *State, ALsizei SamplesToDo, const struct ReverbStateFactory final : public EffectStateFactory { - ReverbStateFactory() noexcept; + ALeffectState *create() override; }; -static ALeffectState *ReverbStateFactory_create(ReverbStateFactory* UNUSED(factory)) +ALeffectState *ReverbStateFactory::create() { ReverbState *state; - NEW_OBJ0(state, ReverbState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_EFFECTSTATEFACTORY_VTABLE(ReverbStateFactory); - -ReverbStateFactory::ReverbStateFactory() noexcept - : EffectStateFactory{GET_VTABLE2(ReverbStateFactory, EffectStateFactory)} -{ + return state; } EffectStateFactory *ReverbStateFactory_getFactory(void) { static ReverbStateFactory ReverbFactory{}; - return STATIC_CAST(EffectStateFactory, &ReverbFactory); + return &ReverbFactory; } |