Avoid AL prefix on internal effect state factory types

Also avoid using the generic V/V0 macros for them
This commit is contained in:
Chris Robinson
2018-02-28 19:37:12 -08:00
parent d25398d2c7
commit a211c2f5e4
11 changed files with 121 additions and 120 deletions
+16 -16
View File
@@ -285,11 +285,11 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
}
typedef struct ALchorusStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALchorusStateFactory;
typedef struct ChorusStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} ChorusStateFactory;
static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(factory))
static ALeffectState *ChorusStateFactory_create(ChorusStateFactory *UNUSED(factory))
{
ALchorusState *state;
@@ -299,14 +299,14 @@ static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(f
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALchorusStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(ChorusStateFactory);
ALeffectStateFactory *ALchorusStateFactory_getFactory(void)
EffectStateFactory *ChorusStateFactory_getFactory(void)
{
static ALchorusStateFactory ChorusFactory = { { GET_VTABLE2(ALchorusStateFactory, ALeffectStateFactory) } };
static ChorusStateFactory ChorusFactory = { { GET_VTABLE2(ChorusStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &ChorusFactory);
return STATIC_CAST(EffectStateFactory, &ChorusFactory);
}
@@ -422,11 +422,11 @@ 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.
*/
typedef struct ALflangerStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALflangerStateFactory;
typedef struct FlangerStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} FlangerStateFactory;
ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *UNUSED(factory))
ALeffectState *FlangerStateFactory_create(FlangerStateFactory *UNUSED(factory))
{
ALchorusState *state;
@@ -436,13 +436,13 @@ ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *UNUSED(factor
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALflangerStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(FlangerStateFactory);
ALeffectStateFactory *ALflangerStateFactory_getFactory(void)
EffectStateFactory *FlangerStateFactory_getFactory(void)
{
static ALflangerStateFactory FlangerFactory = { { GET_VTABLE2(ALflangerStateFactory, ALeffectStateFactory) } };
static FlangerStateFactory FlangerFactory = { { GET_VTABLE2(FlangerStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &FlangerFactory);
return STATIC_CAST(EffectStateFactory, &FlangerFactory);
}
+8 -8
View File
@@ -179,11 +179,11 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei Sample
}
typedef struct ALcompressorStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALcompressorStateFactory;
typedef struct CompressorStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} CompressorStateFactory;
static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *UNUSED(factory))
static ALeffectState *CompressorStateFactory_create(CompressorStateFactory *UNUSED(factory))
{
ALcompressorState *state;
@@ -193,13 +193,13 @@ static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALcompressorStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(CompressorStateFactory);
ALeffectStateFactory *ALcompressorStateFactory_getFactory(void)
EffectStateFactory *CompressorStateFactory_getFactory(void)
{
static ALcompressorStateFactory CompressorFactory = { { GET_VTABLE2(ALcompressorStateFactory, ALeffectStateFactory) } };
static CompressorStateFactory CompressorFactory = { { GET_VTABLE2(CompressorStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &CompressorFactory);
return STATIC_CAST(EffectStateFactory, &CompressorFactory);
}
+8 -8
View File
@@ -114,11 +114,11 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesT
}
typedef struct ALdedicatedStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALdedicatedStateFactory;
typedef struct DedicatedStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} DedicatedStateFactory;
ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(factory))
ALeffectState *DedicatedStateFactory_create(DedicatedStateFactory *UNUSED(factory))
{
ALdedicatedState *state;
@@ -128,14 +128,14 @@ ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(fa
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdedicatedStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(DedicatedStateFactory);
ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void)
EffectStateFactory *DedicatedStateFactory_getFactory(void)
{
static ALdedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(ALdedicatedStateFactory, ALeffectStateFactory) } };
static DedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(DedicatedStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &DedicatedFactory);
return STATIC_CAST(EffectStateFactory, &DedicatedFactory);
}
+8 -8
View File
@@ -176,11 +176,11 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample
}
typedef struct ALdistortionStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALdistortionStateFactory;
typedef struct DistortionStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} DistortionStateFactory;
static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *UNUSED(factory))
static ALeffectState *DistortionStateFactory_create(DistortionStateFactory *UNUSED(factory))
{
ALdistortionState *state;
@@ -190,14 +190,14 @@ static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdistortionStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(DistortionStateFactory);
ALeffectStateFactory *ALdistortionStateFactory_getFactory(void)
EffectStateFactory *DistortionStateFactory_getFactory(void)
{
static ALdistortionStateFactory DistortionFactory = { { GET_VTABLE2(ALdistortionStateFactory, ALeffectStateFactory) } };
static DistortionStateFactory DistortionFactory = { { GET_VTABLE2(DistortionStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &DistortionFactory);
return STATIC_CAST(EffectStateFactory, &DistortionFactory);
}
+8 -8
View File
@@ -206,11 +206,11 @@ static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const
}
typedef struct ALechoStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALechoStateFactory;
typedef struct EchoStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} EchoStateFactory;
ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory))
ALeffectState *EchoStateFactory_create(EchoStateFactory *UNUSED(factory))
{
ALechoState *state;
@@ -220,13 +220,13 @@ ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory))
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALechoStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(EchoStateFactory);
ALeffectStateFactory *ALechoStateFactory_getFactory(void)
EffectStateFactory *EchoStateFactory_getFactory(void)
{
static ALechoStateFactory EchoFactory = { { GET_VTABLE2(ALechoStateFactory, ALeffectStateFactory) } };
static EchoStateFactory EchoFactory = { { GET_VTABLE2(EchoStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &EchoFactory);
return STATIC_CAST(EffectStateFactory, &EchoFactory);
}
+8 -8
View File
@@ -196,11 +196,11 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesT
}
typedef struct ALequalizerStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALequalizerStateFactory;
typedef struct EqualizerStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} EqualizerStateFactory;
ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(factory))
ALeffectState *EqualizerStateFactory_create(EqualizerStateFactory *UNUSED(factory))
{
ALequalizerState *state;
@@ -210,13 +210,13 @@ ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(fa
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALequalizerStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(EqualizerStateFactory);
ALeffectStateFactory *ALequalizerStateFactory_getFactory(void)
EffectStateFactory *EqualizerStateFactory_getFactory(void)
{
static ALequalizerStateFactory EqualizerFactory = { { GET_VTABLE2(ALequalizerStateFactory, ALeffectStateFactory) } };
static EqualizerStateFactory EqualizerFactory = { { GET_VTABLE2(EqualizerStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &EqualizerFactory);
return STATIC_CAST(EffectStateFactory, &EqualizerFactory);
}
+8 -8
View File
@@ -186,11 +186,11 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesT
}
typedef struct ALmodulatorStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALmodulatorStateFactory;
typedef struct ModulatorStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} ModulatorStateFactory;
static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UNUSED(factory))
static ALeffectState *ModulatorStateFactory_create(ModulatorStateFactory *UNUSED(factory))
{
ALmodulatorState *state;
@@ -200,13 +200,13 @@ static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UN
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALmodulatorStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(ModulatorStateFactory);
ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void)
EffectStateFactory *ModulatorStateFactory_getFactory(void)
{
static ALmodulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ALmodulatorStateFactory, ALeffectStateFactory) } };
static ModulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ModulatorStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &ModulatorFactory);
return STATIC_CAST(EffectStateFactory, &ModulatorFactory);
}
+9 -9
View File
@@ -85,12 +85,12 @@ static void ALnullState_Delete(void *ptr)
}
typedef struct ALnullStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALnullStateFactory;
typedef struct NullStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} NullStateFactory;
/* Creates ALeffectState objects of the appropriate type. */
ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
ALeffectState *NullStateFactory_create(NullStateFactory *UNUSED(factory))
{
ALnullState *state;
@@ -100,13 +100,13 @@ ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
return STATIC_CAST(ALeffectState, state);
}
/* Define the ALeffectStateFactory vtable for this type. */
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory);
/* Define the EffectStateFactory vtable for this type. */
DEFINE_EFFECTSTATEFACTORY_VTABLE(NullStateFactory);
ALeffectStateFactory *ALnullStateFactory_getFactory(void)
EffectStateFactory *NullStateFactory_getFactory(void)
{
static ALnullStateFactory NullFactory = { { GET_VTABLE2(ALnullStateFactory, ALeffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &NullFactory);
static NullStateFactory NullFactory = { { GET_VTABLE2(NullStateFactory, EffectStateFactory) } };
return STATIC_CAST(EffectStateFactory, &NullFactory);
}
+8 -8
View File
@@ -1691,11 +1691,11 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, c
}
typedef struct ALreverbStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
} ALreverbStateFactory;
typedef struct ReverbStateFactory {
DERIVE_FROM_TYPE(EffectStateFactory);
} ReverbStateFactory;
static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(factory))
static ALeffectState *ReverbStateFactory_create(ReverbStateFactory* UNUSED(factory))
{
ALreverbState *state;
@@ -1705,13 +1705,13 @@ static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(f
return STATIC_CAST(ALeffectState, state);
}
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALreverbStateFactory);
DEFINE_EFFECTSTATEFACTORY_VTABLE(ReverbStateFactory);
ALeffectStateFactory *ALreverbStateFactory_getFactory(void)
EffectStateFactory *ReverbStateFactory_getFactory(void)
{
static ALreverbStateFactory ReverbFactory = { { GET_VTABLE2(ALreverbStateFactory, ALeffectStateFactory) } };
static ReverbStateFactory ReverbFactory = { { GET_VTABLE2(ReverbStateFactory, EffectStateFactory) } };
return STATIC_CAST(ALeffectStateFactory, &ReverbFactory);
return STATIC_CAST(EffectStateFactory, &ReverbFactory);
}
+21 -20
View File
@@ -59,21 +59,22 @@ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \
}
struct ALeffectStateFactoryVtable;
struct EeffectStateFactoryVtable;
typedef struct ALeffectStateFactory {
const struct ALeffectStateFactoryVtable *vtbl;
} ALeffectStateFactory;
typedef struct EffectStateFactory {
const struct EffectStateFactoryVtable *vtab;
} EffectStateFactory;
struct ALeffectStateFactoryVtable {
ALeffectState *(*const create)(ALeffectStateFactory *factory);
struct EffectStateFactoryVtable {
ALeffectState *(*const create)(EffectStateFactory *factory);
};
#define EffectStateFactory_create(x) ((x)->vtab->create((x)))
#define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \
DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \
#define DEFINE_EFFECTSTATEFACTORY_VTABLE(T) \
DECLARE_THUNK(T, EffectStateFactory, ALeffectState*, create) \
\
static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \
T##_ALeffectStateFactory_create, \
static const struct EffectStateFactoryVtable T##_EffectStateFactory_vtable = { \
T##_EffectStateFactory_create, \
}
@@ -156,17 +157,17 @@ void UpdateAllEffectSlotProps(ALCcontext *context);
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
ALeffectStateFactory *ALnullStateFactory_getFactory(void);
ALeffectStateFactory *ALreverbStateFactory_getFactory(void);
ALeffectStateFactory *ALchorusStateFactory_getFactory(void);
ALeffectStateFactory *ALcompressorStateFactory_getFactory(void);
ALeffectStateFactory *ALdistortionStateFactory_getFactory(void);
ALeffectStateFactory *ALechoStateFactory_getFactory(void);
ALeffectStateFactory *ALequalizerStateFactory_getFactory(void);
ALeffectStateFactory *ALflangerStateFactory_getFactory(void);
ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void);
EffectStateFactory *NullStateFactory_getFactory(void);
EffectStateFactory *ReverbStateFactory_getFactory(void);
EffectStateFactory *ChorusStateFactory_getFactory(void);
EffectStateFactory *CompressorStateFactory_getFactory(void);
EffectStateFactory *DistortionStateFactory_getFactory(void);
EffectStateFactory *EchoStateFactory_getFactory(void);
EffectStateFactory *EqualizerStateFactory_getFactory(void);
EffectStateFactory *FlangerStateFactory_getFactory(void);
EffectStateFactory *ModulatorStateFactory_getFactory(void);
ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void);
EffectStateFactory *DedicatedStateFactory_getFactory(void);
ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect);
+19 -19
View File
@@ -43,23 +43,23 @@ static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcon
static const struct {
ALenum Type;
ALeffectStateFactory* (*GetFactory)(void);
EffectStateFactory* (*GetFactory)(void);
} FactoryList[] = {
{ AL_EFFECT_NULL, ALnullStateFactory_getFactory },
{ AL_EFFECT_EAXREVERB, ALreverbStateFactory_getFactory },
{ AL_EFFECT_REVERB, ALreverbStateFactory_getFactory },
{ AL_EFFECT_CHORUS, ALchorusStateFactory_getFactory },
{ AL_EFFECT_COMPRESSOR, ALcompressorStateFactory_getFactory },
{ AL_EFFECT_DISTORTION, ALdistortionStateFactory_getFactory },
{ AL_EFFECT_ECHO, ALechoStateFactory_getFactory },
{ AL_EFFECT_EQUALIZER, ALequalizerStateFactory_getFactory },
{ AL_EFFECT_FLANGER, ALflangerStateFactory_getFactory },
{ AL_EFFECT_RING_MODULATOR, ALmodulatorStateFactory_getFactory },
{ AL_EFFECT_DEDICATED_DIALOGUE, ALdedicatedStateFactory_getFactory },
{ AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, ALdedicatedStateFactory_getFactory }
{ AL_EFFECT_NULL, NullStateFactory_getFactory },
{ AL_EFFECT_EAXREVERB, ReverbStateFactory_getFactory },
{ AL_EFFECT_REVERB, ReverbStateFactory_getFactory },
{ AL_EFFECT_CHORUS, ChorusStateFactory_getFactory },
{ AL_EFFECT_COMPRESSOR, CompressorStateFactory_getFactory },
{ AL_EFFECT_DISTORTION, DistortionStateFactory_getFactory },
{ AL_EFFECT_ECHO, EchoStateFactory_getFactory },
{ AL_EFFECT_EQUALIZER, EqualizerStateFactory_getFactory },
{ AL_EFFECT_FLANGER, FlangerStateFactory_getFactory },
{ AL_EFFECT_RING_MODULATOR, ModulatorStateFactory_getFactory },
{ AL_EFFECT_DEDICATED_DIALOGUE, DedicatedStateFactory_getFactory },
{ AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedStateFactory_getFactory }
};
static inline ALeffectStateFactory *getFactoryByType(ALenum type)
static inline EffectStateFactory *getFactoryByType(ALenum type)
{
size_t i;
for(i = 0;i < COUNTOF(FactoryList);i++)
@@ -498,7 +498,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
if(newtype != EffectSlot->Effect.Type)
{
ALeffectStateFactory *factory;
EffectStateFactory *factory;
factory = getFactoryByType(newtype);
if(!factory)
@@ -506,7 +506,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
ERR("Failed to find factory for effect type 0x%04x\n", newtype);
return AL_INVALID_ENUM;
}
State = V0(factory,create)();
State = EffectStateFactory_create(factory);
if(!State) return AL_OUT_OF_MEMORY;
START_MIXER_MODE();
@@ -659,13 +659,13 @@ static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcon
ALenum InitEffectSlot(ALeffectslot *slot)
{
ALeffectStateFactory *factory;
EffectStateFactory *factory;
slot->Effect.Type = AL_EFFECT_NULL;
factory = getFactoryByType(AL_EFFECT_NULL);
if(!(slot->Effect.State=V0(factory,create)()))
return AL_OUT_OF_MEMORY;
slot->Effect.State = EffectStateFactory_create(factory);
if(!slot->Effect.State) return AL_OUT_OF_MEMORY;
slot->Gain = 1.0;
slot->AuxSendAuto = AL_TRUE;