1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef EFFECTS_BASE_H
#define EFFECTS_BASE_H
#include "alMain.h"
#include "almalloc.h"
#include "atomic.h"
struct ALeffectslot;
union ALeffectProps;
struct EffectVtable {
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 EffectVtable T##_vtable = { \
T##_setParami, T##_setParamiv, \
T##_setParamf, T##_setParamfv, \
T##_getParami, T##_getParamiv, \
T##_getParamf, T##_getParamfv, \
}
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;
virtual const EffectVtable *getEffectVtable() const noexcept = 0;
};
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);
#endif /* EFFECTS_BASE_H */
|