aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-10-12 06:28:12 -0700
committerChris Robinson <[email protected]>2023-10-12 06:28:12 -0700
commitd1acb001a5c4779d382838fb02660ba9aa10e4cc (patch)
tree82e342ed8f445d86041d5fd315063a146eed0bc2
parent8dad679dd05a8bbd9efd6b4bd2f35fb902133d28 (diff)
Add an orientation property for convolution reverb
Only affects ambisonic (B-Format and UHJ) formats
-rw-r--r--al/effects/convolution.cpp30
-rw-r--r--alc/inprogext.h3
2 files changed, 28 insertions, 5 deletions
diff --git a/al/effects/convolution.cpp b/al/effects/convolution.cpp
index a9426ce4..494950b7 100644
--- a/al/effects/convolution.cpp
+++ b/al/effects/convolution.cpp
@@ -36,12 +36,25 @@ void Convolution_setParamf(EffectProps* /*props*/, ALenum param, float /*val*/)
param};
}
}
-void Convolution_setParamfv(EffectProps *props, ALenum param, const float *vals)
+void Convolution_setParamfv(EffectProps *props, ALenum param, const float *values)
{
switch(param)
{
+ case AL_CONVOLUTION_REVERB_ORIENTATION_SOFT:
+ if(!(std::isfinite(values[0]) && std::isfinite(values[1]) && std::isfinite(values[2])
+ && std::isfinite(values[3]) && std::isfinite(values[4]) && std::isfinite(values[5])))
+ throw effect_exception{AL_INVALID_VALUE, "Property 0x%04x value out of range", param};
+
+ props->Convolution.OrientAt[0] = values[0];
+ props->Convolution.OrientAt[1] = values[1];
+ props->Convolution.OrientAt[2] = values[2];
+ props->Convolution.OrientUp[0] = values[3];
+ props->Convolution.OrientUp[1] = values[4];
+ props->Convolution.OrientUp[2] = values[5];
+ break;
+
default:
- Convolution_setParamf(props, param, vals[0]);
+ Convolution_setParamf(props, param, values[0]);
}
}
@@ -71,12 +84,21 @@ void Convolution_getParamf(const EffectProps* /*props*/, ALenum param, float* /*
param};
}
}
-void Convolution_getParamfv(const EffectProps *props, ALenum param, float *vals)
+void Convolution_getParamfv(const EffectProps *props, ALenum param, float *values)
{
switch(param)
{
+ case AL_CONVOLUTION_REVERB_ORIENTATION_SOFT:
+ values[0] = props->Convolution.OrientAt[0];
+ values[1] = props->Convolution.OrientAt[1];
+ values[2] = props->Convolution.OrientAt[2];
+ values[3] = props->Convolution.OrientUp[0];
+ values[4] = props->Convolution.OrientUp[1];
+ values[5] = props->Convolution.OrientUp[2];
+ break;
+
default:
- Convolution_getParamf(props, param, vals);
+ Convolution_getParamf(props, param, values);
}
}
diff --git a/alc/inprogext.h b/alc/inprogext.h
index 2fa425bb..a595721d 100644
--- a/alc/inprogext.h
+++ b/alc/inprogext.h
@@ -44,7 +44,8 @@ void AL_APIENTRY alFlushMappedBufferDirectSOFT(ALCcontext *context, ALuint buffe
#ifndef AL_SOFT_convolution_reverb
#define AL_SOFT_convolution_reverb
#define AL_EFFECT_CONVOLUTION_REVERB_SOFT 0xA000
-#define AL_EFFECTSLOT_STATE_SOFT 0x199D
+#define AL_CONVOLUTION_REVERB_ORIENTATION_SOFT 0x100F /* same as AL_ORIENTATION */
+#define AL_EFFECTSLOT_STATE_SOFT 0x199E
typedef void (AL_APIENTRY*LPALAUXILIARYEFFECTSLOTPLAYSOFT)(ALuint slotid) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALAUXILIARYEFFECTSLOTPLAYVSOFT)(ALsizei n, const ALuint *slotids) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALAUXILIARYEFFECTSLOTSTOPSOFT)(ALuint slotid) AL_API_NOEXCEPT17;