2007-12-17 17:20:11 -08:00
|
|
|
#ifndef _AL_EFFECT_H_
|
|
|
|
#define _AL_EFFECT_H_
|
|
|
|
|
2012-09-14 02:42:36 -07:00
|
|
|
#include "alMain.h"
|
2007-12-17 17:20:11 -08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-05-25 22:31:24 -07:00
|
|
|
struct ALeffect;
|
2013-05-24 23:26:59 -07:00
|
|
|
|
2008-11-14 07:13:59 -08:00
|
|
|
enum {
|
2009-05-29 01:32:54 -07:00
|
|
|
EAXREVERB = 0,
|
|
|
|
REVERB,
|
2009-04-12 16:01:10 -07:00
|
|
|
ECHO,
|
2010-04-08 08:54:28 -07:00
|
|
|
MODULATOR,
|
2011-03-12 20:11:25 -08:00
|
|
|
DEDICATED,
|
2013-03-13 23:31:12 -07:00
|
|
|
CHORUS,
|
|
|
|
FLANGER,
|
2013-05-18 01:33:01 -07:00
|
|
|
EQUALIZER,
|
|
|
|
DISTORTION,
|
2009-04-12 16:01:10 -07:00
|
|
|
|
2008-11-14 07:13:59 -08:00
|
|
|
MAX_EFFECTS
|
|
|
|
};
|
|
|
|
extern ALboolean DisabledEffects[MAX_EFFECTS];
|
|
|
|
|
2011-07-20 22:26:16 -07:00
|
|
|
extern ALfloat ReverbBoost;
|
2011-07-20 22:53:46 -07:00
|
|
|
extern ALboolean EmulateEAXReverb;
|
2011-07-20 22:26:16 -07:00
|
|
|
|
2013-05-24 23:26:59 -07:00
|
|
|
struct ALeffectVtable {
|
2013-05-25 22:31:24 -07:00
|
|
|
void (*const SetParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val);
|
|
|
|
void (*const SetParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals);
|
|
|
|
void (*const SetParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val);
|
|
|
|
void (*const SetParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals);
|
|
|
|
|
|
|
|
void (*const GetParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
|
|
|
|
void (*const GetParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
|
|
|
|
void (*const GetParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
|
|
|
|
void (*const GetParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
|
2013-05-24 23:26:59 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DEFINE_ALEFFECT_VTABLE(T) \
|
|
|
|
const struct ALeffectVtable T##_vtable = { \
|
|
|
|
T##_SetParami, T##_SetParamiv, \
|
|
|
|
T##_SetParamf, T##_SetParamfv, \
|
|
|
|
T##_GetParami, T##_GetParamiv, \
|
|
|
|
T##_GetParamf, T##_GetParamfv, \
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const struct ALeffectVtable ALeaxreverb_vtable;
|
|
|
|
extern const struct ALeffectVtable ALreverb_vtable;
|
|
|
|
extern const struct ALeffectVtable ALchorus_vtable;
|
|
|
|
extern const struct ALeffectVtable ALdistortion_vtable;
|
|
|
|
extern const struct ALeffectVtable ALecho_vtable;
|
|
|
|
extern const struct ALeffectVtable ALequalizer_vtable;
|
|
|
|
extern const struct ALeffectVtable ALflanger_vtable;
|
|
|
|
extern const struct ALeffectVtable ALmodulator_vtable;
|
|
|
|
extern const struct ALeffectVtable ALnull_vtable;
|
|
|
|
extern const struct ALeffectVtable ALdedicated_vtable;
|
|
|
|
|
|
|
|
|
2013-05-25 22:07:31 -07:00
|
|
|
typedef union ALeffectProps {
|
2011-09-11 07:42:23 -07:00
|
|
|
struct {
|
|
|
|
// Shared Reverb Properties
|
|
|
|
ALfloat Density;
|
|
|
|
ALfloat Diffusion;
|
|
|
|
ALfloat Gain;
|
|
|
|
ALfloat GainHF;
|
|
|
|
ALfloat DecayTime;
|
|
|
|
ALfloat DecayHFRatio;
|
|
|
|
ALfloat ReflectionsGain;
|
|
|
|
ALfloat ReflectionsDelay;
|
|
|
|
ALfloat LateReverbGain;
|
|
|
|
ALfloat LateReverbDelay;
|
|
|
|
ALfloat AirAbsorptionGainHF;
|
|
|
|
ALfloat RoomRolloffFactor;
|
|
|
|
ALboolean DecayHFLimit;
|
|
|
|
|
|
|
|
// Additional EAX Reverb Properties
|
|
|
|
ALfloat GainLF;
|
|
|
|
ALfloat DecayLFRatio;
|
|
|
|
ALfloat ReflectionsPan[3];
|
|
|
|
ALfloat LateReverbPan[3];
|
|
|
|
ALfloat EchoTime;
|
|
|
|
ALfloat EchoDepth;
|
|
|
|
ALfloat ModulationTime;
|
|
|
|
ALfloat ModulationDepth;
|
|
|
|
ALfloat HFReference;
|
|
|
|
ALfloat LFReference;
|
|
|
|
} Reverb;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ALfloat Delay;
|
|
|
|
ALfloat LRDelay;
|
|
|
|
|
|
|
|
ALfloat Damping;
|
|
|
|
ALfloat Feedback;
|
|
|
|
|
|
|
|
ALfloat Spread;
|
|
|
|
} Echo;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ALfloat Frequency;
|
|
|
|
ALfloat HighPassCutoff;
|
|
|
|
ALint Waveform;
|
|
|
|
} Modulator;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ALfloat Gain;
|
|
|
|
} Dedicated;
|
2011-03-12 20:11:25 -08:00
|
|
|
|
2013-03-13 23:31:12 -07:00
|
|
|
struct {
|
|
|
|
ALint Waveform;
|
|
|
|
ALint Phase;
|
|
|
|
ALfloat Rate;
|
|
|
|
ALfloat Depth;
|
|
|
|
ALfloat Feedback;
|
|
|
|
ALfloat Delay;
|
|
|
|
} Chorus;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ALint Waveform;
|
|
|
|
ALint Phase;
|
|
|
|
ALfloat Rate;
|
|
|
|
ALfloat Depth;
|
|
|
|
ALfloat Feedback;
|
|
|
|
ALfloat Delay;
|
|
|
|
} Flanger;
|
|
|
|
|
2013-05-18 01:33:01 -07:00
|
|
|
struct {
|
|
|
|
ALfloat Delay;
|
|
|
|
ALfloat LowCutoff;
|
|
|
|
ALfloat LowGain;
|
|
|
|
ALfloat Mid1Center;
|
|
|
|
ALfloat Mid1Gain;
|
|
|
|
ALfloat Mid1Width;
|
|
|
|
ALfloat Mid2Center;
|
|
|
|
ALfloat Mid2Gain;
|
|
|
|
ALfloat Mid2Width;
|
|
|
|
ALfloat HighCutoff;
|
|
|
|
ALfloat HighGain;
|
|
|
|
} Equalizer;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ALfloat Edge;
|
|
|
|
ALfloat Gain;
|
|
|
|
ALfloat LowpassCutoff;
|
|
|
|
ALfloat EQCenter;
|
|
|
|
ALfloat EQBandwidth;
|
|
|
|
} Distortion;
|
2013-05-25 22:07:31 -07:00
|
|
|
} ALeffectProps;
|
|
|
|
|
2013-05-25 22:31:24 -07:00
|
|
|
typedef struct ALeffect {
|
2013-05-25 22:07:31 -07:00
|
|
|
// Effect type (AL_EFFECT_NULL, ...)
|
|
|
|
ALenum type;
|
|
|
|
|
|
|
|
ALeffectProps Props;
|
2013-05-18 01:33:01 -07:00
|
|
|
|
2013-05-24 23:26:59 -07:00
|
|
|
const struct ALeffectVtable *vtbl;
|
2011-09-11 08:59:47 -07:00
|
|
|
|
2012-04-19 22:28:01 -07:00
|
|
|
/* Self ID */
|
|
|
|
ALuint id;
|
2013-05-25 22:31:24 -07:00
|
|
|
} ALeffect;
|
2007-12-17 17:20:11 -08:00
|
|
|
|
2013-05-28 22:27:07 -07:00
|
|
|
static inline ALboolean IsReverbEffect(ALenum type)
|
2011-07-05 04:36:41 -07:00
|
|
|
{ return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
|
2007-12-17 17:20:11 -08:00
|
|
|
|
2012-01-20 16:23:15 -08:00
|
|
|
ALenum InitEffect(ALeffect *effect);
|
2009-08-15 09:39:18 -07:00
|
|
|
ALvoid ReleaseALEffects(ALCdevice *device);
|
2007-12-17 17:20:11 -08:00
|
|
|
|
2012-03-13 15:48:51 -07:00
|
|
|
ALvoid LoadReverbPreset(const char *name, ALeffect *effect);
|
2012-01-20 16:23:15 -08:00
|
|
|
|
2007-12-17 17:20:11 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|