aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-13 08:07:03 -0800
committerChris Robinson <[email protected]>2018-01-13 08:07:03 -0800
commit16e4e0fa7c97d8b7273e590adc9432f317f93d57 (patch)
tree87960bdf730fca7dd55dd63eb1e0b04ab5cdc7ae /OpenAL32/Include
parentc031b3cc6a8bb1525b59a850d3d8c6e4541256ce (diff)
Use a more normal vtable setup for filter methods
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alFilter.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 227d50cf..e0046d86 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -107,6 +107,28 @@ inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *
}
+struct ALfilter;
+
+typedef struct ALfilterVtable {
+ void (*const setParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val);
+ void (*const setParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals);
+ void (*const setParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val);
+ void (*const setParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals);
+
+ void (*const getParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val);
+ void (*const getParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals);
+ void (*const getParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val);
+ void (*const getParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals);
+} ALfilterVtable;
+
+#define DEFINE_ALFILTER_VTABLE(T) \
+const struct ALfilterVtable T##_vtable = { \
+ T##_setParami, T##_setParamiv, \
+ T##_setParamf, T##_setParamfv, \
+ T##_getParami, T##_getParamiv, \
+ T##_getParamf, T##_getParamfv, \
+}
+
typedef struct ALfilter {
// Filter type (AL_FILTER_NULL, ...)
ALenum type;
@@ -117,30 +139,12 @@ typedef struct ALfilter {
ALfloat GainLF;
ALfloat LFReference;
- void (*SetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val);
- void (*SetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals);
- void (*SetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val);
- void (*SetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals);
-
- void (*GetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val);
- void (*GetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals);
- void (*GetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val);
- void (*GetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals);
+ const struct ALfilterVtable *vtbl;
/* Self ID */
ALuint id;
} ALfilter;
-#define ALfilter_SetParami(x, c, p, v) ((x)->SetParami((x),(c),(p),(v)))
-#define ALfilter_SetParamiv(x, c, p, v) ((x)->SetParamiv((x),(c),(p),(v)))
-#define ALfilter_SetParamf(x, c, p, v) ((x)->SetParamf((x),(c),(p),(v)))
-#define ALfilter_SetParamfv(x, c, p, v) ((x)->SetParamfv((x),(c),(p),(v)))
-
-#define ALfilter_GetParami(x, c, p, v) ((x)->GetParami((x),(c),(p),(v)))
-#define ALfilter_GetParamiv(x, c, p, v) ((x)->GetParamiv((x),(c),(p),(v)))
-#define ALfilter_GetParamf(x, c, p, v) ((x)->GetParamf((x),(c),(p),(v)))
-#define ALfilter_GetParamfv(x, c, p, v) ((x)->GetParamfv((x),(c),(p),(v)))
-
inline void LockFiltersRead(ALCdevice *device)
{ LockUIntMapRead(&device->FilterMap); }
inline void UnlockFiltersRead(ALCdevice *device)