aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorRaulshc <[email protected]>2018-03-18 17:47:17 +0100
committerGitHub <[email protected]>2018-03-18 17:47:17 +0100
commit6fd23f09842b81788298e1840b8626252fdf5e18 (patch)
tree1f777d222368b80c131e9992735ffa3811052b5e /OpenAL32
parent3fde27d89098f6f71f82c06f89a2acbaa5f20400 (diff)
EFX:Pitch Shifter implementation
Add pitch shifter effect using standard phase vocoder, based on work of Stephan Bernsee. Only mono signal processing by now.
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h1
-rw-r--r--OpenAL32/Include/alEffect.h9
-rw-r--r--OpenAL32/alAuxEffectSlot.c1
-rw-r--r--OpenAL32/alEffect.c6
4 files changed, 16 insertions, 1 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index 61c72153..bb9aef59 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -167,6 +167,7 @@ EffectStateFactory *EchoStateFactory_getFactory(void);
EffectStateFactory *EqualizerStateFactory_getFactory(void);
EffectStateFactory *FlangerStateFactory_getFactory(void);
EffectStateFactory *ModulatorStateFactory_getFactory(void);
+EffectStateFactory *PshifterStateFactory_getFactory(void);
EffectStateFactory *DedicatedStateFactory_getFactory(void);
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h
index 95fa035e..50b64ee1 100644
--- a/OpenAL32/Include/alEffect.h
+++ b/OpenAL32/Include/alEffect.h
@@ -19,6 +19,7 @@ enum {
EQUALIZER_EFFECT,
FLANGER_EFFECT,
MODULATOR_EFFECT,
+ PSHIFTER_EFFECT,
DEDICATED_EFFECT,
MAX_EFFECTS
@@ -32,7 +33,7 @@ struct EffectList {
int type;
ALenum val;
};
-#define EFFECTLIST_SIZE 11
+#define EFFECTLIST_SIZE 12
extern const struct EffectList EffectList[EFFECTLIST_SIZE];
@@ -66,6 +67,7 @@ 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 ALpshifter_vtable;
extern const struct ALeffectVtable ALdedicated_vtable;
@@ -150,6 +152,11 @@ typedef union ALeffectProps {
} Modulator;
struct {
+ ALint CoarseTune;
+ ALint FineTune;
+ } Pshifter;
+
+ struct {
ALfloat Gain;
} Dedicated;
} ALeffectProps;
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 301244a0..d04fc4a7 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -55,6 +55,7 @@ static const struct {
{ AL_EFFECT_EQUALIZER, EqualizerStateFactory_getFactory },
{ AL_EFFECT_FLANGER, FlangerStateFactory_getFactory },
{ AL_EFFECT_RING_MODULATOR, ModulatorStateFactory_getFactory },
+ { AL_EFFECT_PITCH_SHIFTER, PshifterStateFactory_getFactory},
{ AL_EFFECT_DEDICATED_DIALOGUE, DedicatedStateFactory_getFactory },
{ AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedStateFactory_getFactory }
};
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 6b16fc56..e7dc6ace 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -45,6 +45,7 @@ const struct EffectList EffectList[EFFECTLIST_SIZE] = {
{ "equalizer", EQUALIZER_EFFECT, AL_EFFECT_EQUALIZER },
{ "flanger", FLANGER_EFFECT, AL_EFFECT_FLANGER },
{ "modulator", MODULATOR_EFFECT, AL_EFFECT_RING_MODULATOR },
+ { "pshifter", PSHIFTER_EFFECT, AL_EFFECT_PITCH_SHIFTER },
{ "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT },
{ "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_DIALOGUE },
};
@@ -589,6 +590,11 @@ static void InitEffectParams(ALeffect *effect, ALenum type)
effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
effect->vtab = &ALmodulator_vtable;
break;
+ case AL_EFFECT_PITCH_SHIFTER:
+ effect->Props.Pshifter.CoarseTune = AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE;
+ effect->Props.Pshifter.FineTune = AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE;
+ effect->vtab = &ALpshifter_vtable;
+ break;
case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT:
case AL_EFFECT_DEDICATED_DIALOGUE:
effect->Props.Dedicated.Gain = 1.0f;