diff options
author | Chris Robinson <[email protected]> | 2018-11-17 01:58:38 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-17 01:58:38 -0800 |
commit | b69b3bd89f1e6a605cf3089860b7f193c9e9f744 (patch) | |
tree | febd6ac83a7c7c99e73e3664b9e6bf568e951388 /Alc/effects | |
parent | aa66ed0ea54b282f7b547ebecfa716927aa02cd1 (diff) |
Convert fshifter.c to C++
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/fshifter.cpp (renamed from Alc/effects/fshifter.c) | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Alc/effects/fshifter.c b/Alc/effects/fshifter.cpp index 6ada7dfa..610a2463 100644 --- a/Alc/effects/fshifter.c +++ b/Alc/effects/fshifter.cpp @@ -38,9 +38,7 @@ #define FIFO_LATENCY (HIL_STEP * (OVERSAMP-1)) -typedef struct ALfshifterState { - DERIVE_FROM_TYPE(ALeffectState); - +struct ALfshifterState final : public ALeffectState { /* Effect parameters */ ALsizei count; ALsizei PhaseStep; @@ -59,7 +57,7 @@ typedef struct ALfshifterState { /* Effect gains for each output channel */ ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; -} ALfshifterState; +}; static ALvoid ALfshifterState_Destruct(ALfshifterState *state); static ALboolean ALfshifterState_deviceUpdate(ALfshifterState *state, ALCdevice *device); @@ -88,6 +86,7 @@ static alonce_flag HannInitOnce = AL_ONCE_FLAG_INIT; static void ALfshifterState_Construct(ALfshifterState *state) { + new (state) ALfshifterState{}; ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALfshifterState, ALeffectState, state); @@ -97,6 +96,7 @@ static void ALfshifterState_Construct(ALfshifterState *state) static ALvoid ALfshifterState_Destruct(ALfshifterState *state) { ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); + state->~ALfshifterState(); } static ALboolean ALfshifterState_deviceUpdate(ALfshifterState *state, ALCdevice *UNUSED(device)) @@ -215,9 +215,9 @@ static ALvoid ALfshifterState_process(ALfshifterState *state, ALsizei SamplesToD maxi(SamplesToDo, 512), 0, SamplesToDo); } -typedef struct FshifterStateFactory { - DERIVE_FROM_TYPE(EffectStateFactory); -} FshifterStateFactory; +struct FshifterStateFactory final : public EffectStateFactory { + FshifterStateFactory() noexcept; +}; static ALeffectState *FshifterStateFactory_create(FshifterStateFactory *UNUSED(factory)) { @@ -231,10 +231,14 @@ static ALeffectState *FshifterStateFactory_create(FshifterStateFactory *UNUSED(f DEFINE_EFFECTSTATEFACTORY_VTABLE(FshifterStateFactory); -EffectStateFactory *FshifterStateFactory_getFactory(void) +FshifterStateFactory::FshifterStateFactory() noexcept + : EffectStateFactory{GET_VTABLE2(FshifterStateFactory, EffectStateFactory)} { - static FshifterStateFactory FshifterFactory = { { GET_VTABLE2(FshifterStateFactory, EffectStateFactory) } }; +} +EffectStateFactory *FshifterStateFactory_getFactory(void) +{ + static FshifterStateFactory FshifterFactory{}; return STATIC_CAST(EffectStateFactory, &FshifterFactory); } |