aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax/effect.h
diff options
context:
space:
mode:
Diffstat (limited to 'al/eax/effect.h')
-rw-r--r--al/eax/effect.h156
1 files changed, 103 insertions, 53 deletions
diff --git a/al/eax/effect.h b/al/eax/effect.h
index 4108f65f..ce581990 100644
--- a/al/eax/effect.h
+++ b/al/eax/effect.h
@@ -144,6 +144,10 @@ struct EaxCommitter {
[[noreturn]] static void fail(const char *message);
[[noreturn]] static void fail_unknown_property_id()
{ fail(EaxEffectErrorMessages::unknown_property_id()); }
+};
+
+struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> {
+ using EaxCommitter<EaxAutowahCommitter>::EaxCommitter;
bool commit(const EaxEffectProps &props);
@@ -151,42 +155,104 @@ struct EaxCommitter {
static void Get(const EaxCall &call, const EaxEffectProps &props);
static void Set(const EaxCall &call, EaxEffectProps &props);
};
-
-struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> {
- using EaxCommitter<EaxAutowahCommitter>::EaxCommitter;
-};
struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> {
using EaxCommitter<EaxChorusCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> {
using EaxCommitter<EaxCompressorCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> {
using EaxCommitter<EaxDistortionCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> {
using EaxCommitter<EaxEchoCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> {
using EaxCommitter<EaxEqualizerCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> {
using EaxCommitter<EaxFlangerCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCommitter> {
using EaxCommitter<EaxFrequencyShifterCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> {
using EaxCommitter<EaxModulatorCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter> {
using EaxCommitter<EaxPitchShifterCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter> {
using EaxCommitter<EaxVocalMorpherCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxNullCommitter : public EaxCommitter<EaxNullCommitter> {
using EaxCommitter<EaxNullCommitter>::EaxCommitter;
+
+ bool commit(const EaxEffectProps &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EaxEffectProps &props);
+ static void Set(const EaxCall &call, EaxEffectProps &props);
};
template<typename T>
@@ -253,43 +319,39 @@ public:
State4 state5_{};
- template<typename T, typename ...Args>
- void call_set_defaults(Args&& ...args)
- { return T::SetDefaults(std::forward<Args>(args)...); }
-
void call_set_defaults(const ALenum altype, EaxEffectProps &props)
{
switch(altype)
{
- case AL_EFFECT_EAXREVERB: return call_set_defaults<EaxReverbCommitter>(props);
- case AL_EFFECT_CHORUS: return call_set_defaults<EaxChorusCommitter>(props);
- case AL_EFFECT_AUTOWAH: return call_set_defaults<EaxAutowahCommitter>(props);
- case AL_EFFECT_COMPRESSOR: return call_set_defaults<EaxCompressorCommitter>(props);
- case AL_EFFECT_DISTORTION: return call_set_defaults<EaxDistortionCommitter>(props);
- case AL_EFFECT_ECHO: return call_set_defaults<EaxEchoCommitter>(props);
- case AL_EFFECT_EQUALIZER: return call_set_defaults<EaxEqualizerCommitter>(props);
- case AL_EFFECT_FLANGER: return call_set_defaults<EaxFlangerCommitter>(props);
- case AL_EFFECT_FREQUENCY_SHIFTER: return call_set_defaults<EaxFrequencyShifterCommitter>(props);
- case AL_EFFECT_RING_MODULATOR: return call_set_defaults<EaxModulatorCommitter>(props);
- case AL_EFFECT_PITCH_SHIFTER: return call_set_defaults<EaxPitchShifterCommitter>(props);
- case AL_EFFECT_VOCAL_MORPHER: return call_set_defaults<EaxVocalMorpherCommitter>(props);
+ case AL_EFFECT_EAXREVERB: return EaxReverbCommitter::SetDefaults(props);
+ case AL_EFFECT_CHORUS: return EaxChorusCommitter::SetDefaults(props);
+ case AL_EFFECT_AUTOWAH: return EaxAutowahCommitter::SetDefaults(props);
+ case AL_EFFECT_COMPRESSOR: return EaxCompressorCommitter::SetDefaults(props);
+ case AL_EFFECT_DISTORTION: return EaxDistortionCommitter::SetDefaults(props);
+ case AL_EFFECT_ECHO: return EaxEchoCommitter::SetDefaults(props);
+ case AL_EFFECT_EQUALIZER: return EaxEqualizerCommitter::SetDefaults(props);
+ case AL_EFFECT_FLANGER: return EaxFlangerCommitter::SetDefaults(props);
+ case AL_EFFECT_FREQUENCY_SHIFTER: return EaxFrequencyShifterCommitter::SetDefaults(props);
+ case AL_EFFECT_RING_MODULATOR: return EaxModulatorCommitter::SetDefaults(props);
+ case AL_EFFECT_PITCH_SHIFTER: return EaxPitchShifterCommitter::SetDefaults(props);
+ case AL_EFFECT_VOCAL_MORPHER: return EaxVocalMorpherCommitter::SetDefaults(props);
case AL_EFFECT_NULL: break;
}
- return call_set_defaults<EaxNullCommitter>(props);
+ return EaxNullCommitter::SetDefaults(props);
}
template<typename T>
void init()
{
- call_set_defaults<EaxReverbCommitter>(state1_.d);
+ EaxReverbCommitter::SetDefaults(state1_.d);
state1_.i = state1_.d;
- call_set_defaults<EaxReverbCommitter>(state2_.d);
+ EaxReverbCommitter::SetDefaults(state2_.d);
state2_.i = state2_.d;
- call_set_defaults<EaxReverbCommitter>(state3_.d);
+ EaxReverbCommitter::SetDefaults(state3_.d);
state3_.i = state3_.d;
- call_set_defaults<T>(state4_.d);
+ T::SetDefaults(state4_.d);
state4_.i = state4_.d;
- call_set_defaults<T>(state5_.d);
+ T::SetDefaults(state5_.d);
state5_.i = state5_.d;
}
@@ -297,9 +359,9 @@ public:
{
switch(eax_version)
{
- case 1: call_set_defaults<EaxReverbCommitter>(state1_.d); break;
- case 2: call_set_defaults<EaxReverbCommitter>(state2_.d); break;
- case 3: call_set_defaults<EaxReverbCommitter>(state3_.d); break;
+ case 1: EaxReverbCommitter::SetDefaults(state1_.d); break;
+ case 2: EaxReverbCommitter::SetDefaults(state2_.d); break;
+ case 3: EaxReverbCommitter::SetDefaults(state3_.d); break;
case 4: call_set_defaults(altype, state4_.d); break;
case 5: call_set_defaults(altype, state5_.d); break;
}
@@ -307,14 +369,10 @@ public:
}
- template<typename T, typename ...Args>
- static void call_set(Args&& ...args)
- { return T::Set(std::forward<Args>(args)...); }
-
static void call_set(const EaxCall &call, EaxEffectProps &props)
{
return std::visit([&](const auto &arg)
- { return call_set<CommitterFor<decltype(arg)>>(call, props); },
+ { return CommitterFor<decltype(arg)>::Set(call, props); },
props);
}
@@ -322,9 +380,9 @@ public:
{
switch(call.get_version())
{
- case 1: call_set<EaxReverbCommitter>(call, state1_.d); break;
- case 2: call_set<EaxReverbCommitter>(call, state2_.d); break;
- case 3: call_set<EaxReverbCommitter>(call, state3_.d); break;
+ case 1: EaxReverbCommitter::Set(call, state1_.d); break;
+ case 2: EaxReverbCommitter::Set(call, state2_.d); break;
+ case 3: EaxReverbCommitter::Set(call, state3_.d); break;
case 4: call_set(call, state4_.d); break;
case 5: call_set(call, state5_.d); break;
}
@@ -332,14 +390,10 @@ public:
}
- template<typename T, typename ...Args>
- static void call_get(Args&& ...args)
- { return T::Get(std::forward<Args>(args)...); }
-
static void call_get(const EaxCall &call, const EaxEffectProps &props)
{
return std::visit([&](const auto &arg)
- { return call_get<CommitterFor<decltype(arg)>>(call, props); },
+ { return CommitterFor<decltype(arg)>::Get(call, props); },
props);
}
@@ -347,23 +401,19 @@ public:
{
switch(call.get_version())
{
- case 1: call_get<EaxReverbCommitter>(call, state1_.d); break;
- case 2: call_get<EaxReverbCommitter>(call, state2_.d); break;
- case 3: call_get<EaxReverbCommitter>(call, state3_.d); break;
+ case 1: EaxReverbCommitter::Get(call, state1_.d); break;
+ case 2: EaxReverbCommitter::Get(call, state2_.d); break;
+ case 3: EaxReverbCommitter::Get(call, state3_.d); break;
case 4: call_get(call, state4_.d); break;
case 5: call_get(call, state5_.d); break;
}
}
- template<typename T, typename ...Args>
- bool call_commit(Args&& ...args)
- { return T{props_, al_effect_props_}.commit(std::forward<Args>(args)...); }
-
bool call_commit(const EaxEffectProps &props)
{
return std::visit([&](const auto &arg)
- { return call_commit<CommitterFor<decltype(arg)>>(props); },
+ { return CommitterFor<decltype(arg)>{props_, al_effect_props_}.commit(props); },
props);
}
@@ -380,15 +430,15 @@ public:
{
case 1:
state1_.i = state1_.d;
- ret |= call_commit<EaxReverbCommitter>(state1_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state1_.d);
break;
case 2:
state2_.i = state2_.d;
- ret |= call_commit<EaxReverbCommitter>(state2_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state2_.d);
break;
case 3:
state3_.i = state3_.d;
- ret |= call_commit<EaxReverbCommitter>(state3_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state3_.d);
break;
case 4:
state4_.i = state4_.d;