]> git.tdb.fi Git - ext/openal.git/blob - al/effects/effects.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / al / effects / effects.h
1 #ifndef AL_EFFECTS_EFFECTS_H
2 #define AL_EFFECTS_EFFECTS_H
3
4 #include "AL/al.h"
5
6 #include "core/except.h"
7
8 #ifdef ALSOFT_EAX
9 #include "al/eax/effect.h"
10 #endif // ALSOFT_EAX
11
12 union EffectProps;
13
14
15 class effect_exception final : public al::base_exception {
16     ALenum mErrorCode;
17
18 public:
19 #ifdef __USE_MINGW_ANSI_STDIO
20     [[gnu::format(gnu_printf, 3, 4)]]
21 #else
22     [[gnu::format(printf, 3, 4)]]
23 #endif
24     effect_exception(ALenum code, const char *msg, ...);
25     ~effect_exception() override;
26
27     ALenum errorCode() const noexcept { return mErrorCode; }
28 };
29
30
31 struct EffectVtable {
32     void (*const setParami)(EffectProps *props, ALenum param, int val);
33     void (*const setParamiv)(EffectProps *props, ALenum param, const int *vals);
34     void (*const setParamf)(EffectProps *props, ALenum param, float val);
35     void (*const setParamfv)(EffectProps *props, ALenum param, const float *vals);
36
37     void (*const getParami)(const EffectProps *props, ALenum param, int *val);
38     void (*const getParamiv)(const EffectProps *props, ALenum param, int *vals);
39     void (*const getParamf)(const EffectProps *props, ALenum param, float *val);
40     void (*const getParamfv)(const EffectProps *props, ALenum param, float *vals);
41 };
42
43 #define DEFINE_ALEFFECT_VTABLE(T)           \
44 const EffectVtable T##EffectVtable = {      \
45     T##_setParami, T##_setParamiv,          \
46     T##_setParamf, T##_setParamfv,          \
47     T##_getParami, T##_getParamiv,          \
48     T##_getParamf, T##_getParamfv,          \
49 }
50
51
52 /* Default properties for the given effect types. */
53 extern const EffectProps NullEffectProps;
54 extern const EffectProps ReverbEffectProps;
55 extern const EffectProps StdReverbEffectProps;
56 extern const EffectProps AutowahEffectProps;
57 extern const EffectProps ChorusEffectProps;
58 extern const EffectProps CompressorEffectProps;
59 extern const EffectProps DistortionEffectProps;
60 extern const EffectProps EchoEffectProps;
61 extern const EffectProps EqualizerEffectProps;
62 extern const EffectProps FlangerEffectProps;
63 extern const EffectProps FshifterEffectProps;
64 extern const EffectProps ModulatorEffectProps;
65 extern const EffectProps PshifterEffectProps;
66 extern const EffectProps VmorpherEffectProps;
67 extern const EffectProps DedicatedEffectProps;
68 extern const EffectProps ConvolutionEffectProps;
69
70 /* Vtables to get/set properties for the given effect types. */
71 extern const EffectVtable NullEffectVtable;
72 extern const EffectVtable ReverbEffectVtable;
73 extern const EffectVtable StdReverbEffectVtable;
74 extern const EffectVtable AutowahEffectVtable;
75 extern const EffectVtable ChorusEffectVtable;
76 extern const EffectVtable CompressorEffectVtable;
77 extern const EffectVtable DistortionEffectVtable;
78 extern const EffectVtable EchoEffectVtable;
79 extern const EffectVtable EqualizerEffectVtable;
80 extern const EffectVtable FlangerEffectVtable;
81 extern const EffectVtable FshifterEffectVtable;
82 extern const EffectVtable ModulatorEffectVtable;
83 extern const EffectVtable PshifterEffectVtable;
84 extern const EffectVtable VmorpherEffectVtable;
85 extern const EffectVtable DedicatedEffectVtable;
86 extern const EffectVtable ConvolutionEffectVtable;
87
88 #endif /* AL_EFFECTS_EFFECTS_H */