182 lines
4.6 KiB
C
Raw Normal View History

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
struct ALeffect;
enum {
EAXREVERB_EFFECT = 0,
REVERB_EFFECT,
CHORUS_EFFECT,
COMPRESSOR_EFFECT,
DISTORTION_EFFECT,
ECHO_EFFECT,
EQUALIZER_EFFECT,
FLANGER_EFFECT,
MODULATOR_EFFECT,
DEDICATED_EFFECT,
2009-04-12 16:01:10 -07:00
MAX_EFFECTS
};
extern ALboolean DisabledEffects[MAX_EFFECTS];
extern ALfloat ReverbBoost;
struct EffectList {
const char name[16];
int type;
ALenum val;
};
#define EFFECTLIST_SIZE 11
extern const struct EffectList EffectList[EFFECTLIST_SIZE];
struct ALeffectVtable {
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)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
void (*const getParamiv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
void (*const getParamf)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
void (*const getParamfv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
};
#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;
2013-10-03 07:55:12 -07:00
extern const struct ALeffectVtable ALcompressor_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;
typedef union ALeffectProps {
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 {
2013-10-03 07:55:12 -07:00
ALint Waveform;
ALint Phase;
ALfloat Rate;
ALfloat Depth;
ALfloat Feedback;
2013-10-03 07:55:12 -07:00
ALfloat Delay;
} Chorus; /* Also Flanger */
struct {
2013-10-03 07:55:12 -07:00
ALboolean OnOff;
} Compressor;
struct {
2013-10-03 07:55:12 -07:00
ALfloat Edge;
ALfloat Gain;
2013-10-03 07:55:12 -07:00
ALfloat LowpassCutoff;
ALfloat EQCenter;
ALfloat EQBandwidth;
} Distortion;
2011-03-12 20:11:25 -08:00
struct {
ALfloat Delay;
2013-10-03 07:55:12 -07:00
ALfloat LRDelay;
2013-10-03 07:55:12 -07:00
ALfloat Damping;
ALfloat Feedback;
2013-10-03 07:55:12 -07:00
ALfloat Spread;
} Echo;
struct {
ALfloat LowCutoff;
ALfloat LowGain;
ALfloat Mid1Center;
ALfloat Mid1Gain;
ALfloat Mid1Width;
ALfloat Mid2Center;
ALfloat Mid2Gain;
ALfloat Mid2Width;
ALfloat HighCutoff;
ALfloat HighGain;
} Equalizer;
2013-10-03 07:55:12 -07:00
struct {
ALfloat Frequency;
ALfloat HighPassCutoff;
ALint Waveform;
} Modulator;
struct {
ALfloat Gain;
2013-10-03 07:55:12 -07:00
} Dedicated;
} ALeffectProps;
typedef struct ALeffect {
// Effect type (AL_EFFECT_NULL, ...)
ALenum type;
ALeffectProps Props;
const struct ALeffectVtable *vtbl;
/* Self ID */
ALuint id;
} ALeffect;
2007-12-17 17:20:11 -08:00
2013-11-04 12:12:31 -08:00
inline ALboolean IsReverbEffect(ALenum type)
{ return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
2007-12-17 17:20:11 -08:00
ALenum InitEffect(ALeffect *effect);
ALvoid ReleaseALEffects(ALCdevice *device);
2007-12-17 17:20:11 -08:00
ALvoid LoadReverbPreset(const char *name, ALeffect *effect);
2007-12-17 17:20:11 -08:00
#ifdef __cplusplus
}
#endif
#endif