aboutsummaryrefslogtreecommitdiffstats
path: root/al/filter.h
blob: 123e64b0c7a54c05786df44417e34996a2434845 (plain)
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
#ifndef AL_FILTER_H
#define AL_FILTER_H

#include "AL/al.h"
#include "AL/alc.h"
#include "AL/alext.h"

#include "almalloc.h"


#define LOWPASSFREQREF  5000.0f
#define HIGHPASSFREQREF  250.0f


struct ALfilter {
    ALenum type{AL_FILTER_NULL};

    float Gain{1.0f};
    float GainHF{1.0f};
    float HFReference{LOWPASSFREQREF};
    float GainLF{1.0f};
    float LFReference{HIGHPASSFREQREF};

    struct Vtable {
        void (*const setParami )(ALfilter *filter, ALenum param, int val);
        void (*const setParamiv)(ALfilter *filter, ALenum param, const int *vals);
        void (*const setParamf )(ALfilter *filter, ALenum param, float val);
        void (*const setParamfv)(ALfilter *filter, ALenum param, const float *vals);

        void (*const getParami )(const ALfilter *filter, ALenum param, int *val);
        void (*const getParamiv)(const ALfilter *filter, ALenum param, int *vals);
        void (*const getParamf )(const ALfilter *filter, ALenum param, float *val);
        void (*const getParamfv)(const ALfilter *filter, ALenum param, float *vals);
    };
    const Vtable *vtab{nullptr};

    /* Self ID */
    ALuint id{0};

    void setParami(ALenum param, int value) { vtab->setParami(this, param, value); }
    void setParamiv(ALenum param, const int *values) { vtab->setParamiv(this, param, values); }
    void setParamf(ALenum param, float value) { vtab->setParamf(this, param, value); }
    void setParamfv(ALenum param, const float *values) { vtab->setParamfv(this, param, values); }
    void getParami(ALenum param, int *value) const { vtab->getParami(this, param, value); }
    void getParamiv(ALenum param, int *values) const { vtab->getParamiv(this, param, values); }
    void getParamf(ALenum param, float *value) const { vtab->getParamf(this, param, value); }
    void getParamfv(ALenum param, float *values) const { vtab->getParamfv(this, param, values); }

    DISABLE_ALLOC()
};

#endif