aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-22 13:33:58 -0700
committerChris Robinson <[email protected]>2019-03-22 15:00:37 -0700
commite7e585f65c43e2ccd2ae71c36c4940f4b2efa80a (patch)
tree4851d04798701f67e3c6ca437111129cedaf9f65 /OpenAL32/Include
parentf951f4a66b3e9cc8db7ab190b8443fa6c834fee7 (diff)
Use the effect state factory to set the default effect props
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h49
-rw-r--r--OpenAL32/Include/alEffect.h41
2 files changed, 6 insertions, 84 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index 7d5775d4..b3323578 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -6,6 +6,7 @@
#include "alMain.h"
#include "alEffect.h"
#include "ambidefs.h"
+#include "effects/base.h"
#include "almalloc.h"
#include "atomic.h"
@@ -15,37 +16,6 @@ struct ALeffectslot;
union ALeffectProps;
-struct EffectTarget {
- MixParams *Main;
- RealMixParams *RealOut;
-};
-
-struct EffectState {
- RefCount mRef{1u};
-
- ALfloat (*mOutBuffer)[BUFFERSIZE]{nullptr};
- ALsizei mOutChannels{0};
-
-
- virtual ~EffectState() = default;
-
- virtual ALboolean deviceUpdate(const ALCdevice *device) = 0;
- virtual void update(const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props, const EffectTarget target) = 0;
- virtual void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) = 0;
-
- void IncRef() noexcept;
- void DecRef() noexcept;
-};
-
-
-struct EffectStateFactory {
- virtual ~EffectStateFactory() { }
-
- virtual EffectState *create() = 0;
- virtual ALeffectProps getDefaultProps() const noexcept = 0;
-};
-
-
using ALeffectslotArray = al::FlexArray<ALeffectslot*>;
@@ -124,23 +94,6 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context);
void UpdateAllEffectSlotProps(ALCcontext *context);
-EffectStateFactory *NullStateFactory_getFactory(void);
-EffectStateFactory *ReverbStateFactory_getFactory(void);
-EffectStateFactory *StdReverbStateFactory_getFactory(void);
-EffectStateFactory *AutowahStateFactory_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 *FshifterStateFactory_getFactory(void);
-EffectStateFactory *ModulatorStateFactory_getFactory(void);
-EffectStateFactory *PshifterStateFactory_getFactory(void);
-
-EffectStateFactory *DedicatedStateFactory_getFactory(void);
-
-
ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect);
#endif
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h
index 710f512a..fdd1b017 100644
--- a/OpenAL32/Include/alEffect.h
+++ b/OpenAL32/Include/alEffect.h
@@ -5,6 +5,8 @@
struct ALeffect;
+struct EffectVtable;
+struct EffectStateFactory;
enum {
EAXREVERB_EFFECT = 0,
@@ -34,41 +36,6 @@ struct EffectList {
};
extern const EffectList gEffectList[14];
-struct ALeffectVtable {
- void (*const setParami)(ALeffect *effect, ALCcontext *context, ALenum param, ALint val);
- void (*const setParamiv)(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals);
- void (*const setParamf)(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val);
- void (*const setParamfv)(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals);
-
- void (*const getParami)(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
- void (*const getParamiv)(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
- void (*const getParamf)(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
- void (*const getParamfv)(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
-};
-
-#define DEFINE_ALEFFECT_VTABLE(T) \
-const ALeffectVtable T##_vtable = { \
- T##_setParami, T##_setParamiv, \
- T##_setParamf, T##_setParamfv, \
- T##_getParami, T##_getParamiv, \
- T##_getParamf, T##_getParamfv, \
-}
-
-extern const ALeffectVtable ALeaxreverb_vtable;
-extern const ALeffectVtable ALreverb_vtable;
-extern const ALeffectVtable ALautowah_vtable;
-extern const ALeffectVtable ALchorus_vtable;
-extern const ALeffectVtable ALcompressor_vtable;
-extern const ALeffectVtable ALdistortion_vtable;
-extern const ALeffectVtable ALecho_vtable;
-extern const ALeffectVtable ALequalizer_vtable;
-extern const ALeffectVtable ALflanger_vtable;
-extern const ALeffectVtable ALfshifter_vtable;
-extern const ALeffectVtable ALmodulator_vtable;
-extern const ALeffectVtable ALnull_vtable;
-extern const ALeffectVtable ALpshifter_vtable;
-extern const ALeffectVtable ALdedicated_vtable;
-
union ALeffectProps {
struct {
@@ -179,7 +146,7 @@ struct ALeffect {
ALeffectProps Props{};
- const ALeffectVtable *vtab{nullptr};
+ const EffectVtable *vtab{nullptr};
/* Self ID */
ALuint id{0u};
@@ -196,6 +163,8 @@ struct ALeffect {
inline ALboolean IsReverbEffect(ALenum type)
{ return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
+EffectStateFactory *getFactoryByType(ALenum type);
+
void InitEffect(ALeffect *effect);
void LoadReverbPreset(const char *name, ALeffect *effect);